mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-01 02:21:45 +00:00
Fix #2901
This commit is contained in:
@@ -228,16 +228,20 @@ class AccountForm
|
|||||||
|
|
||||||
// get all asset accounts:
|
// get all asset accounts:
|
||||||
$repository = $this->getAccountRepository();
|
$repository = $this->getAccountRepository();
|
||||||
$types = [AccountType::ASSET, AccountType::DEFAULT];
|
$types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT];
|
||||||
$assetAccounts = $repository->getAccountsByType($types);
|
$assetAccounts = $repository->getAccountsByType($types);
|
||||||
$grouped = [];
|
$grouped = [];
|
||||||
// group accounts:
|
// group accounts:
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($assetAccounts as $account) {
|
foreach ($assetAccounts as $account) {
|
||||||
$role = $repository->getMetaValue($account, 'account_role');
|
$role = $repository->getMetaValue($account, 'account_role');
|
||||||
if (null === $role) {
|
if (null === $role && in_array($account->accountType->type, [AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT], true)) {
|
||||||
|
$role = sprintf('l_%s', $account->accountType->type);
|
||||||
|
}
|
||||||
|
if (null === $role && !in_array($account->accountType->type, [AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT], true)) {
|
||||||
$role = 'no_account_type';
|
$role = 'no_account_type';
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = (string)trans(sprintf('firefly.opt_group_%s', $role));
|
$key = (string)trans(sprintf('firefly.opt_group_%s', $role));
|
||||||
$grouped[$key][$account->id] = $account->name;
|
$grouped[$key][$account->id] = $account->name;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user