Merge branch 'master' of git.evergreen-ils.org:Evergreen into template-toolkit-opac
[evergreen-equinox.git] / Open-ILS / xul / staff_client / server / circ / checkin.js
index 9a36d7e..75c1edb 100644 (file)
@@ -509,13 +509,17 @@ circ.checkin.prototype = {
             var async_checkbox = document.getElementById('async_checkin');
             if (async_checkbox) { async = async_checkbox.getAttribute('checked') == 'true'; }
             var barcode = textbox.value;
+            // Auto-complete the barcode, items only
+            var barcode_object = xulG.get_barcode(window, 'asset', barcode);
             if (async) {
                 textbox.value = ''; textbox.focus();
             }
-            if (!barcode) return;
-            if (barcode) {
-                if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
-            }
+            // user_false means the user selected "None of the above", abort before other prompts/errors
+            if(barcode_object == "user_false") return;
+            // Got a barcode without an error? Use it. Otherwise fall through.
+            if(barcode_object && typeof barcode_object.ilsevent == 'undefined')
+                barcode = barcode_object.barcode;
+            if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
             var placeholder_item = new acp();
             placeholder_item.barcode( barcode );
             var row_params = obj.list.append( {