From b107e882f88fb3c35a34cdb1e10038808d688a93 Mon Sep 17 00:00:00 2001 From: litspeedmarc Date: Fri, 29 Jul 2016 09:20:46 -0400 Subject: [PATCH] CRM-19126: civicrm_line_item.tax_amount incorrectly set when using online payment processor --- CRM/Contribute/BAO/Contribution.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 9d161c90b2..c457a1dff8 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4109,6 +4109,18 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) // Update contribution. if (!empty($params['id'])) { + // CRM-19126, civicrm_line_item.tax_amount incorrectly set when using online payment processor. + // It looks like this method is meant to be called in multiple contexts: new & update + // When creating, would expect total_amount to be set? Prior to 4.7, when creating online membership + // via contribution page, call scenario was different. + // This would not never get called, end result, taxes were correct. + // Since 4.7 it does. Not sure this fix is ideal, but it does do the trick. + // Conceptually, if we're "updating", and total_amount is unknown. We're dealing with an incomplete + // view, why are we nulling out all line item taxes, or messing with any other tax amounts? + if (!isset($params['total_amount'])) { + return $params; + } + $id = $params['id']; $values = $ids = array(); $contrbutionParams = array('id' => $id); -- 2.25.1