Hello.
Function
I would be grateful if you tell me where the error is. Or will help to rewrite the function correctly.
Function
languageFormat
returns fixed decimal count by default. I have function, that formats this value and changes into custom view. To 0.123 fa-icon
. It worked fine till late XF 2.1.x versions. Than in last versions seems something changes and this function stopped work correctly.
Code:
public static function formatValue($billId, $value, $useFa = true)
{
$app = \XF::app();
$language = \XF::language();
$bills = $app['abills'];
$currencySymbol = self::getCurrencySymbol($bills[$billId], $useFa);
$number = number_format($value, 3, '.', '');
if (strpos($number, '.') !== false) {
$number = rtrim($number, '0');
}
[$whole, $decimal] = explode('.', $number);
return $language->currencyFormat($value, $currencySymbol, strlen($decimal));
}