Skip to content

Commit

Permalink
Fix missing default values for event registration setup
Browse files Browse the repository at this point in the history
  • Loading branch information
larssandergreen committed Jan 24, 2023
1 parent 039f856 commit 2fa95a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions CRM/Event/Form/ManageEvent/Registration.php
Expand Up @@ -116,8 +116,7 @@ public function setDefaultValues() {
$defaults["custom_post_id_multiple[$key]"] = $value;
}
}

$this->assign('profilePostMultiple', CRM_Utils_Array::value('custom_post', $defaults));
$this->assign('profilePostMultiple', $defaults['custom_post'] ?? NULL);

// CRM-17745: Make max additional participants configurable
if (empty($defaults['max_additional_participants'])) {
Expand Down Expand Up @@ -149,7 +148,7 @@ public function setDefaultValues() {
$defaults["additional_custom_post_id_multiple[$key]"] = $value;
}
}
$this->assign('profilePostMultipleAdd', CRM_Utils_Array::value('additional_custom_post', $defaults, []));
$this->assign('profilePostMultipleAdd', $defaults['additional_custom_post'] ?? []);
}
else {
// Avoid PHP notices in the template
Expand All @@ -161,10 +160,10 @@ public function setDefaultValues() {
}

// provide defaults for required fields if empty (and as a 'hint' for approval message field)
$defaults['registration_link_text'] = CRM_Utils_Array::value('registration_link_text', $defaults, ts('Register Now'));
$defaults['confirm_title'] = CRM_Utils_Array::value('confirm_title', $defaults, ts('Confirm Your Registration Information'));
$defaults['thankyou_title'] = CRM_Utils_Array::value('thankyou_title', $defaults, ts('Thank You for Registering'));
$defaults['approval_req_text'] = CRM_Utils_Array::value('approval_req_text', $defaults, ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.'));
$defaults['registration_link_text'] = $defaults['registration_link_text'] ?? ts('Register Now');
$defaults['confirm_title'] = $defaults['confirm_title'] ?? ts('Confirm Your Registration Information');
$defaults['thankyou_title'] = $defaults['thankyou_title'] ?? ts('Thank You for Registering');
$defaults['approval_req_text'] = $defaults['approval_req_text'] ?? ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.');

return $defaults;
}
Expand Down Expand Up @@ -442,6 +441,9 @@ public function addRules() {
public static function formRule($values, $files, $form) {
if (!empty($values['is_online_registration'])) {

if (!$values['registration_link_text']) {
$errorMsg['registration_link_text'] = ts('Please enter Registration Link Text');
}
if (!$values['confirm_title']) {
$errorMsg['confirm_title'] = ts('Please enter a Title for the registration Confirmation Page');
}
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Event/Form/ManageEvent/Registration.tpl
Expand Up @@ -50,7 +50,7 @@

<tr class="crm-event-manage-registration-form-block-registration_link_text">
<td scope="row" class="label"
width="20%">{$form.registration_link_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='registration_link_text' id=$eventID}{/if}</td>
width="20%">{$form.registration_link_text.label} <span class="crm-marker">*</span>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='registration_link_text' id=$eventID}{/if}</td>
<td>{$form.registration_link_text.html} {help id="id-link_text"}</td>
</tr>
{if !$isTemplate}
Expand Down

0 comments on commit 2fa95a7

Please sign in to comment.