From e2d9abe9f1a84acbdf4ea83f0030948c0adcec96 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sun, 19 Nov 2023 13:57:17 +1300 Subject: [PATCH] Cleanup notices around line Item display on Contribution Confirm Page --- CRM/Contribute/Form/Contribution/Confirm.php | 21 +++++-------------- .../Contribute/Form/Contribution/Confirm.tpl | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 3b6df20e28..ad9cd3bc7a 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -464,6 +464,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr /** * Build the form object. + * + * @throws \CRM_Core_Exception */ public function buildQuickForm() { // FIXME: Some of this code is identical to Thankyou.php and should be broken out into a shared function @@ -484,21 +486,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } $this->assign('receiptFromEmail', $this->_values['receipt_from_email'] ?? NULL); $this->assign('amount_block_is_active', $this->isFormSupportsNonMembershipContributions()); - - // Make a copy of line items array to use for display only - $tplLineItems = $this->_lineItem; - if (CRM_Invoicing_Utils::isInvoicingEnabled()) { - $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->assign('taxTerm', \Civi::settings()->get('taxTerm')); + $this->assign('totalTaxAmount', $this->order->getTotalTaxAmount()); $isDisplayLineItems = $this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); $this->assign('isDisplayLineItems', $isDisplayLineItems); @@ -509,7 +498,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->_params['is_quick_config'] = 1; } else { - $this->assignLineItemsToTemplate($tplLineItems); + $this->assignLineItemsToTemplate([$this->getPriceSetID() => $this->order->getLineItems()]); } if (!empty($params['selectProduct']) && $params['selectProduct'] !== 'no_thanks') { diff --git a/templates/CRM/Contribute/Form/Contribution/Confirm.tpl b/templates/CRM/Contribute/Form/Contribution/Confirm.tpl index 751649284a..9d7847cf3c 100644 --- a/templates/CRM/Contribute/Form/Contribution/Confirm.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Confirm.tpl @@ -36,7 +36,7 @@ {if $isDisplayLineItems && $lineItem} {if !$amount}{assign var="amount" value=0}{/if} {assign var="totalAmount" value=$amount} - {include file="CRM/Price/Page/LineItem.tpl" context="Contribution"} + {include file="CRM/Price/Page/LineItem.tpl" context="Contribution" displayLineItemFinancialType=false pricesetFieldsCount=false currencySymbol='' hookDiscount=''} {elseif $is_separate_payment} {if $amount AND $minimum_fee} {$membership_name} {ts}Membership{/ts}: -- 2.25.1