make unified vol/copy editor honor required stat cats
authorJason Etheridge <jason@esilibrary.com>
Wed, 1 Jun 2011 20:25:50 +0000 (16:25 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 7 Jun 2011 20:41:03 +0000 (16:41 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/xul/staff_client/server/cat/copy_editor.js
Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js

index 0ce4db1..0602c09 100644 (file)
@@ -1587,10 +1587,22 @@ g.check_for_unmet_required_fields = function() {
             abort.push(fn);
         }
     }
-    if (abort.length > 0) {
-        $('save').setAttribute('disabled','true'); 
+    if (xulG.unified_interface) {
+        if (abort.length > 0) {
+            if (typeof xulG.lock_save_button == 'function') {
+                xulG.lock_save_button();
+            }
+        } else {
+            if (typeof xulG.unlock_save_button == 'function') {
+                xulG.unlock_save_button();
+            }
+        }
     } else {
-        $('save').setAttribute('disabled','false'); 
+        if (abort.length > 0) {
+            $('save').setAttribute('disabled','true');
+        } else {
+            $('save').setAttribute('disabled','false');
+        }
     }
 }
 
index d9c2b2c..303cea0 100644 (file)
@@ -54,6 +54,14 @@ function my_init() {
                     },0
                 );
             }
+            xulG.lock_save_button = function() {
+                g.save_button_locked = true;
+                document.getElementById("Create").disabled = true;
+            }
+            xulG.unlock_save_button = function() {
+                g.save_button_locked = false;
+                document.getElementById("Create").disabled = false;
+            }
         } else {
             $('Create').hidden = true;
         }
@@ -359,7 +367,9 @@ g.render_callnumber_copy_count_entry = function(row,ou_id,count) {
             document.getElementById("EditThenCreate").disabled = false;
             document.getElementById("CreateWithDefaults").disabled = false;
         } else {
-            document.getElementById("Create").disabled = false;
+            if (! g.save_button_locked) {
+                document.getElementById("Create").disabled = false;
+            }
         }
     }
 
@@ -668,7 +678,9 @@ g.render_barcode_entry = function(node,callnumber_composite_key,count,ou_id) {
                 document.getElementById("EditThenCreate").disabled = false;
                 document.getElementById("CreateWithDefaults").disabled = false;
             } else {
-                document.getElementById("Create").disabled = false;
+                if (! g.save_button_locked) {
+                    document.getElementById("Create").disabled = false;
+                }
             }
         }