From: Eileen McNaughton Date: Fri, 22 Sep 2023 22:27:22 +0000 (+1200) Subject: Replace last tpl uses of contributeMode X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=695b18b9e50de7e5629df680654ea3795c57758d;p=civicrm-core.git Replace last tpl uses of contributeMode This adds the strings to what the processor can determin, allowing us to stop checkign contributeMode --- diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 370f41ad56..25e0a275e2 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -321,7 +321,6 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract if ($this->_mode) { // process credit card - $this->assign('contributeMode', 'direct'); $this->processCreditCard(); } diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 9e0f2a33a8..c7fc98f3fe 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -609,6 +609,22 @@ abstract class CRM_Core_Payment { } return ts('Make Contribution'); + case 'eventContinueText': + // This use of the ts function uses the legacy interpolation of the button name to avoid translations having to be re-done. + if ((int) $this->_paymentProcessor['billing_mode'] === self::BILLING_MODE_NOTIFY) { + return ts('Click %1 to checkout with %2.', [1 => ts('Register'), 2 => $this->_paymentProcessor['frontend_title']]); + } + return ts('Click %1 to complete your registration.', [1 => ts('Register')]); + + case 'eventConfirmText': + if ((int) $this->_paymentProcessor['billing_mode'] === self::BILLING_MODE_NOTIFY) { + return ts('Your registration payment has been submitted to %1 for processing', [1 => $this->_paymentProcessor['frontend_title']]); + } + return ''; + + case 'eventConfirmEmailText': + return ts('A registration confirmation email will be sent to %1 once the transaction is processed successfully.', [1 => $params['email']]); + case 'cancelRecurDetailText': if ($params['mode'] === 'auto_renew') { return ts('Click the button below if you want to cancel the auto-renewal option for your %1 membership. This will not cancel your membership. However you will need to arrange payment for renewal when your membership expires.', diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index c10351632b..726eb3b961 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -382,10 +382,8 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { } // The concept of contributeMode is deprecated. $this->_contributeMode = $this->get('contributeMode'); - $this->assign('contributeMode', $this->_contributeMode); - - $this->assign('paidEvent', $this->_values['event']['is_monetary']); + $this->assign('paidEvent', $this->getEventValue('is_monetary')); // we do not want to display recently viewed items on Registration pages $this->assign('displayRecent', FALSE); diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 04be4e89af..4c39c2869c 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -272,6 +272,8 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $this->assign('amounts', $this->_amount); $this->assign('totalAmount', $this->_totalAmount); $this->set('totalAmount', $this->_totalAmount); + // This use of the ts function uses the legacy interpolation of the button name to avoid translations having to be re-done. + $this->assign('verifyText', !$this->_totalAmount ? ts('Click %1 to complete your registration.', [1 => ts('Register')]) : $this->getPaymentProcessorObject()->getText('eventContinueText', [])); $showPaymentOnConfirm = (in_array($this->_eventId, \Civi::settings()->get('event_show_payment_on_confirm')) || in_array('all', \Civi::settings()->get('event_show_payment_on_confirm'))); $this->assign('showPaymentOnConfirm', $showPaymentOnConfirm); diff --git a/CRM/Event/Form/Registration/ThankYou.php b/CRM/Event/Form/Registration/ThankYou.php index 948294772a..474e3d5f8d 100644 --- a/CRM/Event/Form/Registration/ThankYou.php +++ b/CRM/Event/Form/Registration/ThankYou.php @@ -72,13 +72,17 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { public function buildQuickForm() { // Assign the email address from a contact id lookup as in CRM_Event_BAO_Event->sendMail() $primaryContactId = $this->get('primaryContactId'); + $email = NULL; if ($primaryContactId) { $email = CRM_Utils_Array::valueByRegexKey('/^email-/', current($this->_params)); if (!$email) { $email = CRM_Contact_BAO_Contact::getPrimaryEmail($primaryContactId); } - $this->assign('email', $email); } + $this->assign('email', $email ?? NULL); + $this->assign('eventConfirmText', $this->getEventValue('is_monetary') ? $this->getPaymentProcessorObject()->getText('eventConfirmText', []) : ''); + $this->assign('eventConfirmEmailText', ($email && $this->getEventValue('is_monetary')) ? $this->getPaymentProcessorObject()->getText('eventConfirmEmailText', ['email' => $email]) : ''); + $this->assignToTemplate(); $invoicing = CRM_Invoicing_Utils::isInvoicingEnabled(); diff --git a/templates/CRM/Event/Form/Registration/Confirm.tpl b/templates/CRM/Event/Form/Registration/Confirm.tpl index 98dddde24b..006f9e2c9f 100644 --- a/templates/CRM/Event/Form/Registration/Confirm.tpl +++ b/templates/CRM/Event/Form/Registration/Confirm.tpl @@ -22,11 +22,7 @@ {ts 1=$register}Click %1 to submit your registration for approval.{/ts} {else} {ts}Please verify your information.{/ts} - {if $contributeMode EQ 'notify' and !$is_pay_later and !$isAmountzero} - {ts 1=$register 2=$paymentProcessor.frontend_title}Click %1 to checkout with %2.{/ts} - {else} - {ts 1=$register}Click %1 to complete your registration.{/ts} - {/if} + {$verifyText} {/if}

{if $is_pay_later and !$isAmountzero and !$isOnWaitlist and !$isRequireApproval} diff --git a/templates/CRM/Event/Form/Registration/ThankYou.tpl b/templates/CRM/Event/Form/Registration/ThankYou.tpl index 14fe56cfa5..a902988819 100644 --- a/templates/CRM/Event/Form/Registration/ThankYou.tpl +++ b/templates/CRM/Event/Form/Registration/ThankYou.tpl @@ -51,11 +51,11 @@ {if $is_email_confirm}

{ts 1=$email}An email with event details has been sent to %1.{/ts}

{/if} - {* PayPal_Standard sets contribution_mode to 'notify'. We don't know if transaction is successful until we receive the IPN (payment notification) *} - {elseif $contributeMode EQ 'notify' and $paidEvent} -

{ts 1=$paymentProcessor.name}Your registration payment has been submitted to %1 for processing.{/ts}

+ {* This text is determined by the payment processor *} + {elseif $eventConfirmText} +

{$eventConfirmText}

{if $is_email_confirm} -

{ts 1=$email}A registration confirmation email will be sent to %1 once the transaction is processed successfully.{/ts}

+

{$eventEmailConfirmText}

{/if} {else}

{ts}Your registration has been processed successfully.{/ts}