From 994b6fc715f43b71cc1c95fce2eff3ccd48a787d Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 8 Nov 2024 23:36:43 +0000 Subject: [PATCH] Bug 37334: Fix restricted and notforloan filter logic --- Koha/Items.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Koha/Items.pm b/Koha/Items.pm index 5d3a8d7532..47694a6451 100644 --- a/Koha/Items.pm +++ b/Koha/Items.pm @@ -305,8 +305,8 @@ sub filter_by_available { withdrawn => 0, damaged => 0, notforloan => { '<=' => 0 }, - 'me.itype' => { -not_in => \@item_types_notforloan }, restricted => [ { '!=' => 0 }, undef ], + 'me.itype' => { -not_in => \@item_types_notforloan }, } ); } @@ -599,7 +599,7 @@ sub search { } if ( $status eq 'not_for_loan' ) { my @item_types_notforloan = Koha::ItemTypes->search( { notforloan => { '!=' => 0 } } )->get_column('itemtype'); - $self = $self->search( [ { notforloan => { '<=' => 0 } }, { 'me.itype' => \@item_types_notforloan } ] ); + $self = $self->search( [ { notforloan => { '>' => 0 } }, { 'me.itype' => \@item_types_notforloan } ] ); } if ( $status eq 'on_hold' ) { $self = $self->filter_by_has_holds; @@ -613,10 +613,9 @@ sub search { } if ( $status eq 'restricted' ) { - $self = $self->search( { restricted => [ { '!=' => 0 }, undef ] } ); + $self = $self->search( { restricted => [ { '!=' => 0 } ] } ); } } - return $self->SUPER::search( $params, $attributes ); } -- 2.39.2