X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FForm%2FEventFees.php;h=6b9add1c4f5430514df5cb07863c5e2c2e92fd30;hb=24f8127938dec80960d388e50fd5b89aa450b494;hp=94873fad87601652cd44405dbb426a963dee04a1;hpb=7dee6a13d167a1dd2b4bf1075252bcb7e324c7e5;p=civicrm-core.git diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index 94873fad87..6b9add1c4f 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -42,6 +42,8 @@ class CRM_Event_Form_EventFees { /** * Function to set variables up before form is built * + * @param $form + * * @return void * @access public */ @@ -71,6 +73,8 @@ class CRM_Event_Form_EventFees { * * @access public * + * @param $form + * * @return void */ static function setDefaultValues(&$form) { @@ -124,7 +128,7 @@ class CRM_Event_Form_EventFees { if ($form->_action == CRM_Core_Action::ADD && !$form->_mode && $form->_isPaidEvent) { $defaults[$form->_pId]['record_contribution'] = 1; } - + //CRM-13420 if (empty($defaults['payment_instrument_id'])) { $defaults[$form->_pId]['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')); @@ -254,6 +258,10 @@ class CRM_Event_Form_EventFees { * * @access public * + * @param $participantID + * @param null $eventID + * @param bool $includeQtyZero + * * @return void */ static function setDefaultPriceSet($participantID, $eventID = NULL, $includeQtyZero = TRUE) { @@ -336,6 +344,8 @@ SELECT id, html_type /** * Function to build the form * + * @param $form + * * @return void * @access public */ @@ -370,8 +380,17 @@ 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']; + foreach ($form->_values['line_items'] as $key => $value) { + $totalTaxAmount = $value['tax_amount'] + $totalTaxAmount; + } + } + if ($invoicing) { + $form->assign('totalTaxAmount', $totalTaxAmount); } $form->assign('lineItem', empty($lineItem) ? FALSE : $lineItem); $discounts = array(); @@ -447,7 +466,7 @@ SELECT id, html_type CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'check_number') ); - $form->add('text', 'total_amount', ts('Total Amount'), + $form->add('text', 'total_amount', ts('Amount'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'total_amount') ); }