X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FActionMapping.php;h=2f5f7b28d7deef350738befebc51102d7ed030a2;hb=5c6fd6e2873a28bb27c12e7189a5c1fecbed5775;hp=4dee05a6ed910acb6c7c494fac012dbe55ffcb5e;hpb=dc617c20a5a57ddc6f77b6c5404f5af65dfe58dd;p=civicrm-core.git diff --git a/CRM/Contact/ActionMapping.php b/CRM/Contact/ActionMapping.php index 4dee05a6ed..2f5f7b28d7 100644 --- a/CRM/Contact/ActionMapping.php +++ b/CRM/Contact/ActionMapping.php @@ -25,7 +25,6 @@ +--------------------------------------------------------------------+ */ -use Civi\ActionSchedule\RecipientBuilder; /** * Class CRM_Contact_ActionMapping @@ -51,7 +50,7 @@ class CRM_Contact_ActionMapping extends \Civi\ActionSchedule\Mapping { * @param \Civi\ActionSchedule\Event\MappingRegisterEvent $registrations */ public static function onRegisterActionMappings(\Civi\ActionSchedule\Event\MappingRegisterEvent $registrations) { - $registrations->register(CRM_Contact_ActionMapping::create(array( + $registrations->register(CRM_Contact_ActionMapping::create([ 'id' => CRM_Contact_ActionMapping::CONTACT_MAPPING_ID, 'entity' => 'civicrm_contact', 'entity_label' => ts('Contact'), @@ -60,14 +59,14 @@ class CRM_Contact_ActionMapping extends \Civi\ActionSchedule\Mapping { 'entity_status' => 'contact_date_reminder_options', 'entity_status_label' => ts('Annual Options'), 'entity_date_start' => 'date_field', - ))); + ])); } - private $contactDateFields = array( + private $contactDateFields = [ 'birth_date', 'created_date', 'modified_date', - ); + ]; /** * Determine whether a schedule based on this mapping is sufficiently @@ -79,7 +78,7 @@ class CRM_Contact_ActionMapping extends \Civi\ActionSchedule\Mapping { * List of error messages. */ public function validateSchedule($schedule) { - $errors = array(); + $errors = []; if (CRM_Utils_System::isNull($schedule->entity_value) || $schedule->entity_value === '0') { $errors['entity'] = ts('Please select a specific date field.'); } @@ -119,30 +118,31 @@ class CRM_Contact_ActionMapping extends \Civi\ActionSchedule\Mapping { elseif (in_array($selectedValues[0], $this->contactDateFields)) { $dateDBField = $selectedValues[0]; $query = \CRM_Utils_SQL_Select::from("{$this->entity} e")->param($defaultParams); - $query->param(array( + $query->param([ 'casAddlCheckFrom' => 'civicrm_contact e', 'casContactIdField' => 'e.id', 'casEntityIdField' => 'e.id', 'casContactTableAlias' => 'e', - )); + ]); $query->where('e.is_deleted = 0 AND e.is_deceased = 0'); } else { //custom field - $customFieldParams = array('id' => substr($selectedValues[0], 7)); - $customGroup = $customField = array(); + $customFieldParams = ['id' => substr($selectedValues[0], 7)]; + $customGroup = $customField = []; \CRM_Core_BAO_CustomField::retrieve($customFieldParams, $customField); $dateDBField = $customField['column_name']; - $customGroupParams = array('id' => $customField['custom_group_id'], $customGroup); + $customGroupParams = ['id' => $customField['custom_group_id'], $customGroup]; \CRM_Core_BAO_CustomGroup::retrieve($customGroupParams, $customGroup); $query = \CRM_Utils_SQL_Select::from("{$customGroup['table_name']} e")->param($defaultParams); - $query->param(array( + $query->param([ 'casAddlCheckFrom' => "{$customGroup['table_name']} e", 'casContactIdField' => 'e.entity_id', 'casEntityIdField' => 'e.id', 'casContactTableAlias' => NULL, - )); - $query->where('1'); // possible to have no "where" in this case + ]); + // possible to have no "where" in this case + $query->where('1'); } $query['casDateField'] = 'e.' . $dateDBField;