CRM-15509 towards refactoring control of payment fields to the payment
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 27 Oct 2014 19:24:36 +0000 (08:24 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 27 Oct 2014 19:24:36 +0000 (08:24 +1300)
processors
This doesn't do much in itself but moves a small piece of the logic out
of the tpl where it can be more easily overrided. However, this is not
expected to be the final resting place of this assignment

CRM/Core/Payment/Form.php
templates/CRM/Core/BillingBlock.tpl

index b611d8bc4fe2ca62cfb48209a6bce72e3231e75b..af794418857ee8f414bca74cee6c059bccfc4a72 100644 (file)
@@ -185,6 +185,11 @@ class CRM_Core_Payment_Form {
       'attributes' => $creditCardType,
       'is_required' => FALSE,
     );
+    //CRM-15509 this is probably a temporary resting place for these form assignments but we are working towards putting this
+    // in an option group & having php / payment processors define the billing form rather than the tpl
+    $smarty = CRM_Core_Smarty::singleton();
+    $smarty->assign('paymentTypeName', 'credit_card');
+    $smarty->assign('paymentTypeLabel', ts('Credit Card Information'));
   }
 
   /**
@@ -256,6 +261,12 @@ class CRM_Core_Payment_Form {
       'attributes' => array('size' => 20, 'maxlength' => 64, 'autocomplete' => 'off'),
       'is_required' => TRUE,
     );
+    //CRM-15509 this is probably a temporary resting place for these form assignments but we are working towards putting this
+    // in an option group & having php / payment processors define the billing form rather than the tpl
+    $smarty = CRM_Core_Smarty::singleton();
+    // replace these payment type names with an option group - moving name & label assumptions out of the tpl is a step towards that
+    $smarty->assign('paymentTypeName', 'direct_debit');
+    $smarty->assign('paymentTypeLabel', ts('Direct Debit Information'));
   }
 
   /**
index 794f329a8436b277356653b55bf274bf06ab4920..eb40dd9ff354b2c023436eebb94a4ecf76f0bc0f 100644 (file)
 
 {if $form.credit_card_number or $form.bank_account_number}
   <div id="payment_information">
-    <fieldset class="billing_mode-group {if $paymentProcessor.payment_type & 2}direct_debit_info-group{else}credit_card_info-group{/if}">
+    <fieldset class="billing_mode-group {$paymentTypeName}_info-group">
       <legend>
-        {if $paymentProcessor.payment_type & 2}
-          {ts}Direct Debit Information{/ts}
-        {else}
-          {ts}Credit Card Information{/ts}
-        {/if}
+        {$paymentTypeLabel}
       </legend>
       {if $paymentProcessor.billing_mode & 2 and !$hidePayPalExpress }
         <div class="crm-section no-label paypal_button_info-section">