QA fixes
authormonishdeb <monish.deb@webaccessglobal.com>
Wed, 25 Feb 2015 13:22:36 +0000 (18:52 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Wed, 25 Feb 2015 13:22:36 +0000 (18:52 +0530)
CRM/Contact/BAO/Query.php
CRM/Contact/Form/Search/Advanced.php
CRM/Event/BAO/Query.php
CRM/Event/Form/Search.php

index 5b3740658dd62de894fdcbd3b2f6ab1294722187..1cd5f00faf030879778b298fd032424f99246699 100644 (file)
@@ -5669,7 +5669,7 @@ AND   displayRelType.is_active = 1
     }
     elseif (is_array($fieldValue)) {
       $qillString = array();
-      if (in_array(key($fieldValue), CRM_Core_DAO::acceptedSQLOperators())) {
+      if (in_array(key($fieldValue), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
         $op = key($fieldValue);
         $fieldValue = $fieldValue[$op];
       }
index 09ce18cbf4a5bc2856b3d98093d1ef15aedda0e8..df59f52f9921f92e9994b5a1ba50bea7edc4036e 100644 (file)
@@ -372,8 +372,6 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
       'activity_type_id',
       'status_id',
       'activity_subject',
-      'participant_status_id',
-      'participant_role_id',
     );
     foreach ($specialParams as $element) {
       $value = CRM_Utils_Array::value($element, $this->_formValues);
index 41b291528d2297717ef612b6be99071f62842e82..a71b9d0d220b2906feab4dc37d8d81523d0bc628 100644 (file)
@@ -333,10 +333,13 @@ class CRM_Event_BAO_Query {
         );
         return;
 
-      case 'participant_status':
       case 'participant_status_id':
-      case 'participant_role':
       case 'participant_role_id':
+        if ($value && is_array($value) && strpos($op , 'IN') === FALSE) {
+          $op = 'IN';
+        }
+      case 'participant_status':
+      case 'participant_role':
       case 'participant_source':
       case 'participant_id':
       case 'participant_contact_id':
index cd99eb484ad4b6637718b9237453ad37953b4cdc..9c77329ff6d3647d415a50706733d52eb49fd221 100644 (file)
@@ -193,16 +193,26 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
       if (count($eventIds) == 1) {
         //convert form values to clause.
         $seatClause = array();
+        if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0') {
+          $seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )";
+        }
+        if (!empty($this->_formValues['participant_status_id'])) {
+          $seatClause[] = '( participant.status_id IN ( ' . implode(' , ', $this->_formValues['participant_status_id']) . ' ) )';
+        }
+        if (!empty($this->_formValues['participant_role_id'])) {
+          $seatClause[] = '( participant.role_id IN ( ' . implode(' , ', $this->_formValues['participant_role_id']) . ' ) )';
+        }
+
         // CRM-15379
-        $clause = NULL;
         if (!empty($this->_formValues['participant_fee_id'])) {
           $participant_fee_id = $this->_formValues['participant_fee_id'];
           $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $participant_fee_id, 'label');
           $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
-          $clause = " ( participant.fee_level LIKE '%$feeLabel%' ) ";
+          $seatClause[] = "( participant.fee_level LIKE '%$feeLabel%' )";
         }
 
-        $participantCount = CRM_Event_BAO_Event::eventTotalSeats(array_pop($eventIds), $clause);
+        $seatClause = implode(' AND ', $seatClause);
+        $participantCount = CRM_Event_BAO_Event::eventTotalSeats(array_pop($eventIds), $seatClause);
       }
       $this->assign('participantCount', $participantCount);
       $this->assign('lineItems', $lineItems);
@@ -402,13 +412,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
       $this->_formValues['participant_role_id'] = $roleTypes;
     }
 
-    foreach (array('participant_status_id', 'participant_role_id') as $element) {
-      $value = CRM_Utils_Array::value($element, $this->_formValues);
-      if ($value && is_array($value)) {
-        $this->_formValues[$element] = array('IN' => $value);
-      }
-    }
-
     $type = CRM_Utils_Request::retrieve('type', 'Positive',
       CRM_Core_DAO::$_nullObject
     );