Affects Version/s: None
Fix Version/s: 1.5
We need to begin storing custom field data values for checkboxes and multiple select fields with leading and trailing delimter characters (Ctrl+A).
Doing this will allow us to reliably search for values in these fields using a delimiter-bounded wild-carded string: [ctrl+A]%searchString%[ctrl+A].
Currently, the delimiter is only used to separate multiple values.
NOTE: I will use the PIPE symbol ( | ) to represent the non-printing Ctrl-A char in the examples in this issue.
For our sample custom field "GOTV Experience", we can have data values of HM, PB, PW, or SB. Currently, if only one value is checked, then HM is stored in civicrm_custom_value.char_data. With this modification, we would store a single value as |HM|
Currently, if 2 values were checked, we would store: HM|PB in char_data. With this modification we would store this as |HM|PB| (note the added leading and trailing delimiters).
1. Modify custom field value insert and update routines to always add leading and trailing delimiters IF the associated custom field's html_type is CheckBox or Multi-Select. (We will NOT do this for single value field types such as 'Radio' and 'Select'.). (including create/update APIs)
2. Modify search query segment used for these types of custom fields to add leading / trailing delims to search criteria: [ctrl+A]%searchString%[ctrl+A] (including search API).
3. Modify code which gets / displays values for these field types (including APIs) to remove leading and trailing delims prior to display.