Fixes for displaying negative currencies

(cherry picked from commit 681fc47a68)
This commit is contained in:
David Bomba 2023-02-17 17:19:33 +11:00
parent 8eb3433912
commit 42bc2ed5b9

View file

@ -139,6 +139,8 @@ class Number
$value = floatval($value);
$_value = $value;
$currency = $entity->currency();
$thousand = $currency->thousand_separator;
@ -179,6 +181,15 @@ class Number
} elseif ($swapSymbol) {
return "{$value} ".trim($symbol);
} elseif ($entity->getSetting('show_currency_code') === false) {
/* Ensures we place the negative symbol ahead of the currency symbol*/
if($_value < 0){
$value = substr($value, 1);
$symbol = "-{$symbol}";
}
return "{$symbol}{$value}";
} else {
return self::formatValue($value, $currency);