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

(-)a/opac/opac-reserve.pl (-3 / +4 lines)
Lines 476-481 foreach my $biblioNum (@biblionumbers) { Link Here
476
    # (before this loop was inside that sub loop so it was O(n^2) )
476
    # (before this loop was inside that sub loop so it was O(n^2) )
477
    my $items_any_available;
477
    my $items_any_available;
478
    $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioNum, patron => $patron }) if $patron;
478
    $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioNum, patron => $patron }) if $patron;
479
    my $can_book_be_reserved = CanBookBeReserved( $borrowernumber, $biblioNum, undef, { return_all_items => 1 });
480
    warn Data::Dumper::Dumper($can_book_be_reserved);
479
    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
481
    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
480
        my $itemNum = $itemInfo->{itemnumber};
482
        my $itemNum = $itemInfo->{itemnumber};
481
        my $item = $visible_items->{$itemNum};
483
        my $item = $visible_items->{$itemNum};
Lines 566-572 foreach my $biblioNum (@biblionumbers) { Link Here
566
        # items_any_available defined outside of the current loop,
568
        # items_any_available defined outside of the current loop,
567
        # so we avoiding loop inside IsAvailableForItemLevelRequest:
569
        # so we avoiding loop inside IsAvailableForItemLevelRequest:
568
        $policy_holdallowed &&=
570
        $policy_holdallowed &&=
569
            CanItemBeReserved( $patron, $item )->{status} eq 'OK' &&
571
            $can_book_be_reserved->{$item->itemnumber}->{status} eq 'OK' &&
570
            IsAvailableForItemLevelRequest($item, $patron, undef, $items_any_available);
572
            IsAvailableForItemLevelRequest($item, $patron, undef, $items_any_available);
571
573
572
        if ($policy_holdallowed) {
574
        if ($policy_holdallowed) {
Lines 629-635 foreach my $biblioNum (@biblionumbers) { Link Here
629
        }
631
        }
630
    }
632
    }
631
633
632
    my $status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status};
634
    my $status = $can_book_be_reserved->{status};
633
    $biblioLoopIter{holdable} &&= $status eq 'OK';
635
    $biblioLoopIter{holdable} &&= $status eq 'OK';
634
    $biblioLoopIter{already_patron_possession} = $status eq 'alreadypossession';
636
    $biblioLoopIter{already_patron_possession} = $status eq 'alreadypossession';
635
637
636
- 

Return to bug 30860