Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Duplicate
-
Affects Version/s: 4.6.5
-
Fix Version/s: 4.6.6
-
Component/s: CiviCRM Search
-
Labels:
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
Note - I marked as "Minor" but search on custom fields should consider a bump to major.
Several search screens fail to work with some option based custom fields. Here is what I tested:
Advanced Search with Contact field:
- Works with select
- Does not work with checkbox
- Does not work with multi-select
Find Grant Screen
- Does not work with checkbox
- Does not work with multi-select
*I verified this on the demo site
*I created a field with two options "test 1" and "test 2".
The search does work in search builder and API
Console shows notice: Notice: Array to string conversion in CRM_Core_BAO_CustomQuery->where() (line 418 of /civicrm/CRM/Core/BAO/CustomQuery.php).
The code referenced above:
// CRM-14563,CRM-16575 : Special handling of multi-select custom fields
if (!empty($value)) { if ($isSerialized) { if (strstr($op, 'IN')) { $value = str_replace(array('(', ')'), '', str_replace(",", "[[:cntrl:]]|[[:cntrl:]]", $value)); } $op = (strstr($op, '!') || strstr($op, 'NOT')) ? 'NOT RLIKE' : 'RLIKE'; $value = "[[:cntrl:]]" . $value . "[[:cntrl:]]"; } elseif ($wildcard) { $value = "[[:cntrl:]]%$value%[[:cntrl:]]"; $op = 'LIKE'; } }