When editing cards, lock tab on apply changes
authorThomas Berezansky <tsbere@mvlc.org>
Tue, 1 Nov 2011 18:00:46 +0000 (14:00 -0400)
committerJason Etheridge <jason@esilibrary.com>
Thu, 1 Dec 2011 20:59:36 +0000 (15:59 -0500)
Hopefully to prevent people from moving away before saving.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/web/js/ui/default/actor/user/register.js

index a29920a..56b7261 100644 (file)
@@ -394,6 +394,7 @@ function drawAllCards() {
 
 function applyCardChanges() {
     var cardrows = dojo.query('[cardid]', allCardsDialog.domNode);
+    var changed = false;
     dojo.forEach(cardrows,
         function(row) {
             if(cardPerms['UPDATE_PATRON_ACTIVE_CARD']) {
@@ -401,15 +402,21 @@ function applyCardChanges() {
                 if(row.card.active() != active) {
                     row.card.active(active);
                     row.card.ischanged(1);
+                    changed = true;
                 }
             }
             if(cardPerms['UPDATE_PATRON_PRIMARY_CARD']) {
                 if(row.primary_radiobutton.checked && row.card.id() != patron.card().id()) {
                     patron.card(row.card);
+                    changed = true;
                 }
             }
         }
     );
+    if(changed && lock_ready && xulG && typeof xulG.lock_tab == 'function' && !already_locked) {
+        xulG.lock_tab();
+        already_locked = true;
+    }
     allCardsDialog.hide();
 }