From 78bafaf06ac349f75896af2ae3ca8ac812bbbb48 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 26 Feb 2021 18:05:14 +1300 Subject: [PATCH] dev/financial#166 Fix for inconsistency around currency symbol From https://lab.civicrm.org/dev/financial/-/issues/166 we learn that the existing code (tested via testFormatLocaleNumericRoundedByCurrency) is not consistent across all platforms. I think this may be --- CRM/Utils/Money.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CRM/Utils/Money.php b/CRM/Utils/Money.php index 02b0ed54cc..9fbb1ce5ad 100644 --- a/CRM/Utils/Money.php +++ b/CRM/Utils/Money.php @@ -215,8 +215,7 @@ class CRM_Utils_Money { // fix to allow us to resolve formatLocaleNumericRoundedByPrecision // and to make the function comments correct - but, we need to reconsider this // in master as it is probably better to use locale than our currency separator fields. - $formatter = new \NumberFormatter('en_US', NumberFormatter::CURRENCY); - $formatter->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, ''); + $formatter = new \NumberFormatter('en_US', NumberFormatter::DECIMAL); $formatter->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $numberOfPlaces); return $money->formatWith($formatter); } -- 2.25.1