From cded9d825e1e75390af599c13f8e7d2a2049e647 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 17 Feb 2021 16:11:52 +0100 Subject: [PATCH] Bug 27718: (bug 24488 follow-up) Hide items not holdable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After bug 24488 was merged Holds to Pull list (/cgi-bin/koha/circ/pendingreserves.pl) doesn't respect anymore the 'holdallowed' circulation rules (we bisected it to this change). If we look at the patch "Bug 24488: Show correct first patron details on Holds to pull" (2285c2d6575) then we can notice that previously the items that were shown in the list must had holdallowed != 0: Now it seems like similar circ rule check is missing in the newly rewritten Holds To Pull implementation. (description copied from comment 0) Test plan: Have several pending holds Mark some item type as not holdable in the circulation rules Confirm that the non holdable items are no longer listed on the "Holds to pull" view Signed-off-by: Andrew Nugged Signed-off-by: Joonas Kylmälä --- Koha/Holds.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Koha/Holds.pm b/Koha/Holds.pm index 82268d4ed2..61351a1efd 100644 --- a/Koha/Holds.pm +++ b/Koha/Holds.pm @@ -131,7 +131,16 @@ sub get_items_that_can_fill { } ); - return Koha::Items->search( + my @hold_not_allowed_itypes = Koha::CirculationRules->search( + { + rule_name => 'holdallowed', + branchcode => undef, + categorycode => undef, + rule_value => 0, + } + )->get_column('itemtype'); + + my $items = Koha::Items->search( { biblionumber => { in => \@biblionumbers }, itemlost => 0, @@ -139,8 +148,10 @@ sub get_items_that_can_fill { notforloan => 0, onloan => undef, itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] }, + itype => { -not_in => \@hold_not_allowed_itypes }, } ); + } =head3 type -- 2.11.0