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: // 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;
} }