mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Catch empty currency preference
This commit is contained in:
parent
0b47e5d05d
commit
f72f8b03df
@ -92,13 +92,17 @@ class AmountFormat extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'formatAmountByAccount', function (AccountModel $account, string $amount, bool $coloured = true): string {
|
||||
$currencyId = intval($account->getMeta('currency_id'));
|
||||
if ($currencyId === 0) {
|
||||
// Format using default currency:
|
||||
return app('amount')->format($amount, $coloured);
|
||||
|
||||
if ($currencyId !== 0) {
|
||||
$currency = TransactionCurrency::find($currencyId);
|
||||
|
||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||
}
|
||||
$currency = TransactionCurrency::find($currencyId);
|
||||
$currency = app('amount')->getDefaultCurrency();
|
||||
|
||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||
|
||||
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user