From 2d5bd4f271bcfebae92f8852f665d8c919a420e9 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 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 --- Koha/Holds.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Koha/Holds.pm b/Koha/Holds.pm index 4a25babff5..c8b3f54a2e 100644 --- a/Koha/Holds.pm +++ b/Koha/Holds.pm @@ -114,7 +114,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, @@ -122,8 +131,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.20.1