From a953a075c5d287c5073d8ecbc9dda951ebe3d191 Mon Sep 17 00:00:00 2001 From: Muhammad Shahrukh <> Date: Wed, 23 Oct 2024 12:50:22 +0500 Subject: [PATCH] CSTMM-44: This pr fixes the credit note allocation to taxable line items This issue was introduced with https://github.com/civicrm/civicrm-core/pull/29823 This pr does not have any reference to core pr as the code has changed completely since then and this fix is not needed in latest civicrm version --- CRM/Financial/BAO/Payment.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CRM/Financial/BAO/Payment.php b/CRM/Financial/BAO/Payment.php index 269cbc8b40f2..f1ca8077090a 100644 --- a/CRM/Financial/BAO/Payment.php +++ b/CRM/Financial/BAO/Payment.php @@ -574,11 +574,10 @@ protected static function getPayableLineItems($params, $contribution): array { else { $lineItems[$lineItemID]['allocation'] = round($lineItems[$lineItemID]['balance'] * $ratio, 2); } + } - if (!empty($lineItem['tax_amount'])) { - $lineItems[$lineItemID]['tax_allocation'] = round($lineItem['tax_amount'] * ($params['total_amount'] / $contribution['total_amount']), 2); - } - + if (!empty($lineItem['tax_amount'])) { + $lineItems[$lineItemID]['tax_allocation'] = round($lineItem['tax_amount'] * ($params['total_amount'] / $contribution['total_amount']), 2); } }