From eb0062227ec8cf1bf6b2ce6c8704507cc5e228d6 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sat, 29 Jun 2024 22:52:42 +0000 Subject: [PATCH] Bug 37183: Batch edit serial subscriptions sets expiration date to today Test plan: Add some serials: 1) Add a new serial, visit: /cgi-bin/koha/serials/subscription-add.pl 2) Put a biblionumber in the 'record' field, e.g. '112'. Press 'next' and click 'ok' on the alert box. 3) Fill all the required fields and click 'test prediction'. 4) Fill the Subscription end date (= Expiration Date). 5) Click 'save subscription'. 6) Repeat steps 1-5 to create a second serial. Batch edit serials: 1) Visit serials and hit the 'Search' button: /cgi-bin/koha/serials/serials-home.pl 2) Click the 2 checkboxes for the 2 serials we created previously and click the new link that pops up 'Edit selected serials'. 3) Click 'Save' without changing anything. 4) Go back to either of the serials, notice the value for Expiration date is changed to TODAY (the date of the batch edit). Apply the patch and retest the batch editing (before retesting, change the expiration dates of the two serials back to the original expiration date). Note that the expiration date now only changes if you enter a date in the 'Expiration date' field. Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit 5a07a04fdb23aa13f85df64b1f2a4739397f5f28) Signed-off-by: Lucas Gass (cherry picked from commit 1955ec2a7dbbe02c0c9351b5ca95a0ba4aea672e) Signed-off-by: Fridolin Somers --- serials/subscription-batchedit.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/serials/subscription-batchedit.pl b/serials/subscription-batchedit.pl index 274bcd4f23..5a20bb2bf0 100755 --- a/serials/subscription-batchedit.pl +++ b/serials/subscription-batchedit.pl @@ -61,8 +61,9 @@ if ($batchedit) { notes => scalar $cgi->param('notes'), internalnotes => scalar $cgi->param('internalnotes'), serialsadditems => scalar $cgi->param('serialsadditems'), - enddate => dt_from_string( scalar $cgi->param('enddate') ), ); + # If we convert a blank string we get todays date, we should only convert enddate if it is not blank + $params{'enddate'} = dt_from_string( scalar $cgi->param('enddate') ) if $cgi->param('enddate'); my $field_values = {}; foreach my $field (@available_additional_fields) { -- 2.39.5