Bug 27068: Fix errors in _checkHoldPolicy
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 3 Dec 2020 11:34:33 +0000 (06:34 -0500)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 12 Feb 2021 12:08:55 +0000 (13:08 +0100)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/HoldsQueue.pm
Koha/Library.pm

index e2666aa..d4380cc 100644 (file)
@@ -383,12 +383,12 @@ sub _checkHoldPolicy {
     my $hold_fulfillment_policy = $item->{hold_fulfillment_policy};
 
     return 0 if $hold_fulfillment_policy eq 'holdgroup' && !$library->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 'homebranch' && $request->{branchcode} ne $item->{$hold_fulfillment_policy};
+    return 0 if $hold_fulfillment_policy eq 'holdingbranch' && $request->{branchcode} ne $item->{$hold_fulfillment_policy};
 
     my $patronLibrary = Koha::Libraries->find($request->{borrowerbranch});
 
-    return 0 if $hold_fulfillment_policy eq 'patrongroup' && !patronLibrary->validate_hold_sibling({branchcode => $request->{branchcode}});
+    return 0 if $hold_fulfillment_policy eq 'patrongroup' && !$patronLibrary->validate_hold_sibling({branchcode => $request->{branchcode}});
 
     return 1;
 
index b69fdaa..fc2f4f5 100644 (file)
@@ -240,6 +240,9 @@ Return if given library is a valid hold group member
 
 sub validate_hold_sibling {
     my ( $self, $params ) = @_;
+
+    return 1 if $params->{branchcode} eq $self->id;
+
     my @hold_libraries = $self->get_hold_libraries;
 
     foreach (@hold_libraries) {