CRM-17485: Event participant role filter not working in Participant list Count Report
authoryashodha <yashodha.chaku@webaccessglobal.com>
Fri, 6 Nov 2015 11:30:40 +0000 (17:00 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Fri, 6 Nov 2015 11:30:40 +0000 (17:00 +0530)
----------------------------------------
* 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
CRM/Report/Form/Case/Summary.php
CRM/Report/Form/Event/ParticipantListing.php

index 16d51f7b32bf95b597a0fc3877778369ac996fa2..07dee98e2060fff7487ee0444ca8f296658fd1c1 100644 (file)
@@ -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;
 
index 5dedbb2b8ea5a9e77ce2416389bcf2613be842a6..cc32aeaa78a5b001268ec0664bd7b8f3f283d033 100644 (file)
@@ -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;
             }
index f5fcb538ea86e6c674c775cacc1a280c4dab28c6..21b1f0ef1fee0af724098d78239885642b327d69 100644 (file)
@@ -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;
             }