mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix issue with multi-currency in asset accounts.
This commit is contained in:
@@ -432,9 +432,15 @@ class AccountController extends Controller
|
|||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$cache->addProperty($account->id);
|
$cache->addProperty($account->id);
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
$currencies = $this->accountRepository->getUsedCurrencies($account);
|
$currencies = $this->accountRepository->getUsedCurrencies($account);
|
||||||
|
|
||||||
|
// if the account is not expense or revenue, just use the account's default currency.
|
||||||
|
if (!in_array($account->accountType->type, [AccountType::REVENUE, AccountType::EXPENSE], true)) {
|
||||||
|
$currencies= [$this->accountRepository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency()];
|
||||||
|
}
|
||||||
|
|
||||||
/** @var TransactionCurrency $currency */
|
/** @var TransactionCurrency $currency */
|
||||||
foreach ($currencies as $currency) {
|
foreach ($currencies as $currency) {
|
||||||
$chartData[] = $this->periodByCurrency($start, $end, $account, $currency);
|
$chartData[] = $this->periodByCurrency($start, $end, $account, $currency);
|
||||||
|
|||||||
Reference in New Issue
Block a user