mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-21 03:39:00 +00:00
Expand some multi currency things.
This commit is contained in:
@@ -49,14 +49,13 @@ class JavascriptController extends Controller
|
||||
$accounts = $repository->getAccountsByType(
|
||||
[AccountType::DEFAULT, AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD]
|
||||
);
|
||||
$default = app('amount')->getDefaultCurrency();
|
||||
$data = ['accounts' => []];
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$accountId = $account->id;
|
||||
$currency = (int) $repository->getMetaValue($account, 'currency_id');
|
||||
$currency = 0 === $currency ? $default->id : $currency;
|
||||
$currency = 0 === $currency ? $this->defaultCurrency->id : $currency;
|
||||
$entry = ['preferredCurrency' => $currency, 'name' => $account->name];
|
||||
$data['accounts'][$accountId] = $entry;
|
||||
}
|
||||
@@ -96,9 +95,9 @@ class JavascriptController extends Controller
|
||||
public function variables(Request $request, AccountRepositoryInterface $repository): Response
|
||||
{
|
||||
$account = $repository->find((int) $request->get('account'));
|
||||
$currency = app('amount')->getDefaultCurrency();
|
||||
$currency = $this->defaultCurrency;
|
||||
if (null !== $account) {
|
||||
$currency = $repository->getAccountCurrency($account) ?? $currency;
|
||||
$currency = $repository->getAccountCurrency($account) ?? $this->defaultCurrency;
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$accounting = app('amount')->getJsConfig();
|
||||
|
Reference in New Issue
Block a user