From 931dd700704005f9d583d152765bab50730dc46c Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 3 Feb 2023 11:58:51 +0100 Subject: [PATCH] Bug 32821: Fix cataloguing/value_builder/stocknumber.pl Use event parameter This is part of the refactoring happening in bug 30975 Test plan: 1. Verify that the plugin continues to work as before Signed-off-by: Owen Leonard Signed-off-by: Kyle M Hall --- cataloguing/value_builder/stocknumber.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cataloguing/value_builder/stocknumber.pl b/cataloguing/value_builder/stocknumber.pl index 03dc79de06..51d7a1986c 100755 --- a/cataloguing/value_builder/stocknumber.pl +++ b/cataloguing/value_builder/stocknumber.pl @@ -39,15 +39,19 @@ my $builder = sub { my $js = < -function Focus$function_name(id, force) { +function set_stocknumber(id, force) { if (\$('#' + id).val() == '' || force) { \$('#' + id).val('$nextnum'); } } +function Focus$function_name(event) { + set_stocknumber(event.data.id, false); +} + function Click$function_name(event) { - Focus$function_name(event.data.id, 1); - return false; + event.preventDefault(); + set_stocknumber(event.data.id, true); } END_OF_JS -- 2.30.2