From 4a23adbb2fd0ee959950b947cd7fe6554eba6068 Mon Sep 17 00:00:00 2001 From: objecttothis Date: Tue, 5 Dec 2023 14:03:07 +0400 Subject: [PATCH] Corrected Function call - setAttribute() expects the second parameter to be an int or float. setTextAttribute() resolves this. - Added TODO --- app/Controllers/Config.php | 2 +- app/Helpers/locale_helper.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Controllers/Config.php b/app/Controllers/Config.php index 48ac14910..f051d9890 100644 --- a/app/Controllers/Config.php +++ b/app/Controllers/Config.php @@ -467,7 +467,7 @@ class Config extends Secure_Controller if($this->request->getPost('thousands_separator') == 'false') { - $fmt->setAttribute(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, ''); + $fmt->setTextAttribute(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, ''); } $fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $currency_symbol); diff --git a/app/Helpers/locale_helper.php b/app/Helpers/locale_helper.php index 213c2b6d9..bba7c7279 100644 --- a/app/Helpers/locale_helper.php +++ b/app/Helpers/locale_helper.php @@ -424,7 +424,7 @@ function parse_decimals(string $number, int $decimals = null): mixed return $number; } - if ($number > MAX_PRECISION) + if ($number > MAX_PRECISION) //TODO: This breaks when the string passed does not use . as the decimal separator. { return false; } @@ -443,7 +443,7 @@ function parse_decimals(string $number, int $decimals = null): mixed $decimals = $config['currency_decimals']; } - $fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $decimals); + $fmt->setAttribute(NumberFormatter::FRACTION_DIGITS, $decimals); if(empty($config['thousands_separator'])) {