From 6e987e3a37bd55d4d49941547a52caa035c39f62 Mon Sep 17 00:00:00 2001 From: yashodha Date: Fri, 6 Nov 2015 17:00:40 +0530 Subject: [PATCH] CRM-17485: Event participant role filter not working in Participant list Count Report ---------------------------------------- * CRM-17485: Event participant role filter not working in Participant list Count Report https://issues.civicrm.org/jira/browse/CRM-17485 --- CRM/Report/Form.php | 17 ++++++++--------- CRM/Report/Form/Case/Summary.php | 5 +++-- CRM/Report/Form/Event/ParticipantListing.php | 5 +++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 16d51f7b32..07dee98e20 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1737,18 +1737,17 @@ class CRM_Report_Form extends CRM_Core_Form { break; case 'mhas': - // mhas == multiple has - if ($value !== NULL && count($value) > 0) { - $sqlOP = $this->getSQLOperator($op); - $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )"; - } - break; - case 'mnot': - // mnot == multiple is not one of + // mhas == multiple has if ($value !== NULL && count($value) > 0) { $sqlOP = $this->getSQLOperator($op); - $clause = "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )"; + $operator = ''; + if ($op == 'mnot') { + // mnot == multiple is not one of + $operator = 'NOT'; + } + $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', (array) $value) . "[[:cntrl:]]*"; + $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'"; } break; diff --git a/CRM/Report/Form/Case/Summary.php b/CRM/Report/Form/Case/Summary.php index 5dedbb2b8e..cc32aeaa78 100644 --- a/CRM/Report/Form/Case/Summary.php +++ b/CRM/Report/Form/Case/Summary.php @@ -295,8 +295,9 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id if ($op == 'notin') { $operator = 'NOT'; } - $clause = "( {$field['dbAlias']} {$operator} REGEXP '[[:<:]]" . - implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )"; + + $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', $value) . "[[:cntrl:]]*"; + $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'"; } $op = NULL; } diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php index f5fcb538ea..21b1f0ef1f 100644 --- a/CRM/Report/Form/Event/ParticipantListing.php +++ b/CRM/Report/Form/Event/ParticipantListing.php @@ -576,8 +576,9 @@ ORDER BY cv.label if ($op == 'notin') { $operator = 'NOT'; } - $clause = "( {$field['dbAlias']} {$operator} REGEXP '[[:<:]]" . - implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )"; + + $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', $value) . "[[:cntrl:]]*"; + $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'"; } $op = NULL; } -- 2.25.1