Merge pull request #15803 from eileenmcnaughton/participant
[civicrm-core.git] / CRM / Event / ActionMapping.php
index 629e17438d188d1d671e4f10c8d6f98958ad7c25..031f2688e4a763732d04ec0a226b55e649933119 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
+ | Copyright CiviCRM LLC (c) 2004-2020                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -53,7 +53,7 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
    * @param \Civi\ActionSchedule\Event\MappingRegisterEvent $registrations
    */
   public static function onRegisterActionMappings(\Civi\ActionSchedule\Event\MappingRegisterEvent $registrations) {
-    $registrations->register(CRM_Event_ActionMapping::create(array(
+    $registrations->register(CRM_Event_ActionMapping::create([
       'id' => CRM_Event_ActionMapping::EVENT_TYPE_MAPPING_ID,
       'entity' => 'civicrm_participant',
       'entity_label' => ts('Event Type'),
@@ -61,8 +61,8 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
       'entity_value_label' => ts('Event Type'),
       'entity_status' => 'civicrm_participant_status_type',
       'entity_status_label' => ts('Participant Status'),
-    )));
-    $registrations->register(CRM_Event_ActionMapping::create(array(
+    ]));
+    $registrations->register(CRM_Event_ActionMapping::create([
       'id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID,
       'entity' => 'civicrm_participant',
       'entity_label' => ts('Event Name'),
@@ -70,8 +70,8 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
       'entity_value_label' => ts('Event Name'),
       'entity_status' => 'civicrm_participant_status_type',
       'entity_status_label' => ts('Participant Status'),
-    )));
-    $registrations->register(CRM_Event_ActionMapping::create(array(
+    ]));
+    $registrations->register(CRM_Event_ActionMapping::create([
       'id' => CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID,
       'entity' => 'civicrm_participant',
       'entity_label' => ts('Event Template'),
@@ -79,7 +79,7 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
       'entity_value_label' => ts('Event Template'),
       'entity_status' => 'civicrm_participant_status_type',
       'entity_status_label' => ts('Participant Status'),
-    )));
+    ]));
   }
 
   /**
@@ -89,12 +89,12 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
    *   Array(string $fieldName => string $fieldLabel).
    */
   public function getDateFields() {
-    return array(
+    return [
       'start_date' => ts('Event Start Date'),
       'end_date' => ts('Event End Date'),
       'registration_start_date' => ts('Registration Start Date'),
       'registration_end_date' => ts('Registration End Date'),
-    );
+    ];
   }
 
   /**
@@ -130,7 +130,7 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
         return \CRM_Event_PseudoConstant::participantRole();
 
       default:
-        return array();
+        return [];
     }
   }
 
@@ -158,7 +158,7 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
     $query['casContactTableAlias'] = NULL;
     $query['casDateField'] = str_replace('event_', 'r.', $schedule->start_action_date);
     if (empty($query['casDateField']) && $schedule->absolute_date) {
-      $query['casDateField'] = $schedule->absolute_date;
+      $query['casDateField'] = "'" . CRM_Utils_Type::escape($schedule->absolute_date, 'String') . "'";
     }
 
     $query->join('r', 'INNER JOIN civicrm_event r ON e.event_id = r.id');