From b73856b2769e09da2c442250ed02b09d6b8fe987 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 Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 97c050eacb87cc78f8cdfc3a37d240372b164437) Signed-off-by: Martin Renvoize (cherry picked from commit 475871b3a40dd77ddbd487da30e34cdad5deb6cf) Signed-off-by: Lucas Gass (cherry picked from commit cfb990f641557de9ed1656dd07fd071b6c464b52) Signed-off-by: Arthur Suzuki --- 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.39.5