From 113ebf52cb3f0c0ba5d30242017a730c6a8d8269 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton <emcnaughton@wikimedia.org> Date: Wed, 1 Mar 2023 20:44:04 +1300 Subject: [PATCH] dev/core#4145 Prevent fatal on event sched reminders when CiviEvent enabled --- CRM/Event/ActionMapping.php | 3 +++ Civi/ActionSchedule/Mapping.php | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CRM/Event/ActionMapping.php b/CRM/Event/ActionMapping.php index c474a8dba6a..a14785f48b1 100644 --- a/CRM/Event/ActionMapping.php +++ b/CRM/Event/ActionMapping.php @@ -37,6 +37,9 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping { * @param \Civi\ActionSchedule\Event\MappingRegisterEvent $registrations */ public static function onRegisterActionMappings(\Civi\ActionSchedule\Event\MappingRegisterEvent $registrations) { + if (!CRM_Core_Component::isEnabled('CiviEvent')) { + return; + } $registrations->register(CRM_Event_ActionMapping::create([ 'id' => CRM_Event_ActionMapping::EVENT_TYPE_MAPPING_ID, 'entity' => 'civicrm_participant', diff --git a/Civi/ActionSchedule/Mapping.php b/Civi/ActionSchedule/Mapping.php index 2c092ddcea2..6032dcf1031 100644 --- a/Civi/ActionSchedule/Mapping.php +++ b/Civi/ActionSchedule/Mapping.php @@ -275,15 +275,17 @@ abstract class Mapping implements MappingInterface { asort($valueLabelMap['activity_type']); $valueLabelMap['activity_status'] = \CRM_Core_PseudoConstant::activityStatus(); - $valueLabelMap['event_type'] = \CRM_Event_PseudoConstant::eventType(); - $valueLabelMap['civicrm_event'] = \CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )"); - $valueLabelMap['civicrm_participant_status_type'] = \CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'); - $valueLabelMap['event_template'] = \Civi\Api4\Event::get(FALSE) - ->addWhere('is_template', '=', TRUE) - ->addWhere('is_active', '=', TRUE) - ->execute() - ->indexBy('id') - ->column('template_title'); + if (\CRM_Core_Component::isEnabled('CiviEvent')) { + $valueLabelMap['event_type'] = \CRM_Event_PseudoConstant::eventType(); + $valueLabelMap['civicrm_event'] = \CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )"); + $valueLabelMap['civicrm_participant_status_type'] = \CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'); + $valueLabelMap['event_template'] = \Civi\Api4\Event::get(FALSE) + ->addWhere('is_template', '=', TRUE) + ->addWhere('is_active', '=', TRUE) + ->execute() + ->indexBy('id') + ->column('template_title'); + } $valueLabelMap['auto_renew_options'] = \CRM_Core_OptionGroup::values('auto_renew_options'); $valueLabelMap['contact_date_reminder_options'] = \CRM_Core_OptionGroup::values('contact_date_reminder_options'); $valueLabelMap['civicrm_membership_type'] = \CRM_Member_PseudoConstant::membershipType(); -- GitLab