From fe2368a053fdabaa9fedad8be4efda0f7a968034 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Thu, 24 Nov 2022 16:05:59 +0000 Subject: [PATCH] Refactor so functions that add payment to register form are next to each other --- CRM/Event/Form/Registration/Register.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 8b0b026349..b84e15ba1a 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -355,17 +355,6 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { // CRM-18399: used by template to pass pre profile id as a url arg $this->assign('custom_pre_id', $this->_values['custom_pre_id']); - // Required for currency formatting in the JS layer - - // Required for currency formatting in the JS layer - // this is a temporary fix intended to resolve a regression quickly - // And assigning moneyFormat for js layer formatting - // will only work until that is done. - // https://github.com/civicrm/civicrm-core/pull/19151 - $this->assign('moneyFormat', CRM_Utils_Money::format(1234.56)); - - CRM_Core_Payment_ProcessorForm::buildQuickForm($this); - $contactID = $this->getContactID(); $this->assign('contact_id', $contactID); if ($contactID) { @@ -432,7 +421,15 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $this->assign('isAdditionalParticipants', $isAdditionalParticipants); if ($this->_values['event']['is_monetary']) { + // Required for currency formatting in the JS layer + // this is a temporary fix intended to resolve a regression quickly + // And assigning moneyFormat for js layer formatting + // will only work until that is done. + // https://github.com/civicrm/civicrm-core/pull/19151 + $this->assign('moneyFormat', CRM_Utils_Money::format(1234.56)); self::buildAmount($this); + CRM_Core_Payment_ProcessorForm::buildQuickForm($this); + $this->addPaymentProcessorFieldsToForm(); } if ($contactID === 0 && !$this->_values['event']['is_multiple_registrations']) { @@ -440,12 +437,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $this->addCIDZeroOptions(); } - if ($this->_values['event']['is_monetary']) { - $this->addPaymentProcessorFieldsToForm(); - } - $this->addElement('hidden', 'bypass_payment', NULL, ['id' => 'bypass_payment']); - $this->assign('bypassPayment', $bypassPayment); if (!$contactID) { -- 2.25.1