From a62d39ea11a9b6986c155f6333ac6e3afde0dd87 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 --- Koha/Item.pm | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 9e1d3081c1..b9e35ae352 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -997,28 +997,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