From 5d4807eb5b003747a146f87ad7550831c9f4104f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 30 Sep 2015 17:49:21 -0400 Subject: [PATCH] JBAS-914 Prevent creation of extra lieitem copies Prevent the API call which creates/modifies copies for a linteitem in the lineitem copy UI from running if one is already in flight. This is done both by disabling the Save Changes button and by checking an internal flag (in case something besides the button is causing the action to run). Signed-off-by: Bill Erickson --- Open-ILS/web/js/ui/default/acq/common/li_table.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 957995cc28..e4c6e74e22 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -2901,6 +2901,14 @@ function AcqLiTable() { if (!this.confirmBreachedCopyFunds(copies)) return; + if (this._savingCopiesInFlight) { + // Save in progress. Get outta here. + return; + } + + this._savingCopiesInFlight = true; + acqLitSaveCopies.attr('disabled', true); + if (typeof(this._copy_count_cb) == "function") this._copy_count_cb(liId, total); @@ -2917,6 +2925,8 @@ function AcqLiTable() { self.drawCopies(liId, true /* force_fetch */); openils.Util.hide("acq-lit-update-copies-progress"); refreshPOSummaryAmounts(); + self._savingCopiesInFlight = false; + acqLitSaveCopies.attr('disabled', false); } } ); -- 2.11.0