Bug 27068: Perltidy _checkHoldPolicy

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 40ccb7f371)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8f34251746)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2021-02-12 12:11:54 +01:00 committed by Andrew Fuerste-Henry
parent b2c55f8440
commit 75ffbc53d9
1 changed files with 25 additions and 7 deletions

View File

@ -371,20 +371,38 @@ sub GetItemsAvailableToFillHoldRequestsForBib {
=cut
sub _checkHoldPolicy {
my ($item, $request) = @_;
my ( $item, $request ) = @_;
return 0 unless $item->{holdallowed};
return 0 if $item->{holdallowed} == 1 && $item->{homebranch} ne $request->{borrowerbranch};
return 0 if $item->{'holdallowed'} == 3 && !Koha::Libraries->find($item->{homebranch})->validate_hold_sibling({branchcode => $request->{borrowerbranch}});
return 0
if $item->{holdallowed} == 1
&& $item->{homebranch} ne $request->{borrowerbranch};
return 0
if $item->{'holdallowed'} == 3
&& !Koha::Libraries->find( $item->{homebranch} )
->validate_hold_sibling( { branchcode => $request->{borrowerbranch} } );
my $hold_fulfillment_policy = $item->{hold_fulfillment_policy};
return 0 if $hold_fulfillment_policy eq 'holdgroup' && !Koha::Libraries->find($item->{homebranch})->validate_hold_sibling({branchcode => $request->{branchcode}});
return 0 if $hold_fulfillment_policy eq 'homebranch' && $request->{branchcode} ne $item->{$hold_fulfillment_policy};
return 0 if $hold_fulfillment_policy eq 'holdingbranch' && $request->{branchcode} ne $item->{$hold_fulfillment_policy};
return 0
if $hold_fulfillment_policy eq 'holdgroup'
&& !Koha::Libraries->find( $item->{homebranch} )
->validate_hold_sibling( { branchcode => $request->{branchcode} } );
return 0 if $hold_fulfillment_policy eq 'patrongroup' && !Koha::Libraries->find($request->{borrowerbranch})->validate_hold_sibling({branchcode => $request->{branchcode}});
return 0
if $hold_fulfillment_policy eq 'homebranch'
&& $request->{branchcode} ne $item->{$hold_fulfillment_policy};
return 0
if $hold_fulfillment_policy eq 'holdingbranch'
&& $request->{branchcode} ne $item->{$hold_fulfillment_policy};
return 0
if $hold_fulfillment_policy eq 'patrongroup'
&& !Koha::Libraries->find( $request->{borrowerbranch} )
->validate_hold_sibling( { branchcode => $request->{branchcode} } );
return 1;