CRM-14983 - Sunning Contribution via Search Builder Fails Putting Contacts in Smart...
[civicrm-core.git] / CRM / Event / BAO / Query.php
index 707e535b79738f599593f8e7ef42a836c4fe055c..3e4873a60288104c4af1b55732dd770b71e3b564 100644 (file)
@@ -333,7 +333,7 @@ class CRM_Event_BAO_Query {
           $status = $value;
         }
 
-        if (count($val) > 1) {
+        if (count($val) > 0) {
           $op = 'IN';
           $status = "({$status})";
         }
@@ -347,7 +347,9 @@ class CRM_Event_BAO_Query {
           }
         }
         else {
-          $names[] = $statusTypes[$value];
+          if (!empty($value)) {
+            $names[] = $statusTypes[$value];
+          }
         }
 
         $query->_qill[$grouping][] = ts('Participant Status %1', array(1 => $op)) . ' ' . implode(' ' . ts('or') . ' ', $names);
@@ -378,7 +380,9 @@ class CRM_Event_BAO_Query {
 
         $names = array();
         foreach ($val as $id => $dontCare) {
-          $names[] = $roleTypes[$id];
+          if (!empty($roleTypes[$id]) ) {
+            $names[] = $roleTypes[$id];
+          }
         }
 
         if (!empty($names)) {
@@ -596,7 +600,6 @@ class CRM_Event_BAO_Query {
     CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE);
 
     $status = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
-    asort($status);
     foreach ($status as $id => $Name) {
       $form->_participantStatus = &$form->addElement('checkbox', "participant_status_id[$id]", NULL, $Name);
     }