This commit is contained in:
James Cole
2019-12-20 05:53:13 +01:00
parent e96e96e6c9
commit 6ad2021739

View File

@@ -228,16 +228,20 @@ class AccountForm
// get all asset accounts:
$repository = $this->getAccountRepository();
$types = [AccountType::ASSET, AccountType::DEFAULT];
$types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT];
$assetAccounts = $repository->getAccountsByType($types);
$grouped = [];
// group accounts:
/** @var Account $account */
foreach ($assetAccounts as $account) {
$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';
}
$key = (string)trans(sprintf('firefly.opt_group_%s', $role));
$grouped[$key][$account->id] = $account->name;
}