From 1abf8608976690e00577f4102511775a484007ef Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 17 Aug 2021 11:37:28 -0300 Subject: [PATCH] Bug 28871: Make Koha::Objects->empty work on list context This patch makes Koha::Objects->empty work on list context, by making it return the $self->search call. To test: 1. Apply the regression test patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Objects.t => FAIL: Tests fail! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Martin Renvoize --- Koha/Objects.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Objects.pm b/Koha/Objects.pm index 3ee0a55742..96b7bc4001 100644 --- a/Koha/Objects.pm +++ b/Koha/Objects.pm @@ -383,7 +383,7 @@ sub empty { $self = $self->search(\'0 = 1'); $self->_resultset()->set_cache([]); - return $self; + return (wantarray) ? () : $self; } =head3 Koha::Objects->reset(); -- 2.20.1