From 1c72eb03f33f99396ca81fffa6e828f98a2fa2e6 Mon Sep 17 00:00:00 2001 From: benjamin Date: Mon, 27 Mar 2023 13:52:52 +0000 Subject: [PATCH] fix creating new event from template --- CRM/Event/BAO/Event.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 62c1a04389..55503aad23 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -108,7 +108,12 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event implements \Civi\Core\Hook if (!empty($params['template_id'])) { $copy = self::copy($params['template_id']); $params['id'] = $copy->id; + unset($params['template_id']); + // unless we are explicitly trying to create a new template + // we want to set the `is_template` flag on the clone to false + // so that the copy is a new event rather than a new template + $params['is_template'] = $params['is_template'] ?? 0; //fix for api from template creation bug civicrm_api4('ActionSchedule', 'update', [ -- 2.25.1