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 243-265 sub validate_hold_sibling { Link Here
243
243
244
    return 1 if $params->{branchcode} eq $self->id;
244
    return 1 if $params->{branchcode} eq $self->id;
245
245
246
    my $branchcode = $params->{branchcode};
246
    my @hold_libraries = $self->get_hold_libraries;
247
    my @hold_libraries = $self->get_hold_libraries;
247
248
    return grep {$_->branchcode eq $branchcode} @hold_libraries;
248
    foreach (@hold_libraries) {
249
        my $hold_library = $_;
250
        my $is_valid = 0;
251
        foreach my $key (keys %$params) {
252
            if ($hold_library->$key eq $params->{$key}) {
253
                $is_valid=1;
254
                last;
255
            }
256
        }
257
        if($is_valid) {
258
            #Found one library that meets all search parameters
259
            return 1;
260
        }
261
    }
262
    return 0;
263
}
249
}
264
250
265
=head2 Internal methods
251
=head2 Internal methods
266
- 

Return to bug 27071