From deb1c105909e2bb4cc72c81236ade8ab48786595 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. --- cataloguing/value_builder/dateaccessioned.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl index 5fc1c45..2425965 100755 --- a/cataloguing/value_builder/dateaccessioned.pl +++ b/cataloguing/value_builder/dateaccessioned.pl @@ -42,13 +42,13 @@ 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 ) { 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.1.4