Skip to content

Commit

Permalink
PROD-147: Resolve Issue with Payment Allocation to Contribution Line …
Browse files Browse the repository at this point in the history
…Item

Included In: civicrm#29350
  • Loading branch information
olayiwola-compucorp committed Mar 8, 2024
1 parent b501c1b commit 1ccdb46
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CRM/Financial/BAO/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,16 @@ protected static function getAmountOfLineItemPaid($lineItemID) {
$paid += $entityFinancialTrxn['amount'];
}
}

$lineItem = \Civi\Api4\LineItem::get(FALSE)
->addWhere('id', '=', $lineItemID)
->execute()
->first();
if (!empty($lineItem['tax_amount']) && $paid > 0) {
$total = floatval($lineItem['line_total']);
$tax = floatval($lineItem['tax_amount']);
$paid = ($total * $paid) / ($tax + $total);
}
return (float) $paid;
}

Expand Down

0 comments on commit 1ccdb46

Please sign in to comment.