Skip to content

Firefly III: a personal finances manager

Fix #2901

James Cole6ad2021739da
diff --git a/app/Support/Form/AccountForm.php b/app/Support/Form/AccountForm.php
index 7c5555e7fa..6abf13f64d 100644
--- a/app/Support/Form/AccountForm.php
+++ b/app/Support/Form/AccountForm.php
@@ -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;
}