Skip to content

Firefly III: a personal finances manager

Fix #3840

James Colef73af50eb0f1
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);
}