From 0045993c8a9549277b821fe3f391a6e5b8ff3304 Mon Sep 17 00:00:00 2001 From: ufundo Date: Mon, 18 Apr 2022 14:13:12 +0000 Subject: [PATCH] Update copied event reminders to link to new event when creating from template using api4 --- CRM/Event/BAO/Event.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 0aadbbae0d..559e651d67 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -112,6 +112,19 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { $copy = self::copy($params['template_id']); $params['id'] = $copy->id; unset($params['template_id']); + + //fix for api from template creation bug + civicrm_api4('ActionSchedule', 'update', [ + 'checkPermissions' => FALSE, + 'values' => [ + 'mapping_id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID, + ], + 'where' => [ + ['entity_value', '=', $copy->id], + ['mapping_id', '=', CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID], + ], + ]); + } } -- 2.25.1