View | Details | Raw Unified | Return to bug 27071
Collapse All | Expand All

(-)a/C4/Reserves.pm (-2 / +2 lines)
Lines 551-560 sub CanItemBeReserved { Link Here
551
        unless ($item->can_be_transferred({ to => $destination })) {
551
        unless ($item->can_be_transferred({ to => $destination })) {
552
            return { status => 'cannotBeTransferred' };
552
            return { status => 'cannotBeTransferred' };
553
        }
553
        }
554
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
554
        if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
555
            return { status => 'pickupNotInHoldGroup' };
555
            return { status => 'pickupNotInHoldGroup' };
556
        }
556
        }
557
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'patrongroup' || Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
557
        if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
558
            return { status => 'pickupNotInHoldGroup' };
558
            return { status => 'pickupNotInHoldGroup' };
559
        }
559
        }
560
    }
560
    }
(-)a/Koha/Library.pm (-17 / +2 lines)
Lines 240-262 Return if given library is a valid hold group member Link Here
240
240
241
sub validate_hold_sibling {
241
sub validate_hold_sibling {
242
    my ( $self, $params ) = @_;
242
    my ( $self, $params ) = @_;
243
    my $branchcode = $params->{branchcode};
243
    my @hold_libraries = $self->get_hold_libraries;
244
    my @hold_libraries = $self->get_hold_libraries;
244
245
    return grep {$_->branchcode eq $branchcode} @hold_libraries;
245
    foreach (@hold_libraries) {
246
        my $hold_library = $_;
247
        my $is_valid = 0;
248
        foreach my $key (keys %$params) {
249
            if ($hold_library->$key eq $params->{$key}) {
250
                $is_valid=1;
251
                last;
252
            }
253
        }
254
        if($is_valid) {
255
            #Found one library that meets all search parameters
256
            return 1;
257
        }
258
    }
259
    return 0;
260
}
246
}
261
247
262
=head2 Internal methods
248
=head2 Internal methods
263
- 

Return to bug 27071