From aff99b295c47cc08e97ff9aaf0f996b7a65e3891 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 7 Oct 2021 14:31:10 +0000 Subject: [PATCH] Bug 29192: Discard changes before logging a newly created hold When logging a newly create hold it can have a dt object in the expiration date field Per bug 28700 this does not get unblessed We add an explicit call to discard changes to avoid logging a blessed datetime To test: 1 - Enable HoldsLog in system preferences 2 - Set system preferences: DefaultHoldExpirationDate: Set DefaultHoldExpirationdatePeriod: 5 DefaultHoldExpirationdateUnitOfTime: days 3 - Create a hold for a patron 4 - Note the expiration date is set 5 - Check the action logs - SELECT * FROM action_logs 6 - Note that there is a lot of data, this is from DateTime object in expirationdate 7 - Apply patch 8 - Restart all 9 - Place another hold 10 - Confirm expiration date set correctly 11 - View the logs 12 - Entry for new hold contains only the date, no extra data --- C4/Reserves.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index f2ee463979..972e31ca2f 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -261,6 +261,7 @@ sub AddReserve { )->store(); $hold->set_waiting() if $found && $found eq 'W'; + $hold->discard_changes(); logaction( 'HOLDS', 'CREATE', $hold->id, Dumper($hold->unblessed) ) if C4::Context->preference('HoldsLog'); -- 2.20.1