Skip to content

Commit

Permalink
CRM-20037: Change contributions tab to show balance due
Browse files Browse the repository at this point in the history
  • Loading branch information
monishdeb committed Apr 24, 2017
1 parent db05550 commit 663b3b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 10 additions & 5 deletions CRM/Contribute/Selector/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,13 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
}
}

$row['balance_due'] = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType(
$result->contribution_id,
'contribution',
FALSE,
$result->total_amount
);

//carry campaign on selectors.
// @todo - I can't find any evidence that 'carrying' the campaign on selectors actually
// results in it being displayed anywhere so why do we do this???
Expand Down Expand Up @@ -511,6 +518,9 @@ public function &getColumnHeaders($action = NULL, $output = NULL) {
'sort' => 'total_amount',
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
'name' => ts('Balance Due'),
),
);
if ($this->_includeSoftCredits) {
self::$_columnHeaders
Expand Down Expand Up @@ -554,11 +564,6 @@ public function &getColumnHeaders($action = NULL, $output = NULL) {
'sort' => 'contribution_status',
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
'name' => ts('Premium'),
'sort' => 'product_name',
'direction' => CRM_Utils_Sort::DONTCARE,
),
)
);
if (!$this->_single) {
Expand Down
4 changes: 3 additions & 1 deletion templates/CRM/Contribute/Form/Selector.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
{if $row.amount_level }<br/>({$row.amount_level}){/if}
{if $row.contribution_recur_id}<br/>{ts}(Recurring){/ts}{/if}
</td>
<td class="crm-contribution-balance_due bold">
{$row.balance_due|crmMoney:$row.currency}
</td>
{if $softCreditColumns}
<td class="right bold crm-contribution-soft_credit_amount">
<span class="nowrap">{$row.contribution_soft_credit_amount|crmMoney:$row.currency}</span>
Expand All @@ -90,7 +93,6 @@
{$row.cancel_date|crmDate}
{/if}
</td>
<td class="crm-contribution-product_name">{$row.product_name}</td>
{if $softCreditColumns}
<td class="crm-contribution-soft_credit_name">
<a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contribution_soft_credit_contact_id`"}">{$row.contribution_soft_credit_name}</a>
Expand Down

0 comments on commit 663b3b2

Please sign in to comment.