From: phasefx Date: Thu, 29 Jun 2006 19:37:20 +0000 (+0000) Subject: async patron search X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c812ab2ec72d0550c401c457d87d7638930bb8a5;p=Evergreen.git async patron search git-svn-id: svn://svn.open-ils.org/ILS/trunk@4850 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list.js b/Open-ILS/xul/staff_client/chrome/content/util/list.js index c954548446..14f906211d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -223,23 +223,26 @@ util.list.prototype = { 'flesh', function() { //dump('fleshing = ' + params.retrieve_id + '\n'); - var row; params.row_node = treeitem; - params.on_retrieve = function(row) { - params.row = row; - obj._map_row_to_treecell(params,treerow); + params.on_retrieve = function(p) { + try { + p.row = params.row; + obj._map_row_to_treecell(p,treerow); + } catch(E) { + alert('fixme2: ' + E); + } } if (typeof params.retrieve_row == 'function') { - row = params.retrieve_row( params ); + params.retrieve_row( params ); } else { if (typeof obj.retrieve_row == 'function') { - row = obj.retrieve_row( params ); + obj.retrieve_row( params ); } } diff --git a/Open-ILS/xul/staff_client/server/patron/search_result.js b/Open-ILS/xul/staff_client/server/patron/search_result.js index 3d86eaab42..80b3bae2d5 100644 --- a/Open-ILS/xul/staff_client/server/patron/search_result.js +++ b/Open-ILS/xul/staff_client/server/patron/search_result.js @@ -39,15 +39,22 @@ patron.search_result.prototype = { 'map_row_to_column' : patron.util.std_map_row_to_column(), 'retrieve_row' : function(params) { var id = params.retrieve_id; - var au_obj = patron.util.retrieve_au_via_id( ses(), id ); - - var row = params.row; - if (typeof row.my == 'undefined') row.my = {}; - row.my.au = au_obj; - if (typeof params.on_retrieve == 'function') { - params.on_retrieve(row); - } - return row; + var au_obj = patron.util.retrieve_au_via_id( ses(), id, + function(req) { + try { + var row = params.row; + if (typeof row.my == 'undefined') row.my = {}; + row.my.au = req.getResultObject(); + if (typeof params.on_retrieve == 'function') { + params.on_retrieve(row); + } else { + alert('typeof params.on_retrieve == ' + typeof params.on_retrieve); + } + } catch(E) { + alert('error: ' + E); + } + } + ); }, 'on_select' : function(ev) { JSAN.use('util.functional'); diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js index d8afadb3c1..f7849b1bd1 100644 --- a/Open-ILS/xul/staff_client/server/patron/util.js +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -373,13 +373,14 @@ patron.util.std_map_row_to_column = function(error_value) { } } -patron.util.retrieve_au_via_id = function(session, id) { +patron.util.retrieve_au_via_id = function(session, id, f) { JSAN.use('util.network'); var network = new util.network(); var patron_obj = network.request( api.FM_AU_RETRIEVE_VIA_ID.app, api.FM_AU_RETRIEVE_VIA_ID.method, - [ session, id ] + [ session, id ], + f ); return patron_obj; }