James Cole
2026-03-06 11:41:18 +01:00
parent 6f4143bb79
commit f6ea517b5d
4 changed files with 28 additions and 6 deletions

View File

@@ -14,10 +14,6 @@ parameters:
enabled: false
noNullableReturnTypeDeclaration:
enabled: false
privateInFinalClass:
enabled: false
noIsset:
enabled: false
finalInAbstractClass:
enabled: false
noConstructorParameterWithDefaultValue:

View File

@@ -687,6 +687,31 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
return $dbQuery->take($limit)->get(['accounts.*']);
}
public function searchAccountIncludingInactive(string $query, array $types, int $limit): Collection
{
$dbQuery = $this->user
->accounts()
->orderBy('accounts.order', 'ASC')
->orderBy('accounts.account_type_id', 'ASC')
->orderBy('accounts.name', 'ASC')
->with(['accountType'])
;
if ('' !== $query) {
// split query on spaces just in case:
$parts = explode(' ', $query);
foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part);
$dbQuery->whereLike('name', $search);
}
}
if (0 !== count($types)) {
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$dbQuery->whereIn('account_types.type', $types);
}
return $dbQuery->take($limit)->get(['accounts.*']);
}
public function searchAccountNr(string $query, array $types, int $limit): Collection
{
$dbQuery = $this->user

View File

@@ -155,6 +155,7 @@ interface AccountRepositoryInterface
public function resetAccountOrder(): void;
public function searchAccount(string $query, array $types, int $limit): Collection;
public function searchAccountIncludingInactive(string $query, array $types, int $limit): Collection;
public function searchAccountNr(string $query, array $types, int $limit): Collection;

View File

@@ -487,7 +487,7 @@ class OperatorQuerySearch implements SearchInterface
// search direction: for destination accounts
if (SearchDirection::DESTINATION === $searchDirection) { // destination
// destination can be
// the destination account can be
$searchTypes = [
AccountTypeEnum::ASSET->value,
AccountTypeEnum::MORTGAGE->value,
@@ -530,7 +530,7 @@ class OperatorQuerySearch implements SearchInterface
}
// get accounts:
$accounts = $this->accountRepository->searchAccount($value, $searchTypes, 1337);
$accounts = $this->accountRepository->searchAccountIncludingInactive($value, $searchTypes, 1337);
if (0 === $accounts->count() && false === $prohibited) {
Log::warning('Found zero accounts, search for non existing account, NO results will be returned.');
$this->collector->findNothing();