Display sales tax amounts on event information page
authorPratiksha Dubey <pratiksha.dubey@webaccessglobal.com>
Thu, 24 Jul 2014 12:33:01 +0000 (18:03 +0530)
committerPratiksha Dubey <pratiksha.dubey@webaccessglobal.com>
Thu, 24 Jul 2014 12:33:01 +0000 (18:03 +0530)
CRM/Event/Page/EventInfo.php
templates/CRM/Event/Page/EventInfo.tpl

index 7a57c3aca31d82c14b4f54dd19a858bfd2dcabd7..d34e2ab18967d9032383667feeae0b5e304ab09d 100644 (file)
@@ -145,12 +145,14 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
               $labelClass = 'price_set_field-label';
             }
             // show tax rate with amount
-            $displayOpt = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
-            $displayOpt = CRM_Utils_Array::value('tax_display_settings', $displayOpt);
+            $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+            $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
+            $displayOpt = CRM_Utils_Array::value('tax_display_settings', $invoiceSettings);
+            $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
             foreach ($fieldValues['options'] as $optionId => $optionVal) {
               $values['feeBlock']['isDisplayAmount'][$fieldCnt] = CRM_Utils_Array::value('is_display_amounts', $fieldValues);
-              if (CRM_Utils_Array::value('tax_amount', $optionVal)) {
-                $values['feeBlock']['value'][$fieldCnt] = CRM_Price_BAO_PriceField::getTaxLabel($optionVal,'amount',$displayOpt);
+              if ($invoicing && isset($optionVal['tax_amount'])) {
+                $values['feeBlock']['value'][$fieldCnt] = CRM_Price_BAO_PriceField::getTaxLabel($optionVal, 'amount', $displayOpt, $taxTerm);
                 $values['feeBlock']['tax_amount'][$fieldCnt] = $optionVal['tax_amount'];
               }
               else {
index 91ed2208dc9ae184ec94c296dd90bec55d02d886..7b7684b54c271ca5bfb3a8490418340f89661e34 100644 (file)
                           <td class="{$lClass} crm-event-label">{$feeBlock.label.$idx}</td>
                           {if $isPriceSet & $feeBlock.isDisplayAmount.$idx}
                              <td class="fee_amount-value right">
-                              {if $feeBlock.tax_amount.$idx}
+                              {if isset($feeBlock.tax_amount.$idx)}
                                          {$feeBlock.value.$idx}
                               {else}
                                  {$feeBlock.value.$idx|crmMoney}