Lines 31-41
use C4::Members;
Link Here
|
31 |
use C4::Biblio; |
31 |
use C4::Biblio; |
32 |
use C4::Items; |
32 |
use C4::Items; |
33 |
|
33 |
|
34 |
use Date::Calc qw( |
34 |
use DateTime; |
35 |
Today |
35 |
|
36 |
Add_Delta_Days |
|
|
37 |
Date_to_Days |
38 |
); |
39 |
use C4::Reserves; |
36 |
use C4::Reserves; |
40 |
use C4::Koha; |
37 |
use C4::Koha; |
41 |
|
38 |
|
Lines 86-92
my ($reservcount, $overcount);
Link Here
|
86 |
my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch($default); |
83 |
my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch($default); |
87 |
# get reserves for the branch we are logged into, or for all branches |
84 |
# get reserves for the branch we are logged into, or for all branches |
88 |
|
85 |
|
89 |
my $today = Date_to_Days(&Today); |
86 |
my $today = DateTime->now(); |
90 |
foreach my $num (@getreserves) { |
87 |
foreach my $num (@getreserves) { |
91 |
next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00'); |
88 |
next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00'); |
92 |
|
89 |
|
Lines 106-118
foreach my $num (@getreserves) {
Link Here
|
106 |
my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'}); |
103 |
my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'}); |
107 |
my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); # using the fixed up itype/itemtype |
104 |
my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); # using the fixed up itype/itemtype |
108 |
$getreserv{'waitingdate'} = $num->{'waitingdate'}; |
105 |
$getreserv{'waitingdate'} = $num->{'waitingdate'}; |
109 |
my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'}); |
106 |
|
110 |
( $waiting_year, $waiting_month, $waiting_day ) = |
107 |
my $lastpickupdate = C4::Reserves::_reserve_last_pickup_date( $num ); |
111 |
Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day, |
|
|
112 |
C4::Context->preference('ReservesMaxPickUpDelay')); |
113 |
my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day ); |
114 |
|
108 |
|
115 |
$getreserv{'itemtype'} = $itemtypeinfo->{'description'}; |
109 |
$getreserv{'itemtype'} = $itemtypeinfo->{'description'}; |
|
|
110 |
$getreserv{'lastpickupdate'} = C4::Dates->new($lastpickupdate->ymd(), 'iso')->output(); |
116 |
$getreserv{'title'} = $gettitle->{'title'}; |
111 |
$getreserv{'title'} = $gettitle->{'title'}; |
117 |
$getreserv{'biblionumber'} = $gettitle->{'biblionumber'}; |
112 |
$getreserv{'biblionumber'} = $gettitle->{'biblionumber'}; |
118 |
$getreserv{'barcode'} = $gettitle->{'barcode'}; |
113 |
$getreserv{'barcode'} = $gettitle->{'barcode'}; |
Lines 132-138
foreach my $num (@getreserves) {
Link Here
|
132 |
$getreserv{'borrowermail'} = $getborrower->{'emailaddress'}; |
127 |
$getreserv{'borrowermail'} = $getborrower->{'emailaddress'}; |
133 |
} |
128 |
} |
134 |
|
129 |
|
135 |
if ($today > $calcDate) { |
130 |
if ( DateTime->compare( $today,$lastpickupdate ) == 1 ) { #If today is bigger than lastpickupdate, pickup time has expired |
136 |
if ($cancelall) { |
131 |
if ($cancelall) { |
137 |
my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); |
132 |
my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); |
138 |
push @cancel_result, $res if $res; |
133 |
push @cancel_result, $res if $res; |