From 996298340fb7c545559864593d9054369ba2e56d Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 15 Nov 2017 13:03:57 +0000 Subject: [PATCH] Bug 19626: Calculate expiration date for existing holds based on waitingdate To test: 1 - Have/create a 16.11 instance with some waiting holds 2 - Those holds should not have an expirationdate 3 - Make sure some of the holds are waiting longer than ReservesMaxPickupDelay BACKUP THE DB 4 - Upgrade to 17.05 (or later) 5 - Check the expirationdate for the holds 6 - The date wil be in the future (curdate + delay) 7 - Restore DB 8 - Apply patch 9 - Run the upgrade again 10 - expirationdate should now be based on waitingdate Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- installer/data/mysql/updatedatabase.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ec4eee4f49..f12d8d0b95 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -14371,11 +14371,11 @@ if( CheckVersion( $DBversion ) ) { } my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); - my $expirationdate = dt_from_string(); + my $expirationdate = dt_from_string($hold->waitingdate); $expirationdate->add(days => $max_pickup_delay); if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { - $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); + $expirationdate = $calendar->days_forward( dt_from_string($hold->waitingdate), $max_pickup_delay ); } my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; -- 2.39.5