CRM-16043 fix - Search Participant doesn't retrieves participant with more then one...
authormonishdeb <monish.deb@webaccessglobal.com>
Tue, 3 Mar 2015 10:16:47 +0000 (15:46 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Tue, 3 Mar 2015 10:16:47 +0000 (15:46 +0530)
https://issues.civicrm.org/jira/browse/CRM-16043

CRM/Event/BAO/Query.php

index 64757a9ebc0ae2cb44950a9b6cdbcf6f9c94dd44..d9d0a552a862ba93a693f0be7a822be8bbd22328 100644 (file)
@@ -347,13 +347,23 @@ class CRM_Event_BAO_Query {
       case 'participant_fee_amount':
       case 'participant_fee_level':
         $qillName = $name;
-        if (in_array($name, array('participant_status_id', 'participant_role_id', 'participant_source', 'participant_id', 'participant_contact_id', 'participant_fee_amount', 'participant_fee_level', 'participant_is_pay_later'))) {
+        if (in_array($name, array(
+              'participant_status_id',
+              'participant_role_id',
+              'participant_source',
+              'participant_id',
+              'participant_contact_id',
+              'participant_fee_amount',
+              'participant_fee_level',
+              'participant_is_pay_later',
+            ))) {
           $name = str_replace('participant_', '', $name);
           if ($name == 'is_pay_later') {
             $qillName = $name;
           }
           if ($name == 'role_id') {
             $qillName = 'participant_role';
+            $query->_where[$grouping][] = " civicrm_participant.$name REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', (array) $value) . "[[:>:]]' ";
           }
         }
 
@@ -362,7 +372,7 @@ class CRM_Event_BAO_Query {
         if (in_array($name, array('participant_status', 'participant_role'))) {
           $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("$name.label", $op, $value, $dataType);
         }
-        else {
+        elseif ($name != 'role_id') {
           $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_participant.$name", $op, $value, $dataType);
         }
         list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Participant', $name, $value, $op);