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 2958-2976
sub CanBookBeRenewed {
Link Here
|
2958 |
# can be filled with available items. We can get the union of the sets simply |
2958 |
# can be filled with available items. We can get the union of the sets simply |
2959 |
# by pushing all the elements onto an array and removing the duplicates. |
2959 |
# by pushing all the elements onto an array and removing the duplicates. |
2960 |
my @reservable; |
2960 |
my @reservable; |
2961 |
ITEM: while ( my $item = $items->next ) { |
2961 |
my %matched_items; |
2962 |
next if IsItemOnHoldAndFound( $item->itemnumber ); |
2962 |
PATRON: while ( my $patron = $patrons->next ) { |
2963 |
while ( my $patron = $patrons->next ) { |
2963 |
my $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $item->biblionumber, patron => $patron }); |
2964 |
next unless IsAvailableForItemLevelRequest($item, $patron); |
2964 |
while ( my $other_item = $items->next ) { |
2965 |
next unless CanItemBeReserved($patron,$item,undef,{ignore_hold_counts=>1})->{status} eq 'OK'; |
2965 |
next if $matched_items{$other_item->itemnumber} == 1; |
2966 |
push @reservable, $item->itemnumber; |
2966 |
next if IsItemOnHoldAndFound( $other_item->itemnumber ); |
|
|
2967 |
next unless IsAvailableForItemLevelRequest($other_item, $patron, undef, $items_any_available); |
2968 |
next unless CanItemBeReserved($patron,$other_item,undef,{ignore_hold_counts=>1})->{status} eq 'OK'; |
2969 |
push @reservable, $other_item->itemnumber; |
2967 |
if (@reservable >= @borrowernumbers) { |
2970 |
if (@reservable >= @borrowernumbers) { |
2968 |
$resfound = 0; |
2971 |
$resfound = 0; |
2969 |
last ITEM; |
2972 |
last PATRON; |
2970 |
} |
2973 |
} |
|
|
2974 |
$matched_items{$other_item->itemnumber} = 1; |
2971 |
last; |
2975 |
last; |
2972 |
} |
2976 |
} |
2973 |
$patrons->reset; |
2977 |
$items->reset; |
2974 |
} |
2978 |
} |
2975 |
} |
2979 |
} |
2976 |
} |
2980 |
} |
2977 |
- |
|
|