From 805eecf882455fbb37ab7c1005a0affc5d519a32 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Wed, 12 Aug 2015 00:52:33 +0530 Subject: [PATCH] QA changes --- CRM/Member/Form/MembershipRenewal.php | 17 +++++------------ templates/CRM/Member/Form/MembershipRenewal.tpl | 10 ++++------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 5a05c38bb8..286fc13c7f 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -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'])) { diff --git a/templates/CRM/Member/Form/MembershipRenewal.tpl b/templates/CRM/Member/Form/MembershipRenewal.tpl index 487cf027f5..2fb2e428ca 100644 --- a/templates/CRM/Member/Form/MembershipRenewal.tpl +++ b/templates/CRM/Member/Form/MembershipRenewal.tpl @@ -165,9 +165,7 @@ {$form.total_amount.html}
{ts}Membership payment amount. A contribution record will be created for this amount.{/ts} - {if $taxAmount} -
{ts 1=$taxTerm 2=$taxAmount}Includes %1 amount of $%2.{/ts}
- {/if} +
@@ -200,9 +198,7 @@ {$form.total_amount.html}
{ts}Membership payment amount. A contribution record will be created for this amount.{/ts} - {if $taxAmount} -
{ts 1=$taxTerm 2=$taxAmount}Includes %1 amount of %2.{/ts}
- {/if} +
{/if} @@ -401,6 +397,8 @@ else { cj("#total_amount").val(allMemberships[memType]['total_amount']); } + + cj('.totaltaxAmount').html(allMemberships[memType]['tax_message']); } // show/hide different contact section -- 2.25.1