From b42c7b8d44028178ecfc9af2106c5fc3e836bd1d Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Mon, 12 Dec 2016 16:49:44 +0200 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 21ac9fcdc2ca449a491cc79e68cc854ee248d911) Signed-off-by: Katrin Fischer (cherry picked from commit 090f2885b7a910ee84212fa5bb0141611121eb77) Signed-off-by: Julian Maurice --- C4/Circulation.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index ed64fe53b8..5639f3c9c2 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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'), -- 2.39.5