kmain-1403: Send focus back to top after scanning barcode
authorBill Erickson <berickxx@gmail.com>
Wed, 29 Oct 2014 21:10:47 +0000 (17:10 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
    Cross-port: 555a899

Open-ILS/xul/staff_client/server/cat/update_items.js

index 998c350..82cc79c 100644 (file)
@@ -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();