From 1edeffba84ce2582014b4970fff64d129f0e713c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 19 Jul 2024 12:23:43 -0400 Subject: [PATCH] Bug 36362: (QA follow-up) Tidy code Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize (cherry picked from commit a62d39ea11a9b6986c155f6333ac6e3afde0dd87) Signed-off-by: Lucas Gass (cherry picked from commit b507aad0cb1876abcea6476035ed7a7570ad0860) Signed-off-by: Fridolin Somers --- Koha/Item.pm | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 1ed86af199..334388f71e 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -920,28 +920,26 @@ sub pickup_locations { my $patron = $params->{patron}; my $circ_control_branch = Koha::Policy::Holds->holds_control_library( $self, $patron ); - my $branchitemrule = - C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype ); - - 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 - ) { + my $branchitemrule = C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype ); + + 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; - if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') { + if ( $branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' ) { $pickup_libraries = $self->home_branch->get_hold_libraries; - } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup') { - my $plib = Koha::Libraries->find({ branchcode => $patron->branchcode}); + } elsif ( $branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' ) { + my $plib = Koha::Libraries->find( { branchcode => $patron->branchcode } ); $pickup_libraries = $plib->get_hold_libraries; - } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') { - $pickup_libraries = Koha::Libraries->search({ branchcode => $self->homebranch }); - } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') { - $pickup_libraries = Koha::Libraries->search({ branchcode => $self->holdingbranch }); + } elsif ( $branchitemrule->{hold_fulfillment_policy} eq 'homebranch' ) { + $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(); } -- 2.39.5