Fix amount display
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Wed, 24 Aug 2016 12:40:11 +0000 (18:10 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Wed, 24 Aug 2016 12:40:11 +0000 (18:10 +0530)
CRM/Contribute/BAO/ContributionSoft.php
tests/phpunit/CRM/Contribute/Page/AjaxTest.php

index 645934d3c09095df42ae75d5d33d9d1918d37b81..756c22a37c03129f18e6922b98c33faf583d4c33 100644 (file)
@@ -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;
index 601c6a248497481225fd4e1dee6b65de2a11b5db..2c13754254a9c0169c515a660964b07515a6d443 100644 (file)
@@ -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']);
   }