CRM-15409 - UI fixes for Sales Tax implementation.
authorDave Greenberg <dave@civicrm.org>
Fri, 19 Dec 2014 20:03:51 +0000 (12:03 -0800)
committerDave Greenberg <dave@civicrm.org>
Fri, 19 Dec 2014 20:03:51 +0000 (12:03 -0800)
----------------------------------------
* CRM-15409:
  https://issues.civicrm.org/jira/browse/CRM-15409

CRM/Contribute/Form/Contribution.php
templates/CRM/Contribute/Form/Contribution.tpl

index bff0b3979244688a0b2d978d55f5a9b7ac6c33da..a3df13a05d953cc75e09456bcec61c30fedfadf2 100644 (file)
@@ -924,8 +924,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     if ($this->_id && isset($this->_values['tax_amount'])) {
       $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id);
       if (CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails)) {
+        if ($totalAmount) {
+          $totalAmount->freeze();          
+        }
         $financialType->freeze();
-        $totalAmount->freeze();
         $this->assign('freezeFinancialType', TRUE);
       }
     }
index 490256c8600c21f59b54b969f7f4e6d15d731741..14726de44a4b25bb4f641055aafc08c45bb38084 100644 (file)
 
         {if $ppID}{ts}<a href='#' onclick='adjustPayment();'>adjust payment amount</a>{/ts}{help id="adjust-payment-amount"}{/if}
         <div id="totalAmountBlock">
-          <br /><span class="description">{ts}Total amount of this contribution.{/ts}{if $hasPriceSets} {ts}Alternatively, you can use a price set.{/ts}{/if}</span>
-          <br /><span id="totalTaxAmount" class="label"></span>
+          {if $hasPriceSets}<span class="description">{ts}Alternatively, you can use a price set.{/ts}</span>{/if}
+          <div id="totalTaxAmount" class="label"></div>
         </div>
       </td>
     </tr>
@@ -635,6 +635,9 @@ CRM.$(function($) {
         var taxRate = taxRates[financialType];
         if (!taxRate) {
           taxRate = 0;
+          cj("#totalTaxAmount").hide( );
+        } else {
+          cj("#totalTaxAmount").show( );          
         }
         var totalAmount = $('#total_amount').val();
         var thousandMarker = '{/literal}{$config->monetaryThousandSeparator}{literal}';
@@ -646,7 +649,7 @@ CRM.$(function($) {
         var taxAmount = (taxRate/100)*totalAmount;
         taxAmount = isNaN (taxAmount) ? 0:taxAmount;
         var totalTaxAmount = taxAmount + Number(totalAmount);
-  totalTaxAmount = formatMoney( totalTaxAmount, 2, seperator, thousandMarker );
+        totalTaxAmount = formatMoney( totalTaxAmount, 2, seperator, thousandMarker );
 
         $("#totalTaxAmount" ).html('Amount with tax : <span id="currencySymbolShow">' + currencySymbol + '</span> '+ totalTaxAmount);
       }