From bd197c64567fba6899f12e4897d786adf52384d8 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 10 Jan 2022 04:27:27 +0000 Subject: [PATCH] Bug 29815: Pre-populate 'Date acquired' field when adding/editing items This patch pre-fills the 952$d (Date acquired) item subfield on page load. Users can still click on the field to fill this subfield. Test plan: 1. Visit a biblio. Add an item, observe on page load the 'Date acquired' subfield is empty 2. Visit a subscription. Receive a serial, observe after setting the serial status to 'Arrived' the item form loads with an empty 'Date acquired' subfield 3. Apply patch and restart services 4. Repeat step 1 and confirm now on page load the 'Date acquired' subfield populates with today's date 5. Delete the populated 'Date acquired' subfield value. Click in the field and confirm the field is populated and the calendar input displays 6. Delete the 'Date acquired' subfield value again. Confirm that tabbing from a different field into the date acquired field behaves the same as click 7. Repeat step 2. This time confirm on page load the 'Date acquired' subfield contains the current date 8. Delete the populated 'Date acquired' subfield value. Click in the field and confirm it is populated 9. Delete the populated 'Date acquired' subfield value. Tab to the field from another field and confirm it behaves the same as click 10. Visit a biblio. Edit an item with a date acquired value in the past. Confirm the date acquired value is unchanged after saving. Sponsored-By: Brimbank Library, Australia Signed-off-by: Owen Leonard Signed-off-by: Marcel de Rooy Signed-off-by: Fridolin Somers --- cataloguing/value_builder/dateaccessioned.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl index 9d7da193c7..6532d29b07 100755 --- a/cataloguing/value_builder/dateaccessioned.pl +++ b/cataloguing/value_builder/dateaccessioned.pl @@ -37,6 +37,8 @@ my $builder = sub { \$("#$function_name").flatpickr({ dateFormat: "Y-m-d" }); + /* Set current date on page load */ + set_to_today($function_name.id); }); function Focus$function_name(event) { -- 2.39.5