Skip to content
Snippets Groups Projects
Unverified Commit 181e39d5 authored by DaveD's avatar DaveD Committed by GitHub
Browse files

Merge pull request #25448 from redcuillin/stringfix_formatLocaleNumeric

#4097 Fix empty string $amount error
parents 0a2a994d 6adfaa0e
Branches
Tags
No related merge requests found
......@@ -117,6 +117,10 @@ class CRM_Utils_Number {
* @throws \Brick\Money\Exception\UnknownCurrencyException
*/
public static function formatLocaleNumeric(string $amount, $locale = NULL): string {
if ($amount === "") {
return $amount;
}
$formatter = new \NumberFormatter($locale ?? CRM_Core_I18n::getLocale(), NumberFormatter::DECIMAL);
$formatter->setSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, CRM_Core_Config::singleton()->monetaryDecimalPoint);
$formatter->setSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, CRM_Core_Config::singleton()->monetaryThousandSeparator);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment