CRM-16858 fix - Participant Status & ID error in adv.search builder
authormonishdeb <monish.deb@webaccessglobal.com>
Fri, 17 Jul 2015 07:03:24 +0000 (12:33 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Fri, 17 Jul 2015 07:03:24 +0000 (12:33 +0530)
https://issues.civicrm.org/jira/browse/CRM-16858

CRM/Event/Form/Search.php

index 154d96b4d36dbda45a185390c9dd419f58a99851..0834673f1b06110fdff84c57cc1dce19f9279a05 100644 (file)
@@ -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',