* @return CRM_Event_DAO_Event
* @throws \CRM_Core_Exception
*/
- public static function copy($id) {
+ public static function copy($id, $params = []) {
$eventValues = array();
//get the require event values.
$copyEvent = CRM_Core_DAO::copyGeneric('CRM_Event_DAO_Event',
array('id' => $id),
// since the location is sharable, lets use the same loc_block_id.
- array('loc_block_id' => CRM_Utils_Array::value('loc_block_id', $eventValues)),
+ array('loc_block_id' => CRM_Utils_Array::value('loc_block_id', $eventValues)) + $params,
$fieldsFix
);
CRM_Price_BAO_PriceSet::copyPriceSet('civicrm_event', $id, $copyEvent->id);
// now that we have the event’s id, do some more template-based stuff
if (!empty($params['template_id'])) {
- $event = CRM_Event_BAO_Event::copy($params['template_id']);
+ $event = CRM_Event_BAO_Event::copy($params['template_id'], $params);
}
else {
$event = CRM_Event_BAO_Event::create($params);