From 6adfaa0ed4266fd79f3d67b9eafe14f54defb023 Mon Sep 17 00:00:00 2001 From: redcuillin Date: Sat, 28 Jan 2023 04:11:26 +0000 Subject: [PATCH] Fix empty string $amount error --- CRM/Utils/Number.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CRM/Utils/Number.php b/CRM/Utils/Number.php index 790fdd1278..5262c35106 100644 --- a/CRM/Utils/Number.php +++ b/CRM/Utils/Number.php @@ -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); -- 2.25.1