fix spurious unsaved data prompt with repeated use of same patron editor (only set...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 21 Jan 2011 16:58:44 +0000 (16:58 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 21 Jan 2011 16:58:44 +0000 (16:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@19247 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/actor/user/register.js

index 472fec8..ceb0e70 100644 (file)
@@ -51,6 +51,7 @@ var dupeBarcode = false;
 
 if(!window.xulG) var xulG = null;
 var lock_ready = false;
+var already_locked = false;
 
 function load() {
     staff = new openils.User().user;
@@ -765,7 +766,10 @@ function attachWidgetEvents(fmcls, fmfield, widget) {
         'onKeyPress',
         function(){
             if (lock_ready && xulG && typeof xulG.lock_tab == 'function') {
-                xulG.lock_tab();
+                if (! already_locked) {
+                    xulG.lock_tab();
+                    already_locked = true;
+                }
             }
         }
     );
@@ -774,7 +778,10 @@ function attachWidgetEvents(fmcls, fmfield, widget) {
         'onChange',
         function(){
             if (lock_ready && xulG && typeof xulG.lock_tab == 'function') {
-                xulG.lock_tab();
+                if (! already_locked) {
+                    xulG.lock_tab();
+                    already_locked = true;
+                }
             }
         }
     );
@@ -1236,7 +1243,10 @@ function _uEditSave(doClone) {
             params: [openils.User.authtoken, patron],
             oncomplete: function(r) {
                 lock_ready = false;
-                if (xulG && typeof xulG.unlock_tab == 'function') { xulG.unlock_tab(); }
+                if (xulG && typeof xulG.unlock_tab == 'function') {
+                    xulG.unlock_tab();
+                    already_locked = false;
+                }
                 newPatron = openils.Util.readResponse(r);
                 if(newPatron) {
                     uEditUpdateUserSettings(newPatron.id());