Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.18, 4.6.19, 4.7.9
-
Fix Version/s: 4.7.10
-
Component/s: CiviReport
-
Labels:
-
Documentation Required?:Developer Doc
-
Funding Source:Contributed Code
Description
I have a simple alphanumeric, multiple value custom field setup with the following values (in the format [label = value]):
One = 1
Two = 2
Three = 3
Twenty2 = 22
Fifty2 = 52
Nothing = 12
When filtering Multi-value data through CiviCRM reports, the results are incorrect if, for example searching for "value IS ONE Of 2" which I'd expect to receive all Contacts/Entities who have 2 (NOT anything else) in my results. However, instead I am receiving contacts who have 2, 12 or 52 (but not 22) in my results.
I've reproduced this on the demo site (the report name is Participant Checking List): http://d46.demo.civicrm.org/civicrm/report/instance/38?reset=1 also updated to reproduce on latest demo http://dmaster.demo.civicrm.org/civicrm/report/instance/39
If it helps, I have identified on line 1745 on CRM/Report/Form.php.
$regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', (array) $value) . "[[:cntrl:]]*"; $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'";
For a single value being filtered, I have provided a small fix to this. But it's not suitable for release, our client just needed a workaround. Hopefully, I can come up with something more suitable. But my experience with REGEXP is somewhat lacking.