Bug 5549 : Daily loans should be due at 23:59

This was failing in one patch through CalcDueDate
This commit is contained in:
Colin Campbell 2011-06-23 14:11:48 +01:00 committed by Chris Cormack
parent 791fe1bbd7
commit 7a8bed5576
2 changed files with 9 additions and 1 deletions

View file

@ -2838,6 +2838,10 @@ sub CalcDateDue {
}
my $calendar = Koha::Calendar->new( branchcode => $branch );
$datedue = $calendar->addDate( $startdate, $dur, $loanlength->{lengthunit} );
if ($loanlength->{lengthunit} eq 'days') {
$datedue->set_hour(23);
$datedue->set_minute(59);
}
}
}

View file

@ -6,7 +6,7 @@ use C4::Context;
use C4::Circulation;
use C4::Members;
use Test::More tests => 6;
use Test::More tests => 8;
C4::Context->_new_userenv(1234567);
C4::Context->set_userenv(91, 'CLIstaff', '23529001223661', 'CPL',
'CPL', 'CPL', '', 'cc@cscnet.co.uk');
@ -20,6 +20,10 @@ my $test_item_48 = '502326000403';
for my $item_barcode ( $test_item_fic, $test_item_24, $test_item_48) {
my $duedate = try_issue($test_patron, $item_barcode);
isa_ok($duedate, 'DateTime');
if ($item_barcode eq $test_item_fic) {
is($duedate->hour(), 23, "daily loan hours = 23");
is($duedate->minute(), 59, "daily loan mins = 59");
}
my $ret_ok = try_return($item_barcode);
is($ret_ok, 1, 'Return succeeded');
}