From: jitendrapurohit Date: Wed, 24 Aug 2016 12:40:11 +0000 (+0530) Subject: Fix amount display X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ff8242a8c1544fd3c37207f30f2cf6b0606c8b34;p=civicrm-core.git Fix amount display --- diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index 645934d3c0..756c22a37c 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -502,7 +502,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio $dTParams['total'] = CRM_Core_DAO::singleValueQuery('SELECT FOUND_ROWS()'); $result = array(); while ($cs->fetch()) { - $result[$cs->id]['amount'] = $cs->amount; + $result[$cs->id]['amount'] = CRM_Utils_Money::format($cs->amount, $cs->currency); $result[$cs->id]['currency'] = $cs->currency; $result[$cs->id]['contributor_id'] = $cs->contributor_id; $result[$cs->id]['contribution_id'] = $cs->contribution_id; diff --git a/tests/phpunit/CRM/Contribute/Page/AjaxTest.php b/tests/phpunit/CRM/Contribute/Page/AjaxTest.php index 601c6a2484..2c13754254 100644 --- a/tests/phpunit/CRM/Contribute/Page/AjaxTest.php +++ b/tests/phpunit/CRM/Contribute/Page/AjaxTest.php @@ -110,6 +110,7 @@ class CRM_Contribute_Page_AjaxTest extends CiviUnitTestCase { $this->assertEquals(3, $amountSortedList['recordsTotal']); rsort($amounts); foreach ($amounts as $key => $amount) { + $amount = CRM_Utils_Money::format($amount, 'USD'); $this->assertEquals($amount, $amountSortedList['data'][$key]['amount']); } @@ -153,7 +154,7 @@ class CRM_Contribute_Page_AjaxTest extends CiviUnitTestCase { $softCreditList = CRM_Contribute_Page_AJAX::getSoftContributionRows(); $this->assertEquals(1, $softCreditList['recordsTotal']); $this->assertEquals('Gift', $softCreditList['data'][0]['sct_label']); - $this->assertEquals('100.00', $softCreditList['data'][0]['amount']); + $this->assertEquals('$ 100.00', $softCreditList['data'][0]['amount']); $this->assertEquals('Member Dues', $softCreditList['data'][0]['financial_type']); }