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 2845-2863
sub CanBookBeRenewed {
Link Here
|
2845 |
# can be filled with available items. We can get the union of the sets simply |
2845 |
# can be filled with available items. We can get the union of the sets simply |
2846 |
# by pushing all the elements onto an array and removing the duplicates. |
2846 |
# by pushing all the elements onto an array and removing the duplicates. |
2847 |
my @reservable; |
2847 |
my @reservable; |
2848 |
ITEM: while ( my $item = $items->next ) { |
2848 |
my %matched_items; |
2849 |
next if IsItemOnHoldAndFound( $item->itemnumber ); |
2849 |
PATRON: while ( my $patron = $patrons->next ) { |
2850 |
while ( my $patron = $patrons->next ) { |
2850 |
my $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $item->biblionumber, patron => $patron }); |
2851 |
next unless IsAvailableForItemLevelRequest($item, $patron); |
2851 |
while ( my $other_item = $items->next ) { |
2852 |
next unless CanItemBeReserved($patron->borrowernumber,$item->itemnumber,undef,{ignore_hold_counts=>1})->{status} eq 'OK'; |
2852 |
next if $matched_items{$other_item->itemnumber} == 1; |
2853 |
push @reservable, $item->itemnumber; |
2853 |
next if IsItemOnHoldAndFound( $other_item->itemnumber ); |
|
|
2854 |
next unless IsAvailableForItemLevelRequest($other_item, $patron, undef, $items_any_available); |
2855 |
next unless CanItemBeReserved($patron->borrowernumber,$other_item->itemnumber,undef,{ignore_hold_counts=>1})->{status} eq 'OK'; |
2856 |
push @reservable, $other_item->itemnumber; |
2854 |
if (@reservable >= @borrowernumbers) { |
2857 |
if (@reservable >= @borrowernumbers) { |
2855 |
$resfound = 0; |
2858 |
$resfound = 0; |
2856 |
last ITEM; |
2859 |
last PATRON; |
2857 |
} |
2860 |
} |
|
|
2861 |
$matched_items{$other_item->itemnumber} = 1; |
2858 |
last; |
2862 |
last; |
2859 |
} |
2863 |
} |
2860 |
$patrons->reset; |
2864 |
$items->reset; |
2861 |
} |
2865 |
} |
2862 |
} |
2866 |
} |
2863 |
} |
2867 |
} |
2864 |
- |
|
|