diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index d6135d6b45449d186d1f497a55cea2f894bed8c9..11fd190048d6a1332720520af734e06a197f49d6 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() { @@ -1363,11 +1354,21 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $form->assign('snippet', $form->_snippet); $paymentProcessors = $form->get('paymentProcessors'); - $form->assign('ppType', FALSE); $form->_ppType = NULL; - if (!empty($paymentProcessors)) { + if ($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); + } + // When user presses the back button + elseif (!empty($form->_submitValues)) { + $form->_ppType = CRM_Utils_Array::value('payment_processor', $form->_submitValues); + } // 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 @@ -1379,7 +1380,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } if ($form->_ppType) { - $form->assign('ppType', TRUE); CRM_Core_Payment_ProcessorForm::preProcess($form); } @@ -1392,6 +1392,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } } + $form->assign('ppType', $form->_ppType); } } diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 2bdd91f75fc4f7b3f8e7129e3ce4aafb0c4f128e..5a4f0336b92d9da53d240128ce80868582c4b084 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); - } - } /** @@ -189,7 +179,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { // now fix all state country selectors CRM_Core_BAO_Address::fixAllStateSelects($this, $this->_defaults); - if ($this->_ppType) { + if ($this->_snippet) { return $this->_defaults; } @@ -351,11 +341,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $contactID = parent::getContactID(); $this->assign('contact_id', $contactID); - $display_name = ''; - if ($contactID) { - $display_name = CRM_Contact_BAO_Contact::displayName($contactID); - } - $this->assign('display_name', $display_name); + $this->assign('display_name', CRM_Contact_BAO_Contact::displayName($contactID)); $config = CRM_Core_Config::singleton(); $this->add('hidden', 'scriptFee', NULL); @@ -1384,7 +1370,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { * @return void * @access public */ - function checkRegistration($fields, &$self, $isAdditional = FALSE, $returnContactId = FALSE, $useDedupeRules = FALSE) { + static function checkRegistration($fields, &$self, $isAdditional = FALSE, $returnContactId = FALSE, $useDedupeRules = FALSE) { // CRM-3907, skip check for preview registrations // CRM-4320 participant need to walk wizard if (!$returnContactId && @@ -1399,10 +1385,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $contactID = parent::getContactID(); } - if (!$contactID && - is_array($fields) && - !empty($fields) - ) { + if (!$contactID && is_array($fields) && $fields) { //CRM-6996 //as we are allowing w/ same email address, diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index 502dcfca8cba90ec757b48c67d45d0ff02d33a37..c1cf62401ad21498bc514ed349dcc1b9b37acca5 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -335,18 +335,6 @@ {/if} </div> -{* Hide Credit Card Block and Billing information if contribution is pay later. *} - {if $form.is_pay_later and $hidePaymentInformation} - {include file="CRM/common/showHideByFieldValue.tpl" - trigger_field_id ="is_pay_later" - trigger_value ="" - target_element_id ="billing-payment-block" - target_element_type ="table-row" - field_type ="radio" - invert = 1 - } - {/if} - <script type="text/javascript"> {if $pcp} pcpAnonymous();