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

(-)a/C4/Circulation.pm (-11 / +13 lines)
Lines 27-33 use Encode; Link Here
27
use Koha::DateUtils qw( dt_from_string output_pref );
27
use Koha::DateUtils qw( dt_from_string output_pref );
28
use C4::Context;
28
use C4::Context;
29
use C4::Stats qw( UpdateStats );
29
use C4::Stats qw( UpdateStats );
30
use C4::Reserves qw( CheckReserves CanItemBeReserved MoveReserve ModReserve ModReserveMinusPriority RevertWaitingStatus IsItemOnHoldAndFound IsAvailableForItemLevelRequest );
30
use C4::Reserves qw( CheckReserves CanItemBeReserved MoveReserve ModReserve ModReserveMinusPriority RevertWaitingStatus IsItemOnHoldAndFound IsAvailableForItemLevelRequest ItemsAnyAvailableAndNotRestricted );
31
use C4::Biblio qw( UpdateTotalIssues );
31
use C4::Biblio qw( UpdateTotalIssues );
32
use C4::Items qw( ModItemTransfer ModDateLastSeen CartToShelf );
32
use C4::Items qw( ModItemTransfer ModDateLastSeen CartToShelf );
33
use C4::Accounts;
33
use C4::Accounts;
Lines 2853-2871 sub CanBookBeRenewed { Link Here
2853
            # can be filled with available items. We can get the union of the sets simply
2853
            # can be filled with available items. We can get the union of the sets simply
2854
            # by pushing all the elements onto an array and removing the duplicates.
2854
            # by pushing all the elements onto an array and removing the duplicates.
2855
            my @reservable;
2855
            my @reservable;
2856
            ITEM: while ( my $item = $items->next ) {
2856
            my %matched_items;
2857
                next if IsItemOnHoldAndFound( $item->itemnumber );
2857
            PATRON: while ( my $patron = $patrons->next ) {
2858
                while ( my $patron = $patrons->next ) {
2858
                my $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $item->biblionumber, patron => $patron });
2859
                    next unless IsAvailableForItemLevelRequest($item, $patron);
2859
                while ( my $other_item = $items->next ) {
2860
                    next unless CanItemBeReserved($patron->borrowernumber,$item->itemnumber,undef,{ignore_hold_counts=>1})->{status} eq 'OK';
2860
                    next if $matched_items{$other_item->itemnumber} == 1;
2861
                    push @reservable, $item->itemnumber;
2861
                    next if IsItemOnHoldAndFound( $other_item->itemnumber );
2862
                    next unless IsAvailableForItemLevelRequest($other_item, $patron, undef, $items_any_available);
2863
                    next unless CanItemBeReserved($patron->borrowernumber,$other_item->itemnumber,undef,{ignore_hold_counts=>1})->{status} eq 'OK';
2864
                    push @reservable, $other_item->itemnumber;
2862
                    if (@reservable >= @borrowernumbers) {
2865
                    if (@reservable >= @borrowernumbers) {
2863
                        $resfound = 0;
2866
                        $resfound = 0;
2864
                        last ITEM;
2867
                        last PATRON;
2865
                    }
2868
                    }
2866
                    last;
2869
                    $matched_items{$other_item->itemnumber} = 1;
2867
                }
2870
                }
2868
                $patrons->reset;
2871
                $items->reset;
2869
            }
2872
            }
2870
        }
2873
        }
2871
    }
2874
    }
2872
- 

Return to bug 29483