Bugzilla – Attachment 176026 Details for
Bug 37334
Cannot filter holdings table by status
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37334: Fix logic for not available
0004-Bug-37334-Fix-logic-for-not-available.patch (text/plain), 3.06 KB, created by
Emmi Takkinen
on 2024-12-31 08:08:22 UTC
(
hide
)
Description:
Bug 37334: Fix logic for not available
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2024-12-31 08:08:22 UTC
Size:
3.06 KB
patch
obsolete
>From e3154192cf99482c3e5263560b3a0dac0dad8af9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 5 Nov 2024 15:11:48 +0100 >Subject: [PATCH 04/13] Bug 37334: Fix logic for not available > >Several major changes here: >* the push @not_availab_itemnumbers for lost, damaged, etc. was totally > wrong >* not for loan is only for positive values >* restricted can be NULL > >Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >--- > Koha/Items.pm | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index e107d217f8..5d3a8d7532 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -290,20 +290,25 @@ sub filter_by_available { > my ($self) = @_; > > my @all_itemnumbers = $self->get_column('itemnumber'); >- my @item_types_notforloan = Koha::ItemTypes->search( { notforloan => { '!=' => 0 } } )->get_column('itemtype'); > my @not_available_itemnumbers; > push @not_available_itemnumbers, $self->filter_by_checked_out->get_column('itemnumber'); > push @not_available_itemnumbers, $self->filter_by_in_transit->get_column('itemnumber'); >- push @not_available_itemnumbers, $self->search( >- { >- itemlost => 0, withdrawn => 0, damaged => 0, notforloan => 0, >- itype => { -not_in => \@item_types_notforloan }, restricted => 0, >- } >- )->get_column('itemnumber'); >+ > push @not_available_itemnumbers, $self->filter_by_has_holds->get_column('itemnumber'); > push @not_available_itemnumbers, $self->filter_by_has_recalls->get_column('itemnumber'); > >- return Koha::Items->search( { 'me.itemnumber' => [ array_minus @all_itemnumbers, @not_available_itemnumbers ] } ); >+ my @item_types_notforloan = Koha::ItemTypes->search( { notforloan => { '!=' => 0 } } )->get_column('itemtype'); >+ return Koha::Items->search( >+ { >+ 'me.itemnumber' => [ array_minus @all_itemnumbers, @not_available_itemnumbers ], >+ itemlost => 0, >+ withdrawn => 0, >+ damaged => 0, >+ notforloan => { '<=' => 0 }, >+ 'me.itype' => { -not_in => \@item_types_notforloan }, >+ restricted => [ { '!=' => 0 }, undef ], >+ } >+ ); > } > > >@@ -594,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; >@@ -608,7 +613,7 @@ sub search { > } > > if ( $status eq 'restricted' ) { >- $self = $self->search( { restricted => { '!=' => 0 } } ); >+ $self = $self->search( { restricted => [ { '!=' => 0 }, undef ] } ); > } > } > >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37334
:
172300
|
172301
|
172302
|
173499
|
173500
|
173501
|
173949
|
173950
|
173951
|
173982
|
174310
|
174798
|
174799
|
174800
|
174801
|
174802
|
174803
|
174804
|
174813
|
174814
|
174901
|
174902
|
174903
|
174955
|
175859
|
175860
|
175861
|
175862
|
175863
|
175864
|
175865
|
175866
|
175867
|
175868
|
175869
|
175870
|
175871
|
175999
|
176000
|
176001
|
176002
|
176003
|
176004
|
176005
|
176006
|
176007
|
176008
|
176009
|
176010
|
176011
|
176023
|
176024
|
176025
|
176026
|
176027
|
176028
|
176029
|
176030
|
176031
|
176032
|
176033
|
176034
|
176035
|
176475
|
176477
|
176480
|
176481
|
177321
|
177415
|
177416
|
177417
|
177418
|
177419
|
177420
|
177421
|
177422
|
177423
|
177424
|
177425
|
177426
|
177427
|
177428
|
177429
|
177430
|
177431
|
177432