From 08a74d6a5fb901e56002146ab953b22e01ea04eb Mon Sep 17 00:00:00 2001 From: Petro Vashchuk Date: Thu, 2 Jun 2022 14:47:39 +0300 Subject: [PATCH] Bug 29963: remove set_to_today function from dateaccessioned.pl Removed the function that wasn't used anywhere outside of dateaccessioned.pl, as it was causing inconveniences when user was trying to edit items in batch, it would constantly set Date Acquired field to today's date which created the need for user to constantly manually clear the field, so that it doesn't overwrite the original Acquired date. When you add item without specifying any date for Date Acquired it automatically sets the today's date for it so this change doesn't seem to break any logic there. And when you try to edit item with already set Date Acquired before it will show the previously defined date, not disrupting anything here as well. To reproduce: 1. Edit items in batch for any biblio, see that "d - Date acquired" field is automatically set to current day's date. 2. Apply the patch 3. "d - Date acquired" should be empty after that. 4. Additionally, go to the additem.pl to edit single item and check that it correctly shows Date acquired in that field. --- cataloguing/value_builder/dateaccessioned.pl | 21 -------------------- 1 file changed, 21 deletions(-) diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl index 2f027c8e9a..9575274bb7 100755 --- a/cataloguing/value_builder/dateaccessioned.pl +++ b/cataloguing/value_builder/dateaccessioned.pl @@ -41,28 +41,7 @@ my $builder = sub { altInputClass: "input_marceditor flatpickr-input", dateFormat: "Y-m-d" }); - /* Set current date on page load */ - set_to_today($function_name.id); }); - -function Focus$function_name(event) { - set_to_today(event.data.id); -} - -function Click$function_name(event) { - event.preventDefault(); - set_to_today(event.data.id, 1); -} - -function set_to_today( id, force ) { - /* The force parameter is used in Click but not in Focus ! */ - if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; } - var elt = document.querySelector("#" + id); - if ( elt.value == '' || force ) { - const fp = document.querySelector("#" + id)._flatpickr; - fp.setDate(new Date()); - } -} END_OF_JS return $res; -- 2.35.3