From 55d2103128d12e0d860d3c0bddcd9a84cfeeaa30 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 28 Oct 2019 13:26:59 +1300 Subject: [PATCH] Use shared method to get Payment Processors on event page --- CRM/Event/Form/Registration.php | 4 ++-- CRM/Event/Form/Registration/Register.php | 18 +----------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 3b56f33344..b04f0813cb 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -308,6 +308,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->_values['event']['participant_role'] = $participant_role["{$this->_values['event']['default_role_id']}"]; } $isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later'); + $this->setPayLaterLabel($isPayLater ? $this->_values['event']['pay_later_text'] : ''); //check for various combinations for paylater, payment //process with paid event. if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) { @@ -315,7 +316,6 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->_values['event'] )); $this->assignPaymentProcessor($isPayLater); - } //init event fee. self::initEventFee($this, $this->_eventId); @@ -503,7 +503,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $params['is_pay_later'] = CRM_Utils_Array::value('is_pay_later', $params, FALSE); $this->assign('is_pay_later', $params['is_pay_later']); if ($params['is_pay_later']) { - $this->assign('pay_later_text', $this->_values['event']['pay_later_text']); + $this->assign('pay_later_text', $this->getPayLaterLabel()); $this->assign('pay_later_receipt', $this->_values['event']['pay_later_receipt']); } diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 3d3c748cc8..8b5010af7f 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -410,23 +410,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { self::buildAmount($this); } - $pps = []; - //@todo this could call the function on FrontEndPaymentTrait which also respects the payment processor - // title if configured. From my testing we don't need the 'if' around adding payment processor 0 - // (below) - if someone else tests & confirms we can remove it, use the FrontEndPaymentTrait - // like the contribution page does & use the getPaymentLabel (provided we also set it) - // and we will get the title, if configured. - if (!empty($this->_paymentProcessors)) { - foreach ($this->_paymentProcessors as $key => $name) { - $pps[$key] = $name['name']; - } - } - // see @todo above - if (!empty($this->_values['event']['is_pay_later']) && - ($this->_allowConfirmation || (!$this->_requireApproval && !$this->_allowWaitlist)) - ) { - $pps[0] = $this->_values['event']['pay_later_text']; - } + $pps = $this->getProcessors(); if ($this->getContactID() === 0 && !$this->_values['event']['is_multiple_registrations']) { //@todo we are blocking for multiple registrations because we haven't tested $this->addCIDZeroOptions(); -- 2.25.1