[open-ils-commits] [GIT] Evergreen ILS branch rel_3_2 updated. 3656d0998e196f7d84cfbf1245b948cd9c656de3

Evergreen Git git at git.evergreen-ils.org
Tue May 21 12:52:42 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_2 has been updated
       via  3656d0998e196f7d84cfbf1245b948cd9c656de3 (commit)
      from  35ea20a2f1bcdd54a0ca50bb28388f0980d22133 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3656d0998e196f7d84cfbf1245b948cd9c656de3
Author: Daniel Pearl <dpearl at cwmars.org>
Date:   Wed Dec 12 12:51:07 2018 -0500

    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 <dpearl at cwmars.org>
    Signed-off-by: Jeff Davis <jdavis at sitka.bclibraries.ca>
    Signed-off-by: Jason Stephenson <jason at sigio.com>

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 @@
 
 <!-- TODO: CSS for big/strong-->
 
+<script>
+function disable_submit() {
+   var submit_element = document.getElementById("place_hold_submit");
+   submit_element.disabled = true;
+   return true;
+};
+</script>
+
 <div id='holds_box' class='canvas' style='margin-top: 6px;'>
     <h1>[% l('Place Hold') %]</h1>
 
-    <form method="post">
+    <form method="post" onsubmit="return disable_submit();">
         <input type="hidden" name="override" value="1" />
         [% FOR k IN ctx.orig_params.keys %]
         <input type="hidden" name="[% k %]" value="[% ctx.orig_params.$k | html %]" />
@@ -85,7 +93,7 @@
                                 );
                             </script>
                         [% END %]
-
+                        
                         [% ELSIF hdata.hold_failed; any_failures = 1 %]
 
                             <div><big><strong>[% l("Hold was not successfully placed"); %]</strong></big></div>
@@ -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 %]
             </div>
             <span style='padding-right: 10px;'>
-                <input type="submit" name="submit" value="[% l('Submit') %]"
+                <input id="place_hold_submit" type="submit" name="submit" value="[% l('Submit') %]"
                     title="[% l('Submit') %]" alt="[% l('Submit') %]"
                     class="opac-button" />
             </span>
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){

-----------------------------------------------------------------------

Summary of changes:
 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(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list