From 030fdef06518f6ceb09430944cd9121a12f3102e Mon Sep 17 00:00:00 2001 From: pines Date: Thu, 12 Oct 2006 22:04:37 +0000 Subject: [PATCH] Bill's circ details method. much faster++ git-svn-id: svn://svn.open-ils.org/ILS/trunk@6464 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/main/constants.js | 1 + Open-ILS/xul/staff_client/server/patron/items.js | 70 ++++++---------------- 2 files changed, 19 insertions(+), 52 deletions(-) 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 caa96ab5f9..411c8a8098 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -106,6 +106,7 @@ const api = { 'FM_BRE_ID_SEARCH_VIA_TCN' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.tcn' }, 'FM_BRN_FROM_MARCXML' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.marcxml_to_brn' }, 'FM_CCS_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.config.copy_status.retrieve.all' }, + 'FM_CIRC_DETAILS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.fleshed.retrieve' }, 'FM_CIRC_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.retrieve' }, /*'FM_CIRC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.actor.user.checked_out.slim' },*/ 'FM_CIRC_IN_WITH_FINES_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_in_with_fines' }, diff --git a/Open-ILS/xul/staff_client/server/patron/items.js b/Open-ILS/xul/staff_client/server/patron/items.js index 09a1a117f3..95ea23aea5 100644 --- a/Open-ILS/xul/staff_client/server/patron/items.js +++ b/Open-ILS/xul/staff_client/server/patron/items.js @@ -487,63 +487,29 @@ patron.items.prototype = { return row; } - var funcs = []; - - funcs.push( - function() { - row.my.circ = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_ID',[ ses(), row.my.circ_id ]); - } - ); - - if (!row.my.mvr) funcs.push( - function() { - - row.my.mvr = obj.network.request( - api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.app, - api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.method, - [ row.my.circ.target_copy() ] - ); - - } - ); - if (!row.my.acp) { - funcs.push( - function() { - - row.my.acp = obj.network.request( - api.FM_ACP_RETRIEVE.app, - api.FM_ACP_RETRIEVE.method, - [ row.my.circ.target_copy() ] - ); - - params.row_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':row.my.circ.target_copy(),'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': (typeof row.my.mvr.ilsevent == 'undefined' ? row.my.mvr.doc_id() : null )}) ); - - } - ); - } else { - params.row_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':row.my.circ.target_copy(),'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': ( typeof row.my.mvr.ilsevent == 'undefined' ? row.my.mvr.doc_id() : null) }) ); - } - - funcs.push( - function() { - - if (typeof params.on_retrieve == 'function') { - params.on_retrieve(row); + obj.network.simple_request( + 'FM_CIRC_DETAILS', + [ row.my.circ_id ], + function(req) { + try { + var robj = req.getResultObject(); + row.my.circ = robj.circ; + row.my.acp = robj.copy; + row.my.mvr = robj.mvr; + row.my.acn = robj.volume; + + params.row_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':row.my.circ.target_copy(),'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': (robj.record ? robj.record.id() : null) }) ); + + if (typeof params.on_retrieve == 'function') { + params.on_retrieve(row); + } + } catch(E) { + obj.error.standard_unexpected_error_alert('circ details',E); } - } ); - JSAN.use('util.exec'); var exec = new util.exec(); - exec.on_error = function(E) { - //var err = 'items chain: ' + js2JSON(E); - //obj.error.sdump('D_ERROR',err); - return true; /* keep going */ - } - exec.chain( funcs ); - return row; - } JSAN.use('util.list'); obj.list = new util.list('items_list'); -- 2.11.0