X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FForm%2FManageEvent%2FEventInfo.php;h=db2d950951b2ac5886cbf4c2570df6b160f824de;hb=8c605c27ff34fbbbcbb9c75caf8303941c1934db;hp=31317c09aa8d0fff18bea5c9a54815b1f1b79ca2;hpb=b8d1d8d3a49606e8df2ff25fcebf3b9c251c5059;p=civicrm-core.git diff --git a/CRM/Event/Form/ManageEvent/EventInfo.php b/CRM/Event/Form/ManageEvent/EventInfo.php index 31317c09aa..db2d950951 100644 --- a/CRM/Event/Form/ManageEvent/EventInfo.php +++ b/CRM/Event/Form/ManageEvent/EventInfo.php @@ -48,10 +48,11 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { parent::preProcess(); $this->assign('selectedChild', 'settings'); - if ($this->_id) { - $this->assign('entityID', $this->_id); + $entityID = $this->_id ?: $this->_templateId; + if ($entityID) { + $this->assign('entityID', $entityID); $eventType = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', - $this->_id, + $entityID, 'event_type_id' ); } @@ -127,7 +128,6 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { if ($this->_eventType) { $this->assign('customDataSubType', $this->_eventType); } - $this->assign('entityId', $this->_id); $this->_first = TRUE; $this->applyFilter('__ALL__', 'trim'); @@ -228,7 +228,7 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { * Process the form submission. */ public function postProcess() { - $params = $this->controller->exportValues($this->_name); + $params = array_merge($this->controller->exportValues($this->_name), $this->_submitValues); //format params $params['start_date'] = CRM_Utils_Array::value('start_date', $params); @@ -241,19 +241,23 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { $params['default_role_id'] = CRM_Utils_Array::value('default_role_id', $params, FALSE); $params['id'] = $this->_id; - $customFields = CRM_Core_BAO_CustomField::getFields('Event', FALSE, FALSE, - CRM_Utils_Array::value('event_type_id', $params) - ); - $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, - $this->_id, - 'Event' - ); - //merge params with defaults from templates if (!empty($params['template_id'])) { $params = array_merge(CRM_Event_BAO_Event::getTemplateDefaultValues($params['template_id']), $params); + foreach ($params as $key => $value) { + $customFieldInfo = CRM_Core_BAO_CustomField::getKeyID($key, TRUE); + if (!empty($customFieldInfo[1])) { + $params[str_replace($customFieldInfo[1], '-' . $customFieldInfo[1], $key)] = $value; + unset($params[$key]); + } + } } + $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, + $this->_id, + 'Event' + ); + // 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'], $params);