QA changes
authormonishdeb <monish.deb@webaccessglobal.com>
Tue, 11 Aug 2015 19:22:33 +0000 (00:52 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Tue, 11 Aug 2015 19:22:33 +0000 (00:52 +0530)
CRM/Member/Form/MembershipRenewal.php
templates/CRM/Member/Form/MembershipRenewal.tpl

index 5a05c38bb8352bd0407fc36db6ca5dd4eb9a8352..286fc13c7fc8bdc65a4e98f2a463827389e1fc6b 100644 (file)
@@ -263,17 +263,10 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
 
     //CRM-16950
     $taxRates = CRM_Core_PseudoConstant::getTaxRates();
-    $this->assign('taxRates', json_encode($taxRates));
-    $config = CRM_Core_Config::singleton();
-    $this->assign('currency', $config->defaultCurrencySymbol);
-    $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
-    $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
-    if (isset($invoicing)) {
-      $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
-      $this->assign('taxTerm', $taxTerm);
-    }
     $taxRate = CRM_Utils_Array::value($allMemberships[$defaults['membership_type_id']]['financial_type_id'], $taxRates);
 
+    $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
+
     // auto renew options if enabled for the membership
     $options = CRM_Core_SelectValues::memberAutoRenew();
 
@@ -300,12 +293,11 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
         }
 
         //CRM-16950
+        $taxAmount = NULL;
         $totalAmount = CRM_Utils_Array::value('minimum_fee', $values);
-        if ($taxRate) {
+        if (CRM_Utils_Array::value($values['financial_type_id'], $taxRates)) {
           $taxAmount = ($taxRate/100) * CRM_Utils_Array::value('minimum_fee', $values);
           $totalAmount = $totalAmount + $taxAmount;
-          $allMembershipInfo[$key]['tax_amount'] = $taxAmount;
-          $this->assign('taxAmount', $taxAmount);
         }
 
         // build membership info array, which is used to set the payment information block when
@@ -314,6 +306,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
           'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $values),
           'total_amount' => CRM_Utils_Money::format($totalAmount, NULL, '%a'),
           'total_amount_numeric' => $totalAmount,
+          'tax_message' => $taxAmount ? ts("Includes %1 amount of %2", array(1 => CRM_Utils_Array::value('tax_term', $invoiceSettings), 2 => CRM_Utils_Money::format($taxAmount))) : $taxAmount,
         );
 
         if (!empty($values['auto_renew'])) {
index 487cf027f5989662c221605239f0a401431b8b6d..2fb2e428ca8cbf7a5e715ea59e3f79df6e0f2df1 100644 (file)
                   <td>{$form.total_amount.html}<br/>
                     <span
                       class="description">{ts}Membership payment amount. A contribution record will be created for this amount.{/ts}</span>
-                    {if $taxAmount}
-                      <div class="totaltaxAmount">{ts 1=$taxTerm 2=$taxAmount}Includes %1 amount of $%2.{/ts}</div>
-                    {/if}
+                      <div class="totaltaxAmount"></div>
                   </td>
                 </tr>
                 <tr class="crm-membershiprenew-form-block-receive_date">
           <td>{$form.total_amount.html}<br/>
             <span
               class="description">{ts}Membership payment amount. A contribution record will be created for this amount.{/ts}</span>
-            {if $taxAmount}
-              <div class="totaltaxAmount">{ts 1=$taxTerm 2=$taxAmount}Includes %1 amount of %2.{/ts}</div>
-            {/if}
+              <div class="totaltaxAmount"></div>
           </td>
         </tr>
       {/if}
       else {
         cj("#total_amount").val(allMemberships[memType]['total_amount']);
       }
+
+      cj('.totaltaxAmount').html(allMemberships[memType]['tax_message']);
     }
 
     // show/hide different contact section