From d66bae83b17bd9fd2a8e5187d629652dfb6a7b21 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 29 Oct 2014 17:10:47 -0400 Subject: [PATCH] kmain-1403: Send focus back to top after scanning barcode Cross-port: 555a899 --- Open-ILS/xul/staff_client/server/cat/update_items.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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 998c350c0f..82cc79c3bf 100644 --- a/Open-ILS/xul/staff_client/server/cat/update_items.js +++ b/Open-ILS/xul/staff_client/server/cat/update_items.js @@ -14,9 +14,11 @@ g.map_acn = {}; g.volumes_by_ou = {}; g.acpl_list = []; + // This file was modeled off of volume_copy_creator.js, so if you need // functionality back, take it from there function my_init() { + g.totalRows = 0; try { /* Initial setup */ @@ -778,18 +780,18 @@ g.render_volume_copies = function(barcode_column,acn_id,count,ou_id,row) { note_textbox.setAttribute('rel_vert_pos',rel_vert_pos_copy_note); note_node.appendChild(note_textbox); } - + g.totalRows ++; barcode_textbox.setAttribute('acn_id',acn_id); barcode_textbox.setAttribute('ou_id',ou_id); barcode_textbox.setAttribute('callkey',acn_id); barcode_textbox.setAttribute('rel_vert_pos',rel_vert_pos_barcode); - + barcode_textbox.setAttribute('id', "barcode" + g.totalRows); if (!barcode_textbox.value && g.org_label_existing_copy_map[ ou_id ] && g.org_label_existing_copy_map[ ou_id ][ acn_id ] && g.org_label_existing_copy_map[ ou_id ][ acn_id ].length > i) { barcode_textbox.value = g.org_label_existing_copy_map[ ou_id ][ acn_id ][i].barcode(); - barcode_textbox.setAttribute('acp_id', g.org_label_existing_copy_map[ ou_id ][ acn_id ][i].id()); + barcode_textbox.setAttribute('acp_id', g.org_label_existing_copy_map[ ou_id ][ acn_id ][i].id()); barcode_textbox.select(); @@ -833,6 +835,13 @@ g.render_volume_copies = function(barcode_column,acn_id,count,ou_id,row) { }, false); barcode_textbox.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false ); + + barcode_textbox.addEventListener( 'keypress', function(ev) { + var key = ev.which || ev.keyCode; + if (key == 13 && this.id == "barcode" + g.totalRows){ + document.getElementById("barcode1").focus(); + } + }, false ); } } @@ -1501,6 +1510,7 @@ g.render_lineitem_dropdown = function() { menulist.addEventListener( 'command', function(ev) { + g.totalRows = 0; g.first_focus = null; g.current_lineitem_index = menulist.getIndexOfItem( menulist.selectedItem ); g.reset_lineitem(); -- 2.11.0