From 7ef261bce4a7671ea806b7b5f9d107af489b7eaf 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 Content-Type: text/plain; charset=utf-8 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 Signed-off-by: Marcel de Rooy --- 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