From: Jason Etheridge Date: Mon, 11 Mar 2013 19:27:30 +0000 (-0400) Subject: skip xulG.get_barcode if no barcode completion X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f0a77f66e303df4c76a952edb887b9dada9968df;p=evergreen%2Fequinox.git skip xulG.get_barcode if no barcode completion For Check In and Check Out interfaces, skip the xulG.get_barcode call if there are no active Barcode Completion entries (under Admin->Local Administration-> Barcode Completion) at the time of the staff client login sequence. However, for Check Out, an exception is made if the "Load patron from Checkout" library setting is in effect, since that functionality depends on xulG.get_barcode. Signed-off-by: Jason Etheridge Signed-off-by: Thomas Berezansky --- diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index fc17229959..74c8793448 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -646,6 +646,27 @@ OpenILS.data.prototype = { this.chain.push( function() { var f = gen_fm_retrieval_func( + 'cbc', + [ + api.FM_CBC_PCRUD_SEARCH.app, + api.FM_CBC_PCRUD_SEARCH.method, + [ obj.session.key, {"active":"t"}, {"order_by":{"cbc":"id"}} ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( 'csp', [ api.FM_CSP_PCRUD_SEARCH.app, diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index c661395663..1ff9b252d3 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -230,6 +230,7 @@ var api = { 'FM_BRE_DELETE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record_entry.delete', 'secure' : false }, 'FM_BRE_UNDELETE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record_entry.undelete', 'secure' : false }, 'FM_BRN_FROM_MARCXML' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.marcxml_to_brn', 'secure' : false }, + 'FM_CBC_PCRUD_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.cbc.atomic', 'secure' : false }, 'FM_CBS_RETRIEVE_VIA_PCRUD' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.retrieve.cbs' }, 'FM_CBT_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.billing_type.ranged.retrieve.all', 'secure' : false }, 'FM_CCS_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.config.copy_status.retrieve.all', 'secure' : false }, diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js index 908d4e32f9..816bcc9054 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkin.js +++ b/Open-ILS/xul/staff_client/server/circ/checkin.js @@ -560,16 +560,18 @@ circ.checkin.prototype = { var textbox = obj.controller.view.checkin_barcode_entry_textbox; var async = false; 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(); } - // 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.data.list.cbc.length > 0) { // skip barcode completion lookups if none configured + // Auto-complete the barcode, items only + var barcode_object = xulG.get_barcode(window, 'asset', barcode); + // 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 ); diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js index e8a7169afa..fac74db2bd 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkout.js +++ b/Open-ILS/xul/staff_client/server/circ/checkout.js @@ -610,26 +610,32 @@ circ.checkout.prototype = { if (! (params.barcode||params.noncat)) { return; } if (params.barcode) { - // Default is "just items" - var barcode_context = 'asset'; - // Add actor (can be any string that includes 'actor') if looking up patrons at checkout - if(String( obj.data.hash.aous['circ.staff_client.actor_on_checkout'] ) == 'true') - barcode_context += '-actor'; - // Auto-complete the barcode - var in_barcode = xulG.get_barcode(window, barcode_context, params.barcode); - // user_false is "None of the above selected", don't error out/fall through as they already said no - if(in_barcode == "user_false") return; - // We have a barcode and there was no error? - if(in_barcode && typeof in_barcode.ilsevent == 'undefined') { - // Check if it was an actor barcode (will never happen unless actor was added above) - if(in_barcode.type == 'actor') { - // Go to new patron (do not pass go, do not collect $200, do not prompt user) - var horizontal_interface = String( obj.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true'; - var loc = xulG.url_prefix( horizontal_interface ? 'XUL_PATRON_HORIZ_DISPLAY' : 'XUL_PATRON_DISPLAY' ); - xulG.set_tab( loc, {}, { 'barcode' : in_barcode.barcode } ); - return; + var actor_on_checkout = String( + obj.data.hash.aous['circ.staff_client.actor_on_checkout'] + ) == 'true'; + // skip barcode completion lookups if we can + if (actor_on_checkout || obj.data.list.cbc.length > 0) { + // Default is "just items" + var barcode_context = 'asset'; + // Add actor (can be any string that includes 'actor') if looking up patrons at checkout + if(actor_on_checkout) + barcode_context += '-actor'; + // Auto-complete the barcode + var in_barcode = xulG.get_barcode(window, barcode_context, params.barcode); + // user_false is "None of the above selected", don't error out/fall through as they already said no + if(in_barcode == "user_false") return; + // We have a barcode and there was no error? + if(in_barcode && typeof in_barcode.ilsevent == 'undefined') { + // Check if it was an actor barcode (will never happen unless actor was added above) + if(in_barcode.type == 'actor') { + // Go to new patron (do not pass go, do not collect $200, do not prompt user) + var horizontal_interface = String( obj.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true'; + var loc = xulG.url_prefix( horizontal_interface ? 'XUL_PATRON_HORIZ_DISPLAY' : 'XUL_PATRON_DISPLAY' ); + xulG.set_tab( loc, {}, { 'barcode' : in_barcode.barcode } ); + return; + } + params.barcode = in_barcode.barcode; } - params.barcode = in_barcode.barcode; } if ( obj.test_barcode(params.barcode) ) { /* good */ } else { /* bad */ return; }