From 8996f7047e1573b1ad0d1560e38536b62b7b947c Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 10 Sep 2010 16:35:37 +0000 Subject: [PATCH] the method behind patron.util.retrieve_fleshed_au_via_id can take a fields parameter for which fields to flesh, so let's expose that, and flesh some patron data being sent to receipt templates while we're here. End-goal is to expose address information in patron searches without sending too much data over the wire git-svn-id: svn://svn.open-ils.org/ILS/trunk@17576 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/patron/bill2.js | 2 +- Open-ILS/xul/staff_client/server/patron/bill_history.js | 2 +- Open-ILS/xul/staff_client/server/patron/bills.js | 4 ++-- Open-ILS/xul/staff_client/server/patron/info_group.js | 4 ++-- Open-ILS/xul/staff_client/server/patron/search_result.js | 5 ++++- Open-ILS/xul/staff_client/server/patron/util.js | 10 +++++----- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index 059267b50..d31f882a9 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -648,7 +648,7 @@ function print_bills() { var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current'; JSAN.use('patron.util'); var params = { - 'patron' : patron.util.retrieve_au_via_id(ses(),g.patron_id), + 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),g.patron_id,null), 'printer_context' : 'receipt', 'template' : template }; diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.js b/Open-ILS/xul/staff_client/server/patron/bill_history.js index da351ae59..5ec8a3c72 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.js +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.js @@ -376,7 +376,7 @@ function print_bills() { var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current'; JSAN.use('patron.util'); var params = { - 'patron' : patron.util.retrieve_au_via_id(ses(),g.patron_id), + 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),g.patron_id,null), 'template' : template }; g.bill_list.print(params); diff --git a/Open-ILS/xul/staff_client/server/patron/bills.js b/Open-ILS/xul/staff_client/server/patron/bills.js index 82c3b8b60..800cae77c 100644 --- a/Open-ILS/xul/staff_client/server/patron/bills.js +++ b/Open-ILS/xul/staff_client/server/patron/bills.js @@ -516,7 +516,7 @@ patron.bills.prototype = { var template = 'bill_payment'; JSAN.use('patron.util'); JSAN.use('util.functional'); var params = { - 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id), + 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id,null), 'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ], 'staff' : obj.data.list.au[0], 'header' : obj.data.print_list_templates[template].header, @@ -684,7 +684,7 @@ patron.bills.prototype = { var columns = patron.util.mbts_columns({}); var template = 'bills_main_view'; var params = { - 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id), + 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id,null), 'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ], 'staff' : obj.data.list.au[0], 'header' : obj.data.print_list_templates[template].header, diff --git a/Open-ILS/xul/staff_client/server/patron/info_group.js b/Open-ILS/xul/staff_client/server/patron/info_group.js index ba47eee64..5752eb249 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_group.js +++ b/Open-ILS/xul/staff_client/server/patron/info_group.js @@ -116,7 +116,7 @@ function tree_init() { return row; } - patron.util.retrieve_fleshed_au_via_id( ses(), id, function(req) { + patron.util.retrieve_fleshed_au_via_id( ses(), id, null, function(req) { row.my.au = req.getResultObject(); process_and_return(); }); @@ -428,7 +428,7 @@ function link_patron(direction) { if (g.sel_list.length == 0) g.sel_list[0] = g.patron_id; for (var i = 0; i < g.sel_list.length; i++) { - var patron_a = patron.util.retrieve_fleshed_au_via_id(ses(),g.sel_list[i]); + var patron_a = patron.util.retrieve_fleshed_au_via_id(ses(),g.sel_list[i],null); if (typeof patron_a.ilsevent != 'undefined') throw(patron_a); switch(direction) { case true: 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 cfb1eee51..4285e38a8 100644 --- a/Open-ILS/xul/staff_client/server/patron/search_result.js +++ b/Open-ILS/xul/staff_client/server/patron/search_result.js @@ -50,7 +50,10 @@ patron.search_result.prototype = { 'map_row_to_columns' : patron.util.std_map_row_to_columns(), 'retrieve_row' : function(params) { var id = params.retrieve_id; - var au_obj = patron.util.retrieve_au_via_id( ses(), id, + var au_obj = patron.util.retrieve_fleshed_au_via_id( + ses(), + id, + ["card","billing_address","mailing_address"], function(req) { try { var row = params.row; diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js index bc5a6d02b..638e38439 100644 --- a/Open-ILS/xul/staff_client/server/patron/util.js +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -227,7 +227,7 @@ patron.util.mp_columns = function(modify,params) { }, { 'persist' : 'hidden width ordinal', 'id' : 'mp_staff', 'label' : commonStrings.getString('staff.mp_accepting_usr_label'), 'flex' : 1, - 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { var s = my.mp.accepting_usr(); if (s && typeof s != "object") s = patron.util.retrieve_fleshed_au_via_id(ses(),s); return s.family_name() + " (" + s.card().barcode() + ") @ " + data.hash.aou[ s.home_ou() ].shortname(); } + 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { var s = my.mp.accepting_usr(); if (s && typeof s != "object") s = patron.util.retrieve_fleshed_au_via_id(ses(),s,["card"]); return s.family_name() + " (" + s.card().barcode() + ") @ " + data.hash.aou[ s.home_ou() ].shortname(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'mp_xact', 'label' : commonStrings.getString('staff.mp_xact_label'), 'flex' : 1, @@ -590,15 +590,15 @@ patron.util.retrieve_name_via_id = function(session, id) { return parts; } -patron.util.retrieve_fleshed_au_via_id = function(session, id, f) { +patron.util.retrieve_fleshed_au_via_id = function(session, id, fields, func) { JSAN.use('util.network'); var network = new util.network(); var patron_obj = network.simple_request( 'FM_AU_FLESHED_RETRIEVE_VIA_ID.authoritative', - [ session, id ], - typeof f == 'function' ? f : null + [ session, id, fields ], + typeof func == 'function' ? func : null ); - if (typeof f != 'function') { + if (typeof func != 'function') { patron.util.set_penalty_css(patron_obj); return patron_obj; } -- 2.11.0