mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
Fix #9789
This commit is contained in:
@@ -26,6 +26,8 @@ namespace FireflyIII\Support\Twig;
|
|||||||
use FireflyIII\Models\Account as AccountModel;
|
use FireflyIII\Models\Account as AccountModel;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
|
use FireflyIII\Support\Facades\Amount;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Twig\Extension\AbstractExtension;
|
use Twig\Extension\AbstractExtension;
|
||||||
use Twig\TwigFilter;
|
use Twig\TwigFilter;
|
||||||
use Twig\TwigFunction;
|
use Twig\TwigFunction;
|
||||||
@@ -114,6 +116,11 @@ class AmountFormat extends AbstractExtension
|
|||||||
|
|
||||||
/** @var TransactionCurrency $currency */
|
/** @var TransactionCurrency $currency */
|
||||||
$currency = TransactionCurrency::whereCode($code)->first();
|
$currency = TransactionCurrency::whereCode($code)->first();
|
||||||
|
if(null === $currency) {
|
||||||
|
Log::error(sprintf('Could not find currency with code "%s". Fallback to native currency.', $code));
|
||||||
|
$currency = Amount::getNativeCurrency();
|
||||||
|
Log::error(sprintf('Fallback currency is "%s".', $currency->code));
|
||||||
|
}
|
||||||
|
|
||||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user