From 9ef6f51969db407353b6f3ca59103e945e94fa16 Mon Sep 17 00:00:00 2001 From: Web Access Date: Thu, 16 Jul 2015 19:20:51 +0530 Subject: [PATCH] CRM-16833: Tax applied to Membership contributions twice with Tax Invoice --- CRM/Contribute/Form/Contribution.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index bbeab9c8d3..d7b6d75375 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1095,8 +1095,13 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { - $lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues)); - + //CRM-16833: Ensure tax is applied only once for membership conribution, when status changed.(e.g Pending to Completed). + $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); + if (!CRM_Utils_Array::value('membership', $componentDetails) || !CRM_Utils_Array::value('participant', $componentDetails)) { + if (!($this->_action & CRM_Core_Action::UPDATE && (($this->_defaults['contribution_status_id'] != $submittedValues['contribution_status_id'])))) { + $lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues)); + } + } // Update line total and total amount with tax on edit. $financialItemsId = CRM_Core_PseudoConstant::getTaxRates(); if (array_key_exists($submittedValues['financial_type_id'], $financialItemsId)) { -- 2.25.1