From 22e206bc35b4bee133b2a1155684e8b3a06e3517 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 22 Jun 2021 15:43:10 +0200 Subject: [PATCH] Bug 3142: Add itype Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart (cherry picked from commit a9b306fa7c98de6d5f25d15c55fd1d387e954343) Signed-off-by: Andrew Fuerste-Henry --- Koha/Items.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Koha/Items.pm b/Koha/Items.pm index 90fe0f25ca..5fb8c6979c 100644 --- a/Koha/Items.pm +++ b/Koha/Items.pm @@ -24,6 +24,7 @@ use Carp; use Koha::Database; use Koha::Item; +use Koha::CirculationRules; use base qw(Koha::Objects); @@ -48,6 +49,15 @@ Return the items of the set that are holdable sub filter_by_for_hold { my ($self) = @_; + my @hold_not_allowed_itypes = Koha::CirculationRules->search( + { + rule_name => 'holdallowed', + branchcode => undef, + categorycode => undef, + rule_value => 'not_allowed', + } + )->get_column('itemtype'); + return $self->search( { itemlost => 0, @@ -55,6 +65,7 @@ sub filter_by_for_hold { notforloan => { '<=' => 0 } , # items with negative or zero notforloan value are holdable ( C4::Context->preference('AllowHoldsOnDamagedItems') ? ( damaged => 0 ) : () ), + itype => { -not_in => \@hold_not_allowed_itypes }, } ); } -- 2.39.5