-
-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#3495 - Fix fields with wildcards in Advanced Search #23697
Conversation
…rashed Correctly handle those field values which are arrays, e.g. ['LIKE' => 'field-value'], rather than strings.
Only add a trailing '%' if it does not already exist.
Can one of the admins verify this patch? |
(Standard links)
|
Jenkins ok to test |
@@ -6309,15 +6309,13 @@ public static function getQillValue($daoName, string $name, $value, $op, string | |||
public static function getWildCardedValue($wildcard, $op, $value) { | |||
if ($wildcard && $op === 'LIKE') { | |||
if (CRM_Core_Config::singleton()->includeWildCardInName && (substr($value, 0, 1) != '%')) { | |||
return "%$value%"; | |||
$value = "%$value"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before, it wrapped the string with %
s on both sides. After, it only prepends %
.
My memory of this codepath is a bit stale -- but wouldn't that be a substantive change in the search behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the following two lines (6314-6315) which add the trailing '%' if it does not already exist.
I was able to replicate this and confirm that the patch fixes the bug and that paging still works on the Contribution Search (which did not have this bug). Much as I hate touching anything at all in the legacy search code now this is clearly a bug rather than a new feature and stepping through the code I could see it was carefully implemented with handling for both forms. I'm going with 'gratefully accept this patch' |
Overview
In the affected function, some fields are arrays, e.g. ['LIKE' => 'field-value'], rather than strings as was expected. Modified to now check for that and handle correctly.
Before
After
Technical Details
Comments