From 69b472651ca3dab906fd7447c9bfb95716b46e10 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 10 Nov 2017 12:59:58 +0000 Subject: [PATCH] Bug 19595: Clicking plugin link does not fill item's date acquired field This patch updates the dateaccessioned plugin for the item edit form to return functionality which was removed in a previous patch. To test, apply the patch and open an item for editing. Clicking the "..." link next to the "Date acquired" field should insert the current date, overwriting the existing date. Open a blank item add form. Putting the cursor in the "Date acquired" field should automatically insert the current date. Signed-off-by: Marcel de Rooy Added a comment line in set_to_today. Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens (cherry picked from commit 18897829e4bd585d5adb16681ce6dd648b368c66) Signed-off-by: Fridolin Somers --- cataloguing/value_builder/dateaccessioned.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl index 5fc1c452e6..7a86e2d67c 100755 --- a/cataloguing/value_builder/dateaccessioned.pl +++ b/cataloguing/value_builder/dateaccessioned.pl @@ -42,13 +42,14 @@ function Focus$function_name(event) { } function Click$function_name(event) { - set_to_today(event.data.id); + set_to_today(event.data.id, 1); return false; // prevent page scroll } -function set_to_today( id ) { +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; } - if (\$("#" + id).val() == '' || \$("#" + id).val() == '0000-00-00' ) { + if (\$("#" + id).val() == '' || \$("#" + id).val() == '0000-00-00' || force ) { \$("#" + id).val("$date"); } } -- 2.39.5