From 945b39e01bbd736d6bffd53119347f7655a19874 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 14 Feb 2012 13:49:54 -0500 Subject: [PATCH] Bug 4054 - Double-clicking the 'place hold' button can result in duplicate holds - Part 2: OPAC This commit adds a new jquery function to functions.js, preventDoubleFormSubmit(). When used thusly: $('#form-id').preventDoubleFormSubmit(); It will prevent a submitted form from being submitted a second time. This commit uses said function to prevent double processing a hold request from the opac. Signed-off-by: Liz Rea Rapid clicking on the place hold button no longer causes duplicate holds! Passes prove t xt t/db_dependent in line with current master. Signed-off-by: Paul Poulain --- koha-tmpl/opac-tmpl/prog/en/js/script.js | 9 +++++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/js/script.js b/koha-tmpl/opac-tmpl/prog/en/js/script.js index 76a6c9196c..6859a74efa 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/script.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/script.js @@ -72,3 +72,12 @@ YAHOO.util.Event.onContentReady("listsmenu", function () { YAHOO.util.Event.addListener("listsmenulink", "click", listMenu.show, null, listMenu); YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionlistMenu); }); + +jQuery.fn.preventDoubleFormSubmit = function() { + jQuery(this).submit(function() { + if (this.beenSubmitted) + return false; + else + this.beenSubmitted = true; + }); +}; diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index 7e2683a5f7..bfe59fe0b3 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -15,6 +15,8 @@ } $(document).ready(function() { + $('#hold-request-form').preventDoubleFormSubmit(); + var copiesRowId = null; var wasSpecific = false; var lastCopiesRowId = null; @@ -226,7 +228,7 @@ [% END %] -
+ -- 2.39.5