From 1b007dd0c5cec0b360fc432a6f020a5067eb236e Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Sun, 4 Jun 2023 11:14:01 -0600 Subject: [PATCH] Improve button text for free registrations and additional participants --- .../Registration/AdditionalParticipant.php | 34 +++++++++++++------ CRM/Event/Form/Registration/Confirm.php | 2 +- CRM/Event/Form/Registration/Register.php | 6 +--- .../CRM/Event/Form/Registration/Confirm.tpl | 10 +++--- .../CRM/Event/Form/Registration/Register.tpl | 11 ++++-- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index fb9989b880..2b000a3037 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -336,25 +336,37 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R //CRM-4320 if ($allowToProceed) { - $buttons = array_merge($buttons, [ - [ - 'type' => 'upload', - 'name' => ts('Continue'), - 'spacing' => '                  ', - 'isDefault' => TRUE, - ], - ]); if ($includeSkipButton) { - $buttons = array_merge($buttons, [ + $buttons[] = [ 'type' => 'next', 'name' => ts('Skip Participant'), 'subName' => 'skip', 'icon' => 'fa-fast-forward', - ], - ]); + ]; } + $buttonParams = [ + 'type' => 'upload', + 'spacing' => '                  ', + 'isDefault' => TRUE, + ]; + if ($this->isLastParticipant(TRUE)) { + if ($this->_values['event']['is_confirm_enabled'] || $this->_values['event']['is_monetary']) { + $buttonParams['name'] = ts('Review'); + $buttonParams['icon'] = 'fa-chevron-right'; + } + else { + $buttonParams['name'] = ts('Register'); + $buttonParams['icon'] = 'fa-check'; + } + } + else { + $buttonParams['name'] = ts('Continue'); + $buttonParams['icon'] = 'fa-chevron-right'; + } + $buttons[] = $buttonParams; } + $this->addButtons($buttons); $this->addFormRule(['CRM_Event_Form_Registration_AdditionalParticipant', 'formRule'], $this); $this->unsavedChangesWarn = TRUE; diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 3e01e84dcd..e328443a7d 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -275,7 +275,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { //consider total amount. $this->assign('isAmountzero', $this->_totalAmount <= 0); - $contribButton = ts('Continue'); + $contribButton = ts('Register'); $this->addButtons([ [ 'type' => 'back', diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 8b0b026349..0810e53cf2 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -513,11 +513,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { 'spacing' => '         ', 'isDefault' => TRUE, ]; - if ( - !$this->_values['event']['is_multiple_registrations'] - && !$this->_values['event']['is_monetary'] - && !$this->_values['event']['is_confirm_enabled'] - ) { + if (!$this->_values['event']['is_monetary'] && !$this->_values['event']['is_confirm_enabled']) { $buttonParams['name'] = ts('Register'); } else { diff --git a/templates/CRM/Event/Form/Registration/Confirm.tpl b/templates/CRM/Event/Form/Registration/Confirm.tpl index f5308b4e4f..e806d31e3f 100644 --- a/templates/CRM/Event/Form/Registration/Confirm.tpl +++ b/templates/CRM/Event/Form/Registration/Confirm.tpl @@ -16,19 +16,19 @@
{if $isOnWaitlist}
- {ts}Please verify the information below. Then click 'Continue' to be added to the WAIT LIST for this event. If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts} + {ts}Please verify the information below. Then click 'Register' to be added to the WAIT LIST for this event. If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts}
{elseif $isRequireApproval}
- {ts}Please verify the information below. Then click 'Continue' to submit your registration. Once approved, you will receive an email with a link to a web page where you can complete the registration process.{/ts} + {ts}Please verify the information below. Then click 'Register' to submit your registration. Once approved, you will receive an email with a link to a web page where you can complete the registration process.{/ts}
{else}
{ts}Please verify the information below. Click the Go Back button below if you need to make changes.{/ts} {if $contributeMode EQ 'notify' and !$is_pay_later and ! $isAmountzero } - {ts 1=$paymentProcessor.name}Click the Continue button to checkout to %1, where you will select your payment method and complete the registration.{/ts} + {ts 1=$paymentProcessor.name}Click the Register button to checkout to %1, where you will select your payment method and complete the registration.{/ts} {else} - {ts}Otherwise, click the Continue button below to complete your registration.{/ts} + {ts}Otherwise, click the Register button below to complete your registration.{/ts} {/if}
{if $is_pay_later and !$isAmountzero} @@ -166,7 +166,7 @@ {if $contributeMode NEQ 'notify'} {* In 'notify mode, contributor is taken to processor payment forms next *}

- {ts}Your registration will not be submitted until you click the Continue button. Please click the button one time only. If you need to change any details, click the Go Back button below to return to the previous screen.{/ts} + {ts}Your registration will not be submitted until you click the Register button. Please click the button one time only. If you need to change any details, click the Go Back button below to return to the previous screen.{/ts}

{/if} diff --git a/templates/CRM/Event/Form/Registration/Register.tpl b/templates/CRM/Event/Form/Registration/Register.tpl index 337110f20c..ffde1c06b0 100644 --- a/templates/CRM/Event/Form/Registration/Register.tpl +++ b/templates/CRM/Event/Form/Registration/Register.tpl @@ -170,6 +170,7 @@ {literal} CRM.$(function($) { + toggleAdditionalParticipants(); $('#additional_participants').change(function() { toggleAdditionalParticipants(); allowParticipant(); @@ -177,14 +178,18 @@ function toggleAdditionalParticipants() { var submit_button = $("#crm-submit-buttons > button").html(); - var review_translated = '{/literal}{ts escape="js"}Review{/ts}{literal}'; + {/literal}{if $event.is_monetary || $event.is_confirm_enabled}{literal} + var next_translated = '{/literal}{ts escape="js"}Review{/ts}{literal}'; + {/literal}{else}{literal} + var next_translated = '{/literal}{ts escape="js"}Register{/ts}{literal}'; + {/literal}{/if}{literal} var continue_translated = '{/literal}{ts escape="js"}Continue{/ts}{literal}'; if ($('#additional_participants').val()) { $("#additionalParticipantsDescription").show(); - $("#crm-submit-buttons > button").html(submit_button.replace(review_translated, continue_translated)); + $("#crm-submit-buttons > button").html(submit_button.replace(next_translated, continue_translated)); } else { $("#additionalParticipantsDescription").hide(); - $("#crm-submit-buttons > button").html(submit_button.replace(continue_translated, review_translated)); + $("#crm-submit-buttons > button").html(submit_button.replace(continue_translated, next_translated)); } } }); -- 2.25.1