From: Matthew Wire Date: Thu, 24 Nov 2022 16:05:59 +0000 (+0000) Subject: Refactor so functions that add payment to register form are next to each other X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fe2368a053fdabaa9fedad8be4efda0f7a968034;p=civicrm-core.git Refactor so functions that add payment to register form are next to each other --- 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) {