Bug 27068: Perltidy _checkHoldPolicy
[koha-ffzg.git] / C4 / HoldsQueue.pm
index 943879e..b0af40b 100644 (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 '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 0
+      if $hold_fulfillment_policy eq 'patrongroup'
+      && !Koha::Libraries->find( $request->{borrowerbranch} )
+              ->validate_hold_sibling( { branchcode => $request->{branchcode} } );
 
     return 1;