JBAS-1736 Prevent barcode changes on items in controlled statuses
authorBill Erickson <berickxx@gmail.com>
Fri, 17 Feb 2017 21:14:31 +0000 (16:14 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Disable barcode edit text input when a copy is in a non-editable
status in the "Update Items" and "Create Or Re-Barcode Items" interfaces.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/xul/staff_client/server/cat/update_items.js
Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js

index 030a439..7d2ab02 100644 (file)
@@ -729,6 +729,7 @@ g.render_volume_copies = function(barcode_column,acn_id,count,ou_id,row) {
         for (var i = 0; i < count; i++) {
 
             var status_string = g.org_label_existing_copy_map[ ou_id ][ acn_id ][i].status_string;
+            var status_id = g.org_label_existing_copy_map[ ou_id ][ acn_id ][i].status();
 
             var barcode_node;
             var barcode_textbox;
@@ -748,6 +749,13 @@ g.render_volume_copies = function(barcode_column,acn_id,count,ou_id,row) {
                 barcode_textbox.width = barcode_width;
                 set_handlers = true;
 
+                // JBAS-1736
+                // prevent barcode changes for items in non-editable statuses
+                barcode_textbox.disabled = (
+                    my_constants.magical_statuses[status_id] &&
+                    my_constants.magical_statuses[status_id].disable_in_copy_editor
+                );
+
                 // Make status
                 status_node = document.createElement('hbox');
                 status_column.appendChild(status_node);
index 950488f..29e0522 100644 (file)
@@ -751,7 +751,18 @@ g.render_barcode_entry = function(node,callnumber_composite_key,count,ou_id) {
             tb.setAttribute('rel_vert_pos',rel_vert_pos_barcode);
             part_menu.firstChild.setAttribute('rel_vert_pos',rel_vert_pos_part);
             if (!tb.value && g.org_label_existing_copy_map[ ou_id ]) {
-                tb.value = g.org_label_existing_copy_map[ ou_id ][ callnumber_composite_key ][i].barcode();
+                var copything = g.org_label_existing_copy_map[ ou_id ][ callnumber_composite_key ][i];
+                tb.value = copything.barcode();
+
+                // JBAS-1736
+                // prevent barcode changes for items in non-editable statuses
+                var stat = copything.status();
+                if (typeof stat == 'object') stat = stat.id();
+                tb.disabled = (
+                    my_constants.magical_statuses[stat] &&
+                    my_constants.magical_statuses[stat].disable_in_copy_editor
+                );
+
                 tb.setAttribute('acp_id', g.org_label_existing_copy_map[ ou_id ][ callnumber_composite_key ][i].id());
                 var temp_parts = g.org_label_existing_copy_map[ ou_id ][ callnumber_composite_key ][i].parts();
                 temp_parts = util.functional.filter_list(