Commit f9d20747 authored by mattwire's avatar mattwire

Simply calls in Contribution.getbalance

parent 228fc1fa
......@@ -11,8 +11,8 @@
function civicrm_api3_contribution_getbalance($params) {
$result['id'] = $params['id'];
$result['total'] = (float) CRM_Price_BAO_LineItem::getLineTotal($params['id']);
$result['balance'] = CRM_Contribute_BAO_Contribution::getContributionBalance($params['id']);
$result['paid'] = $result['total'] - $result['balance'];
$result['paid'] = (float) CRM_Core_BAO_FinancialTrxn::getTotalPayments($params['id'], TRUE) ?: 0;
$result['balance'] = $result['total'] - $result['paid'];
$result['currency'] = civicrm_api3('Contribution', 'getvalue', [
'return' => 'currency',
'id' => $params['id'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment