Bugzilla – Attachment 113929 Details for
Bug 27071
Hold pickup library match not enforced correctly on intranet when using hold groups
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27071: Code simplification
Bug-27071-Code-simplification.patch (text/plain), 2.35 KB, created by
Jonathan Druart
on 2020-11-23 14:53:18 UTC
(
hide
)
Description:
Bug 27071: Code simplification
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-11-23 14:53:18 UTC
Size:
2.35 KB
patch
obsolete
>From 638014450412dd87cf5766f433321d3bfbd4354c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 23 Nov 2020 15:52:56 +0100 >Subject: [PATCH] Bug 27071: Code simplification > >--- > C4/Reserves.pm | 4 ++-- > Koha/Library.pm | 18 ++---------------- > 2 files changed, 4 insertions(+), 18 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index c5a8d4ab53..f492abb434 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -551,10 +551,10 @@ sub CanItemBeReserved { > unless ($item->can_be_transferred({ to => $destination })) { > return { status => 'cannotBeTransferred' }; > } >- unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) { >+ if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) { > return { status => 'pickupNotInHoldGroup' }; > } >- unless ($branchitemrule->{hold_fulfillment_policy} ne 'patrongroup' || Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) { >+ if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) { > return { status => 'pickupNotInHoldGroup' }; > } > } >diff --git a/Koha/Library.pm b/Koha/Library.pm >index 19cbcb0121..27e6b45588 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -240,23 +240,9 @@ Return if given library is a valid hold group member > > sub validate_hold_sibling { > my ( $self, $params ) = @_; >+ my $branchcode = $params->{branchcode}; > my @hold_libraries = $self->get_hold_libraries; >- >- foreach (@hold_libraries) { >- my $hold_library = $_; >- my $is_valid = 0; >- foreach my $key (keys %$params) { >- if ($hold_library->$key eq $params->{$key}) { >- $is_valid=1; >- last; >- } >- } >- if($is_valid) { >- #Found one library that meets all search parameters >- return 1; >- } >- } >- return 0; >+ return grep {$_->branchcode eq $branchcode} @hold_libraries; > } > > =head2 Internal methods >-- >2.20.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 27071
:
113928
|
113929
|
113963
|
116599
|
116600
|
116601
|
116602
|
116603
|
117140
|
117141
|
117142
|
117143
|
117144
|
117145
|
117184
|
117185
|
117186
|
117187
|
117188
|
117189
|
117204
|
117205
|
117206
|
117207
|
117208
|
117209