Bug 16387: Fix default shortened loan period time

When a loan period is shortened due to using decreaseLoanHighHolds* the time is
always set to the current time in X days, even if the original loan period is
given in days and not in hours.

It should default to 23:59 as is normal for loan periods given in days.

As original due date time defaults to 23:59 when given in days, this patch
modifies the hours and minutes of shortened due date to be equal to original due
date.

To test:
1. prove t/db_dependent/DecreaseLoanHighHolds.t

Signed-off-by: Grace McKenzie <grace.mcky@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 21ac9fcdc2)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit 090f2885b7)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Lari Taskula 2016-12-12 16:49:44 +02:00 committed by Julian Maurice
parent ab135c07aa
commit b42c7b8d44
1 changed files with 4 additions and 0 deletions

View File

@ -1201,6 +1201,10 @@ sub checkHighHolds {
$calendar->addDate( $issuedate,
C4::Context->preference('decreaseLoanHighHoldsDuration') );
$reduced_datedue->set_hour($orig_due->hour);
$reduced_datedue->set_minute($orig_due->minute);
$reduced_datedue->truncate( to => 'minute' );
if ( DateTime->compare( $reduced_datedue, $orig_due ) == -1 ) {
return ( 1, $holds,
C4::Context->preference('decreaseLoanHighHoldsDuration'),