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

(-)a/opac/opac-reserve.pl (-4 / +4 lines)
Lines 428-433 foreach my $biblioNum (@biblionumbers) { Link Here
428
    # (before this loop was inside that sub loop so it was O(n^2) )
428
    # (before this loop was inside that sub loop so it was O(n^2) )
429
    my $items_any_available;
429
    my $items_any_available;
430
    $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioNum, patron => $patron }) if $patron;
430
    $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioNum, patron => $patron }) if $patron;
431
    my $can_book_be_reserved = CanBookBeReserved( $borrowernumber, $biblioNum, undef, { return_all_items => 1 });
431
    foreach my $item (@{$biblioData->{items}}) {
432
    foreach my $item (@{$biblioData->{items}}) {
432
433
433
        my $item_info = $item->unblessed;
434
        my $item_info = $item->unblessed;
Lines 468-475 foreach my $biblioNum (@biblionumbers) { Link Here
468
469
469
        # items_any_available defined outside of the current loop,
470
        # items_any_available defined outside of the current loop,
470
        # so we avoiding loop inside IsAvailableForItemLevelRequest:
471
        # so we avoiding loop inside IsAvailableForItemLevelRequest:
471
        my $policy_holdallowed =
472
        my $policy_holdallowed &&=
472
            CanItemBeReserved( $patron, $item )->{status} eq 'OK' &&
473
            $can_book_be_reserved->{$item->itemnumber}->{status} eq 'OK' &&
473
            IsAvailableForItemLevelRequest($item, $patron, undef, $items_any_available);
474
            IsAvailableForItemLevelRequest($item, $patron, undef, $items_any_available);
474
475
475
        if ($policy_holdallowed) {
476
        if ($policy_holdallowed) {
Lines 530-536 foreach my $biblioNum (@biblionumbers) { Link Here
530
        }
531
        }
531
    }
532
    }
532
533
533
    my $status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status};
534
    my $status = $can_book_be_reserved->{status};
534
    $biblioLoopIter{holdable} &&= $status eq 'OK';
535
    $biblioLoopIter{holdable} &&= $status eq 'OK';
535
    $biblioLoopIter{$status} = 1;
536
    $biblioLoopIter{$status} = 1;
536
537
537
- 

Return to bug 30860