From 754bdbd41f566f572ef7de197c4b3898d3b44c1f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 3 Apr 2013 13:22:27 -0700 Subject: [PATCH] Fix required payment fields CRM-12149 --- CRM/Contribute/Form/Contribution/Main.php | 18 ++++++++---------- CRM/Event/Form/Registration/Register.php | 10 ---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index d6135d6b45..6d876ec942 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -170,15 +170,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } } - - if (CRM_Utils_Array::value('hidden_processor', $_POST)) { - $this->set('type', CRM_Utils_Array::value('payment_processor', $_POST)); - $this->set('mode', $this->_mode); - $this->set('paymentProcessor', $this->_paymentProcessor); - - CRM_Core_Payment_ProcessorForm::preProcess($this); - CRM_Core_Payment_ProcessorForm::buildQuickForm($this); - } } function setDefaultValues() { @@ -1366,8 +1357,15 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $form->assign('ppType', FALSE); $form->_ppType = NULL; if (!empty($paymentProcessors)) { + // Fetch type during form post + if (CRM_Utils_Array::value('hidden_processor', $_POST)) { + $form->_ppType = CRM_Utils_Array::value('payment_processor', $_POST); + $form->set('type', $form->_ppType); + $form->set('mode', $form->_mode); + $form->set('paymentProcessor', $form->_paymentProcessor); + } // Fetch type during ajax request - if (isset($_GET['type']) && $form->_snippet) { + elseif (isset($_GET['type']) && $form->_snippet) { $form->_ppType = $_GET['type']; } // Set default payment processor diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index d9da063a45..9d324ad636 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -115,16 +115,6 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { if ($this->_allowConfirmation) { CRM_Event_Form_EventFees::preProcess($this); } - - if (CRM_Utils_Array::value('hidden_processor', $_POST)) { - $this->set('type', CRM_Utils_Array::value('payment_processor', $_POST)); - $this->set('mode', $this->_mode); - $this->set('paymentProcessor', $this->_paymentProcessor); - - CRM_Core_Payment_ProcessorForm::preProcess($this); - CRM_Core_Payment_ProcessorForm::buildQuickForm($this); - } - } /** -- 2.25.1