mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 04:34:00 +00:00
Simpler get currency routine
This commit is contained in:
@@ -132,16 +132,9 @@ class JavascriptController extends Controller
|
|||||||
public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository): Response
|
public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository): Response
|
||||||
{
|
{
|
||||||
$account = $repository->findNull((int) $request->get('account'));
|
$account = $repository->findNull((int) $request->get('account'));
|
||||||
$currencyId = 0;
|
$currency = app('amount')->getDefaultCurrency();
|
||||||
if (null !== $account) {
|
if(null !== $account) {
|
||||||
// TODO we can use getAccountCurrency() instead
|
$currency = $repository->getAccountCurrency($account) ?? $currency;
|
||||||
$currencyId = (int) $repository->getMetaValue($account, 'currency_id');
|
|
||||||
}
|
|
||||||
/** @var TransactionCurrency $currency */
|
|
||||||
$currency = $currencyRepository->findNull($currencyId);
|
|
||||||
if (null === $currency) {
|
|
||||||
/** @var TransactionCurrency $currency */
|
|
||||||
$currency = app('amount')->getDefaultCurrency();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$localeconv = app('amount')->getLocaleInfo();
|
$localeconv = app('amount')->getLocaleInfo();
|
||||||
|
Reference in New Issue
Block a user