From 26c0fc1a35a4dd454b24c0e608d10c8499d573ec Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 29 Aug 2019 12:11:07 -0400 Subject: [PATCH] [REF] Move clone template functionality from api to bao --- CRM/Event/BAO/Event.php | 7 +++++++ api/v3/Event.php | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 54e4b727bf..9499f12d48 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -132,6 +132,13 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { $params['created_id'] = $session->get('userID'); } $params['created_date'] = date('YmdHis'); + + // Clone from template + if (!empty($params['template_id'])) { + $copy = self::copy($params['template_id']); + $params['id'] = $copy->id; + unset($params['template_id']); + } } $event = self::add($params); diff --git a/api/v3/Event.php b/api/v3/Event.php index b3dbd7adcd..830379d3a6 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -57,13 +57,6 @@ function civicrm_api3_event_create($params) { ]); } - // Clone event from template - if (!empty($params['template_id']) && empty($params['id'])) { - $copy = CRM_Event_BAO_Event::copy($params['template_id']); - $params['id'] = $copy->id; - unset($params['template_id']); - } - _civicrm_api3_event_create_legacy_support_42($params); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Event'); } -- 2.25.1