From afc675df0345ecfc8b1c7ae4418961f131c69987 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 3 Apr 2013 16:17:58 -0700 Subject: [PATCH] Remember payment processor when user clicks the back button CRM-12149 --- CRM/Contribute/Form/Contribution/Main.php | 9 ++++++--- templates/CRM/Contribute/Form/Contribution/Main.tpl | 12 ------------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 6d876ec942..11fd190048 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -1354,9 +1354,8 @@ 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); @@ -1364,6 +1363,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $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 elseif (isset($_GET['type']) && $form->_snippet) { $form->_ppType = $_GET['type']; @@ -1377,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); } @@ -1390,6 +1392,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } } + $form->assign('ppType', $form->_ppType); } } diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index 502dcfca8c..c1cf62401a 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -335,18 +335,6 @@ {/if} -{* 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} -