Skip to content

Commit

Permalink
Remove multiple currency handling as it seems to make it format worse
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Feb 18, 2019
1 parent e5a1daf commit 1600345
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -6554,7 +6554,7 @@ protected function addBasicStatsToSummary(&$summary, $where, $from) {
$summary['total']['amount'][] = CRM_Utils_Money::format($dao->total_amount, $dao->currency);
$summary['total']['avg'][] = CRM_Utils_Money::format($dao->total_avg, $dao->currency);
}
$summary['total']['currencyCount'] = count($summary['total']['amount']);

if (!empty($summary['total']['amount'])) {
$summary['total']['amount'] = implode(', ', $summary['total']['amount']);
$summary['total']['avg'] = implode(', ', $summary['total']['avg']);
Expand Down
13 changes: 3 additions & 10 deletions templates/CRM/Contribute/Page/ContributionTotals.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,9 @@
{if $contributionSummary }
<tr>
{if $contributionSummary.total.amount}
{if $contributionSummary.total.currencyCount gt 1}
<th class="contriTotalLeft right">{ts}Total{/ts} &ndash; {$contributionSummary.total.amount}</th>
<th class="left contriTotalRight"> &nbsp; {ts}# Completed{/ts} &ndash; {$contributionSummary.total.count}</th>
</tr><tr>
<th class="contriTotalLeft">{ts}Avg{/ts} &ndash; {$contributionSummary.total.avg}</th>
{else}
<th class="contriTotalLeft right">{ts}Total{/ts} &ndash; {$contributionSummary.total.amount}</th>
<th class="right"> &nbsp; {ts}# Completed{/ts} &ndash; {$contributionSummary.total.count}</th>
<th class="right contriTotalRight"> &nbsp; {ts}Avg{/ts} &ndash; {$contributionSummary.total.avg}</th>
{/if}
<th class="contriTotalLeft right">{ts}Total{/ts} &ndash; {$contributionSummary.total.amount}</th>
<th class="right"> &nbsp; {ts}# Completed{/ts} &ndash; {$contributionSummary.total.count}</th>
<th class="right contriTotalRight"> &nbsp; {ts}Avg{/ts} &ndash; {$contributionSummary.total.avg}</th>
{/if}
{if $contributionSummary.cancel.amount}
<th class="disabled right contriTotalRight"> &nbsp; {ts}Cancelled/Refunded{/ts} &ndash; {$contributionSummary.cancel.amount}</th>
Expand Down
3 changes: 0 additions & 3 deletions tests/phpunit/CRM/Contact/BAO/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ public function testGetSummaryQueryWithFinancialACLDisabled() {
'avg' => '$ 233.33',
'amount' => '$ 1,400.00',
'count' => 6,
'currencyCount' => 1,
],
'cancel' => [
'count' => 2,
Expand Down Expand Up @@ -771,9 +770,7 @@ public function testGetSummaryQueryWithFinancialACLEnabled() {
'avg' => '$ 200.00',
'amount' => '$ 400.00',
'count' => 2,
'mode' => 'N/A',
'median' => '$ 200.00',
'currencyCount' => 1,
],
'cancel' => [
'count' => 1,
Expand Down

0 comments on commit 1600345

Please sign in to comment.