$this->setFormAmountFields($this->_params['priceSetId']);
}
- $this->_params['tax_amount'] = $this->get('tax_amount');
+ if (!empty($this->get('tax_amount'))) {
+ CRM_Core_Error::deprecatedWarning('tax_amount should be not passed in');
+ $this->_params['tax_amount'] = $this->get('tax_amount');
+ }
$this->_useForMember = $this->get('useForMember');
CRM_Contribute_Form_AbstractEditPayment::formatCreditCardDetails($this->_params);
// Make a copy of line items array to use for display only
$tplLineItems = $this->_lineItem;
if (CRM_Invoicing_Utils::isInvoicingEnabled()) {
- // @todo $params seems like exactly the wrong place to get totalTaxAmount from
- // this is a calculated variable so we it should be transparent how we
- // calculated it rather than coming from 'params'
- $this->assign('totalTaxAmount', $params['tax_amount']);
+ $taxAmount = 0;
+ foreach ($tplLineItems ?? [] as $lineItems) {
+ foreach ($lineItems as $lineItem) {
+ $taxAmount += (float) ($lineItem['tax_amount'] ?? 0);
+ }
+ }
+
+ $this->assign('totalTaxAmount', $taxAmount);
+ $this->assign('taxTerm', CRM_Invoicing_Utils::getTaxTerm());
}
- $this->assignLineItemsToTemplate($tplLineItems);
$isDisplayLineItems = $this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config');
-
$this->assign('isDisplayLineItems', $isDisplayLineItems);
if (!$isDisplayLineItems) {
$this->assign('is_quick_config', 1);
$this->_params['is_quick_config'] = 1;
}
+ else {
+ $this->assignLineItemsToTemplate($tplLineItems);
+ }
if (!empty($params['selectProduct']) && $params['selectProduct'] !== 'no_thanks') {
$option = $params['options_' . $params['selectProduct']] ?? NULL;
$this->assign('priceSetID', $this->_priceSetId);
// The concept of contributeMode is deprecated.
- // the is_monetary concept probably should be too as it can be calculated from
- // the existence of 'amount' & seems fragile.
if ($this->_contributeMode === 'notify' ||
$this->_amount <= 0.0 || $this->_params['is_pay_later']
) {
// lets store it in the form variable so postProcess hook can get to this and use it
$form->_contributionID = $contribution->id;
}
+ // @fixme: This is assigned to the smarty template for the receipt. It's value should be calculated and not taken from $params.
$form->assign('totalTaxAmount', $params['tax_amount'] ?? NULL);
// process soft credit / pcp params first