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

(-)a/C4/Circulation.pm (-8 / +23 lines)
Lines 2700-2717 sub CanBookBeRenewed { Link Here
2700
                }
2700
                }
2701
            }
2701
            }
2702
2702
2703
            # Avoid the overhead of GetMemberDetails, we don't need all that data
2704
            my @borrowers = $schema->resultset('Borrower')->search(
2705
                { -in => \@borrowernumbers },
2706
                {
2707
                    result_class => 'DBIx::Class::ResultClass::HashRefInflator',
2708
                }
2709
            );
2710
2711
            # Avoid the overhead of GetMemberDetails, we don't need all that data
2712
            my @items = $schema->resultset('Item')->search(
2713
                { -in => \@itemnumbers },
2714
                {
2715
                    result_class => 'DBIx::Class::ResultClass::HashRefInflator',
2716
                }
2717
            );
2718
2703
            # If the count of the union of the lists of reservable items for each borrower
2719
            # If the count of the union of the lists of reservable items for each borrower
2704
            # is equal or greater than the number of borrowers, we know that all reserves
2720
            # is equal or greater than the number of borrowers, we know that all reserves
2705
            # can be filled with available items. We can get the union of the sets simply
2721
            # can be filled with available items. We can get the union of the sets simply
2706
            # by pushing all the elements onto an array and removing the duplicates.
2722
            # by pushing all the elements onto an array and removing the duplicates.
2707
            my @reservable;
2723
            my @reservable;
2708
            foreach my $b (@borrowernumbers) {
2724
            foreach my $b (@borrowers) {
2709
                my ($borr) = C4::Members::GetMemberDetails($b);
2725
                warn "B: $b";
2710
                foreach my $i (@itemnumbers) {
2726
                foreach my $i (@items) {
2711
                    my $item = GetItem($i);
2727
                    warn "I: $i";
2712
                    if (   IsAvailableForItemLevelRequest( $item, $borr )
2728
                    if (   IsAvailableForItemLevelRequest( $i, $b )
2713
                        && CanItemBeReserved( $b, $i )
2729
                        && CanItemBeReserved( $b->{borrowernumber}, $i->{itemnumber} )
2714
                        && !IsItemOnHoldAndFound($i) )
2730
                        && !IsItemOnHoldAndFound( $i->{itemnumber} ) )
2715
                    {
2731
                    {
2716
                        push( @reservable, $i );
2732
                        push( @reservable, $i );
2717
                    }
2733
                    }
2718
- 

Return to bug 14320