From 8538741341d6b3d9b83c422eef882c9449826578 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 26 Jul 2024 03:57:35 +0200 Subject: [PATCH] Fix https://github.com/orgs/firefly-iii/discussions/9080 --- app/Repositories/Account/AccountRepository.php | 5 +++++ app/Repositories/UserGroups/Account/AccountRepository.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 726acdb761..5b941ad1e9 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -554,6 +554,11 @@ class AccountRepository implements AccountRepositoryInterface ++$index; } } + // reset the rest to zero. + $all = [AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE]; + $this->user->accounts()->leftJoin('account_types','account_types.id','=','accounts.account_type_id') + ->whereNotIn('account_types.type', $all) + ->update(['order' => 0]); } public function searchAccount(string $query, array $types, int $limit): Collection diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php index f6790945dd..cbbac08ff2 100644 --- a/app/Repositories/UserGroups/Account/AccountRepository.php +++ b/app/Repositories/UserGroups/Account/AccountRepository.php @@ -241,6 +241,11 @@ class AccountRepository implements AccountRepositoryInterface ++$index; } } + // reset the rest to zero. + $all = [AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE]; + $this->user->accounts()->leftJoin('account_types','account_types.id','=','accounts.account_type_id') + ->whereNotIn('account_types.type', $all) + ->update(['order' => 0]); } public function getAccountsByType(array $types, ?array $sort = [], ?array $filters = []): Collection