From 9fdb48b88c27851eb400b8a1ce1bdfbf094e6121 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Mon, 14 Aug 2017 16:56:02 +0100 Subject: [PATCH] Revert "Remove trailing zeros in tax rate for online Confirm/Thankyou forms - safer change" This reverts commit ec59f9c064d02234fc65ded65cbc0568b4975eec. --- CRM/Contribute/Form/Contribution/Confirm.php | 3 +- CRM/Contribute/Form/Contribution/ThankYou.php | 31 +++++++++---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 9f587b44c5..9646ddcae8 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -524,11 +524,10 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $getTaxDetails = FALSE; $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); foreach ($this->_lineItem as $key => $value) { - foreach ($value as $k => $v) { + foreach ($value as $v) { if (isset($v['tax_rate'])) { if ($v['tax_rate'] != '') { $getTaxDetails = TRUE; - $this->_lineItem[$key][$k]['tax_rate'] = (float) $v['tax_rate']; // Cast to float to display without trailing zero decimals } } } diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index b87e9c145c..09b44253bb 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -99,6 +99,18 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont if ($productID) { CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, FALSE, $productID, $option); } + if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { + $this->assign('lineItem', $this->_lineItem); + } + else { + if (is_array($membershipTypeID)) { + $membershipTypeID = current($membershipTypeID); + } + $this->assign('is_quick_config', 1); + $this->_params['is_quick_config'] = 1; + } + $this->assign('priceSetID', $this->_priceSetId); + $this->assign('useForMember', $this->get('useForMember')); $params = $this->_params; $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); @@ -106,12 +118,11 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont if ($invoicing) { $getTaxDetails = FALSE; $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); - foreach ($this->_lineItem as $key => $value) { - foreach ($value as $k => $v) { + foreach ($this->_lineItem as $value) { + foreach ($value as $v) { if (isset($v['tax_rate'])) { if ($v['tax_rate'] != '') { $getTaxDetails = TRUE; - $this->_lineItem[$key][$k]['tax_rate'] = (float) $v['tax_rate']; // Cast to float to display without trailing zero decimals } } } @@ -120,20 +131,6 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->assign('taxTerm', $taxTerm); $this->assign('totalTaxAmount', $params['tax_amount']); } - - if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { - $this->assign('lineItem', $this->_lineItem); - } - else { - if (is_array($membershipTypeID)) { - $membershipTypeID = current($membershipTypeID); - } - $this->assign('is_quick_config', 1); - $this->_params['is_quick_config'] = 1; - } - $this->assign('priceSetID', $this->_priceSetId); - $this->assign('useForMember', $this->get('useForMember')); - if (!empty($this->_values['honoree_profile_id']) && !empty($params['soft_credit_type_id'])) { $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); -- 2.25.1