From 7001d89f8528783fadfa948801c0d1db3be0a65a Mon Sep 17 00:00:00 2001 From: Daniel Pearl Date: Wed, 12 Dec 2018 12:51:07 -0500 Subject: [PATCH] LP#1029601: Prevent duplicate holds from double clicks Double clicking on hold submit buttons causes multiple holds to be generated. This commits adds code to disable the Submit button(s) after the first click, so subsequent clicks don't "work" in unintended ways. Signed-off-by: Dan Pearl Signed-off-by: Jeff Davis Signed-off-by: Jason Stephenson --- Open-ILS/src/templates/opac/parts/place_hold_result.tt2 | 14 +++++++++++--- Open-ILS/web/js/ui/default/opac/holds-validation.js | 7 ++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 b/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 index b2513a6a47..009145aeb2 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 @@ -6,10 +6,18 @@ + +

[% l('Place Hold') %]

-
+ [% FOR k IN ctx.orig_params.keys %] @@ -85,7 +93,7 @@ ); [% END %] - + [% ELSIF hdata.hold_failed; any_failures = 1 %]
[% l("Hold was not successfully placed"); %]
@@ -133,7 +141,7 @@ [% |l %]You have permission to override some of the failed holds. Click Submit to override and place your hold on the selected items.[% END %]
- diff --git a/Open-ILS/web/js/ui/default/opac/holds-validation.js b/Open-ILS/web/js/ui/default/opac/holds-validation.js index 7345e3fca9..688d5dad93 100644 --- a/Open-ILS/web/js/ui/default/opac/holds-validation.js +++ b/Open-ILS/web/js/ui/default/opac/holds-validation.js @@ -75,7 +75,12 @@ function confirmMultipleHolds() { function validateHoldForm() { var res = validateMethodSelections(document.getElementsByClassName("hold-alert-method")); if (res.isValid) { - return confirmMultipleHolds(); + var result = confirmMultipleHolds(); + if (result) { + var submit_element = document.getElementById("place_hold_submit"); + submit_element.disabled = true; + } + return result; } else { alert(eg_opac_i18n.EG_MISSING_REQUIRED_INPUT); res.culpritNames.forEach(function(n){ -- 2.11.0