Fix crash when event_id is not set
authorMatthew Wire <mjw@mjwconsult.co.uk>
Wed, 16 Aug 2017 13:28:20 +0000 (14:28 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Wed, 16 Aug 2017 13:28:20 +0000 (14:28 +0100)
CRM/Core/DAO.php
CRM/Event/Selector/Search.php

index 58e556e2a7537ebd7a8bd515a8b839dd8cf0709c..7835ae0261a8d5db2da39b5dc7e1e1a9c98062a2 100644 (file)
@@ -1088,7 +1088,7 @@ FROM   civicrm_domain
       empty($searchValue) ||
       trim(strtolower($searchValue)) == 'null'
     ) {
-      // adding this year since developers forget to check for an id
+      // adding this here since developers forget to check for an id
       // or for the 'null' (which is a bad DAO kludge)
       // and hence we get the first value in the db
       CRM_Core_Error::fatal();
index bdef479abbdf242c34f9b76002fd0ab3bf5f8759..a9432f1f56cea5e1351427732e9b7b24d80ad9f9 100644 (file)
@@ -342,6 +342,11 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
         }
       }
 
+      // Skip registration if event_id is NULL
+      if (empty($row['event_id'])) {
+        continue;
+      }
+
       //carry campaign on selectors.
       $row['campaign'] = CRM_Utils_Array::value($result->participant_campaign_id, $allCampaigns);
       $row['campaign_id'] = $result->participant_campaign_id;