From 1e7d04a6089bc3f57f3ff52363cda26cda28d126 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 13 Nov 2020 15:54:32 -0300 Subject: [PATCH] Bug 27021: Make chaining ->empty always return an empty resultset This patch borrows the implementation Martin did on bug 27002, to woraround this issue, and implements it properly on the Koha::Objects->empty method. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Objects.t => FAIL: Tests fail! The resultset should be empty and it isn't! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off! Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 55835ccfaffef48b924857e18bfd964aebda3a0a) Signed-off-by: Andrew Fuerste-Henry --- Koha/Objects.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Objects.pm b/Koha/Objects.pm index 7824d83d27..c298837647 100644 --- a/Koha/Objects.pm +++ b/Koha/Objects.pm @@ -336,6 +336,7 @@ sub empty { class => $self ) unless ref $self; + $self = $self->search(\'0 = 1'); $self->_resultset()->set_cache([]); return $self; -- 2.39.5