From 07d76dca62a3f5ae0c784567a4f6e970e07c1dfd Mon Sep 17 00:00:00 2001 From: monishdeb Date: Tue, 3 Mar 2015 15:46:47 +0530 Subject: [PATCH] CRM-16043 fix - Search Participant doesn't retrieves participant with more then one role https://issues.civicrm.org/jira/browse/CRM-16043 --- CRM/Event/BAO/Query.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index 64757a9ebc..d9d0a552a8 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -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); -- 2.25.1