Skip to content

Commit

Permalink
Merge pull request #19308 from eileenmcnaughton/ev
Browse files Browse the repository at this point in the history
dev/core#766 fix failure to save custom data on template-based-event
  • Loading branch information
mattwire authored Jan 7, 2021
2 parents 5fad922 + 426cf44 commit b97d805
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CRM/Event/BAO/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,13 @@ public static function getTemplateDefaultValues($templateId) {
'template_title',
];
$defaults = array_diff_key($defaults, array_flip($fieldsToExclude));
foreach ($defaults as $key => $value) {
$customFieldInfo = CRM_Core_BAO_CustomField::getKeyID($key, TRUE);
if (!empty($customFieldInfo[1])) {
$defaults[str_replace($customFieldInfo[1], '-' . $customFieldInfo[1], $key)] = $value;
unset($defaults[$key]);
}
}
return $defaults;
}

Expand Down
7 changes: 0 additions & 7 deletions CRM/Event/Form/ManageEvent/EventInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,6 @@ public function postProcess() {
//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,
Expand Down

0 comments on commit b97d805

Please sign in to comment.