From f73af50eb0f15419dbea38fdf6ce76021e71d9fc Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 23 Sep 2020 19:32:46 +0200 Subject: [PATCH] Fix #3840 --- app/Support/Search/OperatorQuerySearch.php | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 8629352fa2..3f919b8f22 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -606,7 +606,11 @@ class OperatorQuerySearch implements SearchInterface // get accounts: $accounts = $this->accountRepository->searchAccount($value, $searchTypes, 25); if (0 === $accounts->count()) { - Log::debug('Found zero accounts, do nothing.'); + Log::debug('Found zero accounts, search for invalid account.'); + $account = new Account; + $account->id = 0; + $this->collector->$collectorMethod(new Collection([$account])); + return; } Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count())); @@ -615,7 +619,10 @@ class OperatorQuerySearch implements SearchInterface }); if (0 === $filtered->count()) { - Log::debug('Left with zero accounts, return.'); + Log::debug('Left with zero accounts, search for invalid account.'); + $account = new Account; + $account->id = 0; + $this->collector->$collectorMethod(new Collection([$account])); return; } Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod)); @@ -661,7 +668,10 @@ class OperatorQuerySearch implements SearchInterface // search for accounts: $accounts = $this->accountRepository->searchAccountNr($value, $searchTypes, 25); if (0 === $accounts->count()) { - Log::debug('Found zero accounts, do nothing.'); + Log::debug('Found zero accounts, search for invalid account.'); + $account = new Account; + $account->id = 0; + $this->collector->$collectorMethod(new Collection([$account])); return; } @@ -681,10 +691,13 @@ class OperatorQuerySearch implements SearchInterface }); if (0 === $filtered->count()) { - Log::debug('Left with zero, return.'); + Log::debug('Left with zero, search for invalid account'); + $account = new Account; + $account->id = 0; + $this->collector->$collectorMethod(new Collection([$account])); return; } - Log::debug('Left with zero accounts, return.'); + Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod)); $this->collector->$collectorMethod($filtered); }