From cbbdabf71de1ffd84462fc9d15ffb8b2f9d8b3d6 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 17 Feb 2017 16:14:31 -0500 Subject: [PATCH] JBAS-1736 Prevent barcode changes on items in controlled statuses 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 --- Open-ILS/xul/staff_client/server/cat/update_items.js | 8 ++++++++ Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Open-ILS/xul/staff_client/server/cat/update_items.js b/Open-ILS/xul/staff_client/server/cat/update_items.js index 030a4392ee..7d2ab02f66 100644 --- a/Open-ILS/xul/staff_client/server/cat/update_items.js +++ b/Open-ILS/xul/staff_client/server/cat/update_items.js @@ -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); diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js index 950488ffd1..29e0522ed5 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js @@ -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( -- 2.11.0