This commit is contained in:
James Cole
2020-09-23 19:32:46 +02:00
parent 5f5346ed71
commit f73af50eb0

View File

@@ -606,7 +606,11 @@ class OperatorQuerySearch implements SearchInterface
// get accounts: // get accounts:
$accounts = $this->accountRepository->searchAccount($value, $searchTypes, 25); $accounts = $this->accountRepository->searchAccount($value, $searchTypes, 25);
if (0 === $accounts->count()) { 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; return;
} }
Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count())); Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
@@ -615,7 +619,10 @@ class OperatorQuerySearch implements SearchInterface
}); });
if (0 === $filtered->count()) { 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; return;
} }
Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod)); Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
@@ -661,7 +668,10 @@ class OperatorQuerySearch implements SearchInterface
// search for accounts: // search for accounts:
$accounts = $this->accountRepository->searchAccountNr($value, $searchTypes, 25); $accounts = $this->accountRepository->searchAccountNr($value, $searchTypes, 25);
if (0 === $accounts->count()) { 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; return;
} }
@@ -681,10 +691,13 @@ class OperatorQuerySearch implements SearchInterface
}); });
if (0 === $filtered->count()) { 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; return;
} }
Log::debug('Left with zero accounts, return.'); Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
$this->collector->$collectorMethod($filtered); $this->collector->$collectorMethod($filtered);
} }