From 389c9e32d578c5ca5d96ee48751ec295f025f1ed 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 Signed-off-by: Emmi Takkinen --- Koha/Items.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Koha/Items.pm b/Koha/Items.pm index af9eb1072f6..d4d06e75ef8 100644 --- a/Koha/Items.pm +++ b/Koha/Items.pm @@ -307,9 +307,9 @@ sub filter_by_available { itemlost => 0, withdrawn => 0, damaged => 0, - notforloan => { '<=' => 0 }, - 'me.itype' => { -not_in => \@item_types_notforloan }, + notforloan => { '<=' => 0 }, restricted => [ { '!=' => 0 }, undef ], + 'me.itype' => { -not_in => \@item_types_notforloan }, } ); } @@ -606,7 +606,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; @@ -620,10 +620,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.5