diff --git a/C4/Circulation.pm b/C4/Circulation.pm index bbff8ae862..49bd7b2e82 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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); + } } } diff --git a/t/db_dependent/rollingloans.t b/t/db_dependent/rollingloans.t index 9535ff5c16..af9e454267 100644 --- a/t/db_dependent/rollingloans.t +++ b/t/db_dependent/rollingloans.t @@ -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'); }