From ef36db8b1f1fc14c0ead11699ee4e92c67b3c4e5 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Fri, 17 Jul 2015 12:33:24 +0530 Subject: [PATCH] CRM-16858 fix - Participant Status & ID error in adv.search builder https://issues.civicrm.org/jira/browse/CRM-16858 --- CRM/Event/Form/Search.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index 154d96b4d3..0834673f1b 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -197,7 +197,10 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { $seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )"; } if (!empty($this->_formValues['participant_status_id'])) { - $seatClause[] = '( participant.status_id IN ( ' . implode(' , ', (array) $this->_formValues['participant_status_id']) . ' ) )'; + $seatClause[] = CRM_Contact_BAO_Query::buildClause("participant.status_id", '=', $this->_formValues['participant_status_id'], 'Int'); + if ($status = CRM_Utils_Array::value('IN', $this->_formValues['participant_status_id'])) { + $this->_formValues['participant_status_id'] = $status; + } } if (!empty($this->_formValues['participant_role_id'])) { $seatClause[] = '( participant.role_id IN ( ' . implode(' , ', (array) $this->_formValues['participant_role_id']) . ' ) )'; @@ -392,7 +395,11 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { elseif (is_numeric($status)) { $statusTypes = (int) $status; } - $this->_formValues['participant_status_id'] = is_array($statusTypes) ? array_keys($statusTypes) : $statusTypes; + + $this->_formValues['participant_status_id'] = is_array($statusTypes) ? array('IN' => array_keys($statusTypes)) : $statusTypes; + } + elseif ($statusTypes = CRM_Utils_Array::value('participant_status_id', $this->_formValues)) { + $this->_formValues['participant_status_id'] = is_array($statusTypes) ? array('IN' => $statusTypes) : $statusTypes; } $role = CRM_Utils_Request::retrieve('role', 'String', -- 2.25.1