Bug 8735 - Expire holds waiting only on days the library is open - Followup - Switch from C4::Calendar to Koha::Calendar
Test Plan:
1) Set ExpireReservesMaxPickUpDelay
2) Set ReservesMaxPickUpDelay to 1
3) Place a hold, set it to waiting
4) Using the MySQL console, modify the waiting date and set it to the
day before yesterday.
5) Set today as a holiday for the pickup branch in question.
6) Run misc/cronjobs/holds/cancel_expired_holds.pl
7) The hold should remain unchanged
8) Remove today as a holiday
9) Run misc/cronjobs/holds/cancel_expired_holds.pl again
10) The hold should now be canceled
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
3b092a899f
commit
3c1f7dae0a
|
|
@ -36,9 +36,9 @@ use C4::Members qw();
|
|||
use C4::Letters;
|
||||
use C4::Branch qw( GetBranchDetail );
|
||||
use C4::Dates qw( format_date_in_iso );
|
||||
use C4::Calendar;
|
||||
|
||||
use Koha::DateUtils;
|
||||
use Koha::Calendar;
|
||||
|
||||
use List::MoreUtils qw( firstidx );
|
||||
|
||||
|
|
@ -982,7 +982,7 @@ sub CancelExpiredReserves {
|
|||
my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
|
||||
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
|
||||
|
||||
my $today = C4::Dates->new();
|
||||
my $today = dt_from_string();
|
||||
|
||||
my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
|
||||
$sth = $dbh->prepare( $query );
|
||||
|
|
@ -991,8 +991,8 @@ sub CancelExpiredReserves {
|
|||
while ( my $res = $sth->fetchrow_hashref ) {
|
||||
my $do_cancel = 1;
|
||||
unless ( $cancel_on_holidays ) {
|
||||
my $calendar = C4::Calendar->new( branchcode => $res->{'branchcode'} );
|
||||
my $is_holiday = $calendar->isHoliday( split( '/', $today->output('metric') ) );
|
||||
my $calendar = Koha::Calendar->new( branchcode => $res->{'branchcode'} );
|
||||
my $is_holiday = $calendar->is_holiday( $today );
|
||||
|
||||
if ( $is_holiday ) {
|
||||
$do_cancel = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue