Remember payment processor when user clicks the back button CRM-12149
authorColeman Watts <coleman@civicrm.org>
Wed, 3 Apr 2013 23:17:58 +0000 (16:17 -0700)
committerColeman Watts <coleman@civicrm.org>
Wed, 3 Apr 2013 23:17:58 +0000 (16:17 -0700)
CRM/Contribute/Form/Contribution/Main.php
templates/CRM/Contribute/Form/Contribution/Main.tpl

index 6d876ec942456370ab8719143ca8132c22ae3dea..11fd190048d6a1332720520af734e06a197f49d6 100644 (file)
@@ -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);
   }
 }
 
index 502dcfca8cba90ec757b48c67d45d0ff02d33a37..c1cf62401ad21498bc514ed349dcc1b9b37acca5 100644 (file)
   {/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();