From bcdc562bf7f5f8eaeb14a4a11cfb5801d016a993 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 23 Oct 2020 12:33:53 +0200 Subject: [PATCH] Fix zero length limit. --- app/Helpers/Collector/GroupCollector.php | 4 +++- app/Support/Search/OperatorQuerySearch.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index 612f3d0049..cf20585286 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -190,7 +190,9 @@ class GroupCollector implements GroupCollectorInterface public function getPaginatedGroups(): LengthAwarePaginator { $set = $this->getGroups(); - + if(0===$this->limit) { + $this->setLimit(50); + } return new LengthAwarePaginator($set, $this->total, $this->limit, $this->page); } diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 1f6ee522b0..446217f028 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -192,7 +192,7 @@ class OperatorQuerySearch implements SearchInterface public function searchTransactions(): LengthAwarePaginator { if (0 === count($this->getWords()) && 0 === count($this->getOperators())) { - throw new FireflyException('Search query is empty.'); + return new LengthAwarePaginator; } return $this->collector->getPaginatedGroups(); }