From: Coleman Watts Date: Thu, 29 Aug 2019 16:11:07 +0000 (-0400) Subject: [REF] Move clone template functionality from api to bao X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=26c0fc1a35a4dd454b24c0e608d10c8499d573ec;p=civicrm-core.git [REF] Move clone template functionality from api to bao --- 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'); }