From 37346ba5c19d7a2f33ef9349778927c8fb34e1e3 Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 8 Sep 2010 06:50:02 +0000 Subject: [PATCH] We were shoving a fieldmapper actor.usr object into hold slip templates as params.data.user, but that environment doesn't have fieldmapper, dojo, etc. To sidestep some difficulties adding such libraries, this takes user stat cat entries and shoves them in as normal Javascript objects (params.data.user_stat_cat_entries) So you can add something like this to the hold slip template: However, such pig-trickery with inline Javascript only works with the Mozilla Print strategy (where we render HTML and execute Javascript). git-svn-id: svn://svn.open-ils.org/ILS/trunk@17509 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/circ/util.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 380cbed6d..03a2b136c 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -2428,7 +2428,9 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che 'request_date' : '', 'request_date_msg' : '', 'slip_date' : '', - 'slip_date_msg' : '' + 'slip_date_msg' : '', + 'user' : '', + 'user_stat_cat_entries' : '' }; if (check.payload && check.payload.cancelled_hold_transit) { @@ -2531,6 +2533,26 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che msg += '\n'; var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() ); print_data.user = au_obj; + print_data.user_stat_cat_entries = []; + var entries = au_obj.stat_cat_entries(); + for (var i = 0; i < entries.length; i++) { + var stat_cat = data.hash.my_actsc[ entries[i].stat_cat() ]; + if (!stat_cat) { + stat_cat = data.lookup('actsc', entries[i].stat_cat()); + } + print_data.user_stat_cat_entries.push( { + 'id' : entries[i].id(), + 'stat_cat' : { + 'id' : stat_cat.id(), + 'name' : stat_cat.name(), + 'opac_visible' : stat_cat.opac_visible(), + 'owner' : stat_cat.owner(), + 'usr_summary' : stat_cat.usr_summary() + }, + 'stat_cat_entry' : entries[i].stat_cat_entry(), + 'target_usr' : entries[i].target_usr() + } ); + } msg += '\n'; if (au_obj.alias()) { print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias', [au_obj.alias()]); -- 2.11.0