Skip to content

Firefly III: a personal finances manager

Catch empty currency preference

James Colef72f8b03dff7
diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php
index cc4c45dc19..ba7011f902 100644
--- a/app/Support/Twig/AmountFormat.php
+++ b/app/Support/Twig/AmountFormat.php
@@ -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']]
);
}