From e0fd5d438bf7a4cf4a4672ee6bd2f39924bf3219 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 --- 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.20.1