Bugzilla – Attachment 163467 Details for
Bug 36362
Only call Koha::Libraries->search() if necessary in Item::pickup_locations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36362: Only call Koha::Libraries->search() if necessary in Item::pickup_locations
Bug-36362-Only-call-KohaLibraries-search-if-necess.patch (text/plain), 2.57 KB, created by
David Gustafsson
on 2024-03-19 17:35:37 UTC
(
hide
)
Description:
Bug 36362: Only call Koha::Libraries->search() if necessary in Item::pickup_locations
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2024-03-19 17:35:37 UTC
Size:
2.57 KB
patch
obsolete
>From 3eeb1b81bb0d16056d241b3436ace9386bf69904 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Tue, 19 Mar 2024 18:33:18 +0100 >Subject: [PATCH] Bug 36362: Only call Koha::Libraries->search() if necessary > in Item::pickup_locations > >To test: > >1) Make sure the following tests pass: > - t/db_dependent/Koha/Item.t > - t/db_dependent/Koha/Biblios.t > - db_dependent/Koha/Biblio.t > > Sponsored-by: Gothenburg University Library >--- > Koha/Item.pm | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 22eaceac948..2211024d85b 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -957,10 +957,16 @@ sub pickup_locations { > my $branchitemrule = > C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype ); > >- return Koha::Libraries->new()->empty if $branchitemrule->{holdallowed} eq 'from_local_hold_group' && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} ); >- return Koha::Libraries->new()->empty if $branchitemrule->{holdallowed} eq 'from_home_library' && $self->home_branch->branchcode ne $patron->branchcode; >+ if ( >+ $branchitemrule->{holdallowed} eq 'from_local_hold_group' && >+ !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} ) || >+ $branchitemrule->{holdallowed} eq 'from_home_library' && >+ $self->home_branch->branchcode ne $patron->branchcode >+ ) { >+ return Koha::Libraries->new()->empty; >+ } > >- my $pickup_libraries = Koha::Libraries->search(); >+ my $pickup_libraries; > if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') { > $pickup_libraries = $self->home_branch->get_hold_libraries; > } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup') { >@@ -970,7 +976,9 @@ sub pickup_locations { > $pickup_libraries = Koha::Libraries->search({ branchcode => $self->homebranch }); > } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') { > $pickup_libraries = Koha::Libraries->search({ branchcode => $self->holdingbranch }); >- }; >+ } else { >+ $pickup_libraries = Koha::Libraries->search(); >+ } > > return $pickup_libraries->search( > { >@@ -982,7 +990,9 @@ sub pickup_locations { > ) unless C4::Context->preference('UseBranchTransferLimits'); > > my $limittype = C4::Context->preference('BranchTransferLimitsType'); >- my ($ccode, $itype) = (undef, undef); >+ my $ccode; >+ my $itype; >+ > if( $limittype eq 'ccode' ){ > $ccode = $self->ccode; > } else { >-- >2.43.0
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 36362
:
163467
|
163468
|
166451
|
169249
|
169250