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

(-)a/C4/Reserves.pm (-2 / +2 lines)
Lines 566-575 sub CanItemBeReserved { Link Here
566
        unless ($item->can_be_transferred({ to => $destination })) {
566
        unless ($item->can_be_transferred({ to => $destination })) {
567
            return { status => 'cannotBeTransferred' };
567
            return { status => 'cannotBeTransferred' };
568
        }
568
        }
569
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
569
        if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
570
            return { status => 'pickupNotInHoldGroup' };
570
            return { status => 'pickupNotInHoldGroup' };
571
        }
571
        }
572
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'patrongroup' || Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
572
        if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
573
            return { status => 'pickupNotInHoldGroup' };
573
            return { status => 'pickupNotInHoldGroup' };
574
        }
574
        }
575
    }
575
    }
(-)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