From c3f285220917847bc06cf998c7760ffd11903b69 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 19 May 2022 15:52:21 +0100 Subject: [PATCH] Bug 30730: (follow-up) Simplify query This patch drops the 'fetch all non-loanable items' query used in the subsequent query as part of the 'not_in' and instead replaces it with a simple filter on 'notforloan => 0' Test plan Run the included unit tests before and apply applying the followup. Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers --- Koha/Holds.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Koha/Holds.pm b/Koha/Holds.pm index 69899cac8f..2a117f5f66 100644 --- a/Koha/Holds.pm +++ b/Koha/Holds.pm @@ -134,19 +134,13 @@ sub get_items_that_can_fill { collapse => 1, } )->get_column('itemnumber'); - my @notforloan = Koha::Items->search( - { notforloan => { '!=' => 0 } }, - { - columns => ['itemnumber'], - collapse => 1, - } - )->get_column('itemnumber'); return Koha::Items->search( { -or => \@bibs_or_items, - itemnumber => { -not_in => [ @branchtransfers, @waiting_holds, @notforloan ] }, + itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] }, onloan => undef, + notforloan => 0, } )->filter_by_for_hold(); } -- 2.39.5