Merge remote branch 'canonical/master' into merge-forward
[civicrm-core.git] / CRM / Event / Form / EventFees.php
index f81f3dc2b959de44d63b7345eb87b9815ade03f1..6b9add1c4f5430514df5cb07863c5e2c2e92fd30 100644 (file)
@@ -380,6 +380,8 @@ SELECT  id, html_type
       CRM_Event_Form_Registration::initEventFee($form, $event['id']);
       CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->_discountId);
       $lineItem = array();
+      $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+      $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
       $totalTaxAmount = 0;
       if (!CRM_Utils_System::isNull(CRM_Utils_Array::value('line_items', $form->_values))) {
         $lineItem[] = $form->_values['line_items'];
@@ -387,7 +389,9 @@ SELECT  id, html_type
           $totalTaxAmount = $value['tax_amount'] + $totalTaxAmount;
         }
       }
-      $form->assign('totalTaxAmount', $totalTaxAmount);
+      if ($invoicing) {
+        $form->assign('totalTaxAmount', $totalTaxAmount);
+      }
       $form->assign('lineItem', empty($lineItem) ? FALSE : $lineItem);
       $discounts = array();
       if (!empty($form->_values['discount'])) {