[open-ils-commits] r14078 - in trunk/Open-ILS/xul/staff_client: chrome/content/OpenILS chrome/content/util server/circ (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Sep 21 16:06:46 EDT 2009
Author: phasefx
Date: 2009-09-21 16:06:41 -0400 (Mon, 21 Sep 2009)
New Revision: 14078
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js
trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
Splits the hard-coded hold/transit slip logic into 3 types of slips (hold_slip, transit_slip, and hold_transit_slip), and ties them into the receipt template system. The ui.circ.old_harcoded_slip_template (not yet wired in) org
unit setting will revert to the hard-coded logic. The new templates are not 100% identical to the hard-coded slips, mainly because they're brain-dead simple and don't lend themselves to conditional display logic without delving
into inline javascript. Testing welcome.
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js 2009-09-21 16:37:19 UTC (rev 14077)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js 2009-09-21 20:06:41 UTC (rev 14078)
@@ -346,7 +346,25 @@
'header' : 'Welcome to %LIBRARY%!<br/>\r\nYou have the following titles on hold:<hr/><ol>',
'line_item' : '<li>%title%\r\n',
'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n'
- }
+ },
+ 'hold_slip' : {
+ 'type' : 'holds',
+ 'header' : 'This item needs to be routed to <b>HOLDS SHELF</b>:<br/>\r\n',
+ 'line_item' : 'Barcode: %item_barcode%<br/>\r\nTitle: %item_title%<br/>\r\n<br/>\r\n%hold_for_msg%<br/>\r\nBarcode: %PATRON_BARCODE%<br/>\r\nNotify by phone: %notify_by_phone%<br/>\r\nNotify by email: %notify_by_email%<br/>\r\n<br/>\r\nRequest date: <br/>\r\n',
+ 'footer' : 'Slip Date: %TODAY_TRIM%<br/>\r\nPrinted by %STAFF_FIRSTNAME% at %SHORTNAME%<br/>\r\n<br/>\r\n'
+ },
+ 'transit_slip' : {
+ 'type' : 'transits',
+ 'header' : 'This item needs to be routed to <b>%route_to%</b>:<br/>\r\n%route_to_org_fullname%<br/>\r\n%street1%<br/>\r\n%street2%<br/>\r\n%city_state_zip%<br/>\r\n<br/>\r\n',
+ 'line_item' : 'Barcode: %item_barcode%<br/>\r\nTitle: %item_title%<br/>\r\nAuthor: %item_author%<br>\r\n<br/>\r\n',
+ 'footer' : 'Slip Date: %TODAY_TRIM%<br/>\r\nPrinted by %STAFF_FIRSTNAME% at %SHORTNAME%<br/>\r\n<br/>\r\n'
+ },
+ 'hold_transit_slip' : {
+ 'type' : 'transits',
+ 'header' : 'This item needs to be routed to <b>%route_to%</b>:<br/>\r\n%route_to_org_fullname%<br/>\r\n%street1%<br/>\r\n%street2%<br/>\r\n%city_state_zip%<br/>\r\n<br/>\r\n',
+ 'line_item' : 'Barcode: %item_barcode%<br/>\r\nTitle: %item_title%<br/>\r\nAuthor: %item_author%<br>\r\n<br/>\r\n%hold_for_msg%<br/>\r\nBarcode: %PATRON_BARCODE%<br/>\r\nNotify by phone: %notify_by_phone%<br/>\r\nNotify by email: %notify_by_email%<br/>\r\n<br/>\r\nRequest date: <br/>\r\n',
+ 'footer' : 'Slip Date: %TODAY_TRIM%<br/>\r\nPrinted by %STAFF_FIRSTNAME% at %SHORTNAME%<br/>\r\n<br/>\r\n'
+ }
};
obj.stash( 'print_list_templates', 'print_list_types' );
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js 2009-09-21 16:37:19 UTC (rev 14077)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js 2009-09-21 20:06:41 UTC (rev 14078)
@@ -115,11 +115,11 @@
'tree_list' : function (params) {
try {
dump('print.tree_list.params.list = \n' + this.error.pretty_print(js2JSON(params.list)) + '\n');
+ dump('print.tree_list.params.data = \n' + this.error.pretty_print(js2JSON(params.data)) + '\n');
} catch(E) {
dump(E+'\n');
}
var cols = [];
-
var s = '';
if (params.header) s += this.template_sub( params.header, cols, params );
if (params.list) {
@@ -140,87 +140,93 @@
},
'template_sub' : function( msg, cols, params ) {
- if (!msg) { dump('template sub called with empty string\n'); return; }
- JSAN.use('util.date');
- var s = msg; var b;
+ try {
+ if (!msg) { dump('template sub called with empty string\n'); return; }
+ JSAN.use('util.date');
+ var s = msg; var b;
- try{b = s; s = s.replace(/%LINE_NO%/,Number(params.row_idx)+1);}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%LINE_NO%/,Number(params.row_idx)+1);}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%patron_barcode%/,params.patron_barcode);}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%patron_barcode%/,params.patron_barcode);}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%LIBRARY%/,params.lib.name());}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%PINES_CODE%/,params.lib.shortname());}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%SHORTNAME%/,params.lib.shortname());}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%STAFF_FIRSTNAME%/,params.staff.first_given_name());}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%STAFF_LASTNAME%/,params.staff.family_name());}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%STAFF_BARCODE%/,params.staff.barcode); }
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%STAFF_PROFILE%/,obj.data.hash.pgt[ params.staff.profile() ].name() ); }
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%PATRON_FIRSTNAME%/,params.patron.first_given_name());}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%PATRON_LASTNAME%/,params.patron.family_name());}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s = s.replace(/%PATRON_BARCODE%/,typeof params.patron.card() == 'object' ? params.patron.card().barcode() : util.functional.find_id_object_in_list( params.patron.cards(), params.patron.card() ).barcode() ) ;}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%LIBRARY%/,params.lib.name());}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%PINES_CODE%/,params.lib.shortname());}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%SHORTNAME%/,params.lib.shortname());}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%STAFF_FIRSTNAME%/,params.staff.first_given_name());}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%STAFF_LASTNAME%/,params.staff.family_name());}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%STAFF_BARCODE%/,params.staff.barcode); }
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%STAFF_PROFILE%/,obj.data.hash.pgt[ params.staff.profile() ].name() ); }
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%PATRON_FIRSTNAME%/,params.patron.first_given_name());}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%PATRON_LASTNAME%/,params.patron.family_name());}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s = s.replace(/%PATRON_BARCODE%/,typeof params.patron.card() == 'object' ? params.patron.card().barcode() : util.functional.find_id_object_in_list( params.patron.cards(), params.patron.card() ).barcode() ) ;}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY%/g,(new Date()));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_m%/g,(util.date.formatted_date(new Date(),'%m')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_TRIM%/g,(util.date.formatted_date(new Date(),'')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_d%/g,(util.date.formatted_date(new Date(),'%d')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_Y%/g,(util.date.formatted_date(new Date(),'%Y')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_H%/g,(util.date.formatted_date(new Date(),'%H')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_I%/g,(util.date.formatted_date(new Date(),'%I')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_M%/g,(util.date.formatted_date(new Date(),'%M')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_D%/g,(util.date.formatted_date(new Date(),'%D')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try{b = s; s=s.replace(/%TODAY_F%/g,(util.date.formatted_date(new Date(),'%F')));}
- catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY%/g,(new Date()));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_m%/g,(util.date.formatted_date(new Date(),'%m')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_TRIM%/g,(util.date.formatted_date(new Date(),'')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_d%/g,(util.date.formatted_date(new Date(),'%d')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_Y%/g,(util.date.formatted_date(new Date(),'%Y')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_H%/g,(util.date.formatted_date(new Date(),'%H')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_I%/g,(util.date.formatted_date(new Date(),'%I')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_M%/g,(util.date.formatted_date(new Date(),'%M')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_D%/g,(util.date.formatted_date(new Date(),'%D')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+ try{b = s; s=s.replace(/%TODAY_F%/g,(util.date.formatted_date(new Date(),'%F')));}
+ catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
- try {
- if (typeof params.row != 'undefined') {
- if (params.row.length >= 0) {
- alert('debug - please tell the developers that deprecated template code tried to execute');
- for (var i = 0; i < cols.length; i++) {
- var re = new RegExp(cols[i],"g");
- try{b = s; s=s.replace(re, params.row[i]);}
- catch(E){s = b; this.error.standard_unexpected_error_alert('string = <' + s + '> error = ' + js2JSON(E)+'\n',E);}
- }
- } else {
- /* for dump_with_keys */
- for (var i in params.row) {
- var re = new RegExp('%'+i+'%',"g");
- try{b = s; s=s.replace(re, params.row[i]);}
- catch(E){s = b; this.error.standard_unexpected_error_alert('string = <' + s + '> error = ' + js2JSON(E)+'\n',E);}
- }
- }
- }
+ try {
+ if (typeof params.row != 'undefined') {
+ if (params.row.length >= 0) {
+ alert('debug - please tell the developers that deprecated template code tried to execute');
+ for (var i = 0; i < cols.length; i++) {
+ var re = new RegExp(cols[i],"g");
+ try{b = s; s=s.replace(re, params.row[i]);}
+ catch(E){s = b; this.error.standard_unexpected_error_alert('print.js, template_sub(): 1 string = <' + s + '>',E);}
+ }
+ } else {
+ /* for dump_with_keys */
+ for (var i in params.row) {
+ var re = new RegExp('%'+i+'%',"g");
+ try{b = s; s=s.replace(re, params.row[i]);}
+ catch(E){s = b; this.error.standard_unexpected_error_alert('print.js, template_sub(): 2 string = <' + s + '>',E);}
+ }
+ }
+ }
- if (typeof params.data != 'undefined') {
- for (var i in params.data) {
- var re = new RegExp('%'+i+'%',"g");
- try{b = s; s=s.replace(re, params.data[i]);}
- catch(E){s = b; this.error.standard_unexpected_error_alert('string = <' + s + '> error = ' + js2JSON(E)+'\n',E);}
- }
- }
- } catch(E) { dump(E+'\n'); }
+ if (typeof params.data != 'undefined') {
+ for (var i in params.data) {
+ var re = new RegExp('%'+i+'%',"g");
+ if (typeof params.data[i] == 'string') {
+ try{b = s; s=s.replace(re, params.data[i]);}
+ catch(E){s = b; this.error.standard_unexpected_error_alert('print.js, template_sub(): 3 string = <' + s + '>',E);}
+ }
+ }
+ }
+ } catch(E) { dump(E+'\n'); }
- return s;
+ return s;
+ } catch(E) {
+ alert('Error in print.js, template_sub(): ' + E);
+ }
},
Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js 2009-09-21 16:37:19 UTC (rev 14077)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js 2009-09-21 20:06:41 UTC (rev 14078)
@@ -2157,9 +2157,47 @@
}
var msg = '';
+ var print_data = {
+ 'error' : '',
+ 'error_msg' : '',
+ 'cancelled' : '',
+ 'route_to' : '',
+ 'route_to_msg' : '',
+ 'route_to_org_fullname' : '',
+ 'street1' : '',
+ 'street2' : '',
+ 'city_state_zip' : '',
+ 'city' : '',
+ 'state' : '',
+ 'county' : '',
+ 'country' : '',
+ 'post_code' : '',
+ 'item_barcode' : '',
+ 'item_barcode_msg' : '',
+ 'item_title' : '',
+ 'item_title_msg' : '',
+ 'item_author' : '',
+ 'item_author_msg' : '',
+ 'hold_for_msg' : '',
+ 'hold_for_alias' : '',
+ 'hold_for_family_name' : '',
+ 'hold_for_first_given_name' : '',
+ 'hold_for_second_given_name' : '',
+ 'user_barcode' : '',
+ 'user_barcode_msg' : '',
+ 'notify_by_phone' : '',
+ 'notify_by_phone_msg' : '',
+ 'notify_by_email' : '',
+ 'notify_by_email_msg' : '',
+ 'request_date' : '',
+ 'request_date_msg' : '',
+ 'slip_date' : '',
+ 'slip_date_msg' : ''
+ };
if (check.payload && check.payload.cancelled_hold_transit) {
- msg += document.getElementById('circStrings').getString('staff.circ.utils.transit_hold_cancelled');
+ print_data.cancelled = document.getElementById('circStrings').getString('staff.circ.utils.transit_hold_cancelled');
+ msg += print_data.cancelled;
msg += '\n\n';
}
@@ -2167,8 +2205,9 @@
if (check.ilsevent == 0 || check.ilsevent == 3 || check.ilsevent == 1202) {
try { check.route_to = data.lookup('acpl', check.copy.location() ).name(); }
catch(E) {
- msg += document.getElementById('commonStrings').getString('common.error');
- msg += '\nFIXME: ' + E + '\n';
+ print_data.error_msg = document.getElementById('commonStrings').getString('common.error');
+ print_data.error_msg += '\nFIXME: ' + E + '\n';
+ msg += print_data.error_msg;
}
if (check.ilsevent == 3 /* NO_CHANGE */) {
//msg = 'This item is already checked in.\n';
@@ -2180,16 +2219,20 @@
}
if (check.ilsevent == 1202 /* ITEM_NOT_CATALOGED */ && check.copy.status() != 11) {
var copy_status = (data.hash.ccs[ check.copy.status() ] ? data.hash.ccs[ check.copy.status() ].name() : check.copy.status().name() );
- msg = document.getElementById('commonStrings').getString('common.error');
- msg += '\nFIXME --';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_not_cataloged', [copy_status]);
- msg + '\n';
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += '\nFIXME --';
+ err_msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_not_cataloged', [copy_status]);
+ err_msg += '\n';
+ msg += err_msg;
+ print_data.error_msg += err_msg;
}
switch(Number(check.copy.status())) {
case 0: /* AVAILABLE */
case 7: /* RESHELVING */
if (msg) {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ print_data.route_to = check.route_to;
+ msg += print_data.route_to_msg;
msg += '\n';
}
break;
@@ -2197,55 +2240,84 @@
check.route_to = 'HOLDS SHELF';
if (check.payload.hold) {
if (check.payload.hold.pickup_lib() != data.list.au[0].ws_ou()) {
- msg += document.getElementById('commonStrings').getString('common.error');
- msg += '\nFIXME: ';
- msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_error');
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += '\nFIXME: ';
+ err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_error');
+ err_msg += '\n';
+ msg += err_msg;
+ print_data.error_msg += err_msg;
+ } else {
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ print_data.route_to = check.route_to;
+ msg += print_data.route_to_msg;
msg += '\n';
- } else {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
- msg += '.\n';
}
} else {
- msg += document.getElementById('commonStrings').getString('common.error');
- msg += '\nFIXME: ';
- msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_status_error');
- msg += '\n';
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += '\nFIXME: ';
+ err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_status_error');
+ err_msg += '\n';
+ msg += err_msg;
+ print_data.error_msg += err_msg;
}
JSAN.use('util.date');
if (check.payload.hold) {
JSAN.use('patron.util');
msg += '\n';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [check.payload.copy.barcode()]);
+ print_data.item_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [check.payload.copy.barcode()]);
+ print_data.item_barcode = check.payload.copy.barcode();
+ msg += print_data.item_barcode_msg;
msg += '\n';
var payload_title = (check.payload.record ? check.payload.record.title() : check.payload.copy.dummy_title() );
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.title', [payload_title]);
+ print_data.item_title_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.title', [payload_title]);
+ print_data.item_title = payload_title;
+ msg += print_data.item_title_msg;
msg += '\n';
var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() );
+ print_data.user = au_obj;
msg += '\n';
if (au_obj.alias()) {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias', [au_obj.alias()]);
+ print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias', [au_obj.alias()]);
+ print_data.hold_for_alias = au_obj.alias();
+ msg += print_data.hold_for_msg;
} else {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron', [au_obj.family_name(), au_obj.first_given_name(), au_obj.second_given_name()]);
+ print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron', [au_obj.family_name() ? au_obj.family_name() : '', au_obj.first_given_name() ? au_obj.first_given_name() : '', au_obj.second_given_name() ? au_obj.second_given_name() : '']);
+ msg += print_data.hold_for_msg;
+ print_data.hold_for_family_name = au_obj.family_name() ? au_obj.family_name() : '';
+ print_data.hold_for_first_given_name = au_obj.first_given_name() ? au_obj.first_given_name() : '';
+ print_data.hold_for_second_given_name = au_obj.second_given_name() ? au_obj.second_given_name() : '';
}
msg += '\n';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [au_obj.card().barcode()]);
+ print_data.user_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [au_obj.card().barcode()]);
+ print_data.user_barcode = au_obj.card().barcode();
+ msg += print_data.user_barcode_msg;
msg += '\n';
if (check.payload.hold.phone_notify()) {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.phone_notify', [check.payload.hold.phone_notify()]);
+ print_data.notify_by_phone_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.phone_notify', [check.payload.hold.phone_notify()]);
+ print_data.notify_by_phone = check.payload.hold.phone_notify();
+ msg += print_data.notify_by_phone_msg;
msg += '\n';
}
if (get_bool(check.payload.hold.email_notify())) {
var payload_email = au_obj.email() ? au_obj.email() : '';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]);
+ print_data.notify_by_email_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]);
+ print_data.notify_by_email = payload_email;
+ msg += print_data.notify_by_email_msg;
msg += '\n';
}
msg += '\n';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.request_date', [util.date.formatted_date(check.payload.hold.request_time(),'%F')]);
+ print_data.request_date = util.date.formatted_date(check.payload.hold.request_time(),'%F');
+ print_data.request_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.request_date', [print_data.request_date]);
+ msg += print_data.request_date_msg;
msg += '\n';
}
var rv = 0;
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.slip_date', [util.date.formatted_date(new Date(),'%F')]);
+ print_data.slip_date = util.date.formatted_date(new Date(),'%F');
+ print_data.slip_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.slip_date', [print_data.slip_date]);
+ msg += print_data.slip_date_msg;
msg += '\n';
+ print_data.payload = check.payload;
+
if (!auto_print) {
rv = error.yns_alert_formatted(
msg,
@@ -2260,8 +2332,25 @@
if (rv == 0) {
try {
JSAN.use('util.print'); var print = new util.print();
- msg = msg.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\n/g,'<br/>');
- print.simple( msg , { 'no_prompt' : true, 'content_type' : 'text/html' } );
+ var old_template = String( data.hash.aous['ui.circ.old_harcoded_slip_template'] ) == 'true';
+ if (old_template) {
+ msg = msg.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\n/g,'<br/>');
+ print.simple( msg , { 'no_prompt' : true, 'content_type' : 'text/html' } );
+ } else {
+ var template = 'hold_slip';
+ var params = {
+ 'patron' : print_data.user,
+ 'lib' : data.hash.aou[ check.payload.hold.pickup_lib() ],
+ 'staff' : data.list.au[0],
+ 'header' : data.print_list_templates[ template ].header,
+ 'line_item' : data.print_list_templates[ template ].line_item,
+ 'footer' : data.print_list_templates[ template ].footer,
+ 'type' : data.print_list_templates[ template ].type,
+ 'list' : [ {} ],
+ 'data' : print_data
+ };
+ print.tree_list( params );
+ }
} catch(E) {
var err_msg = document.getElementById('commonStrings').getString('common.error');
err_msg += '\nFIXME: ' + E + '\n';
@@ -2279,18 +2368,24 @@
break;
case 6: /* IN TRANSIT */
check.route_to = 'TRANSIT SHELF??';
- msg += document.getElementById('commonStrings').getString('common.error');
- msg += "\nFIXME -- I didn't think we could get here.\n";
+ print_data.route_to;
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += "\nFIXME -- I didn't think we could get here.\n";
+ print_data.error_msg += err_msg;
+ msg += err_msg;
break;
case 11: /* CATALOGING */
check.route_to = 'CATALOGING';
+ print_data.route_to;
if (document.getElementById('do_not_alert_on_precat')) {
var x = document.getElementById('do_not_alert_on_precat');
if (! x.checked) {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ msg += print_data.route_to_msg;
}
} else {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ msg += print_data.route_to_msg;
}
if (document.getElementById('no_change_label')) {
var m = document.getElementById('no_change_label').getAttribute('value');
@@ -2303,9 +2398,12 @@
msg += document.getElementById('commonStrings').getString('common.error');
var copy_status = data.hash.ccs[check.copy.status()] ? data.hash.ccs[check.copy.status()].name() : check.copy.status().name();
msg += '\n';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.copy_status.error', [copy_status]);
+ var error_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.copy_status.error', [copy_status]);
+ print_data.error_msg += error_msg;
+ msg += error_msg;
msg += '\n';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ msg += print_data.route_to_msg;
break;
}
if (msg) {
@@ -2322,7 +2420,11 @@
var lib = data.hash.aou[ check.org ];
check.route_to = lib.shortname();
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.destination', [check.route_to]);
+ print_data.route_to = check.route_to;
+ print_data.route_to_org = lib;
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.destination', [check.route_to]);
+ print_data.route_to_org_fullname = lib.name();
+ msg += print_data.route_to_msg;
msg += '\n\n';
msg += lib.name();
msg += '\n';
@@ -2330,55 +2432,89 @@
if (lib.holds_address() ) {
var a = network.simple_request('FM_AOA_RETRIEVE',[ lib.holds_address() ]);
if (typeof a.ilsevent != 'undefined') throw(a);
- if (a.street1()) msg += a.street1() + '\n';
- if (a.street2()) msg += a.street2() + '\n';
- msg += (a.city() ? a.city() + ', ' : '') + (a.state() ? a.state() + ' ' : '') + (a.post_code() ? a.post_code() : '') + '\n';
+ if (a.street1()) { msg += a.street1() + '\n'; print_data.street1 = a.street1(); }
+ if (a.street2()) { msg += a.street2() + '\n'; print_data.street2 = a.street2(); }
+ print_data.city_state_zip = (a.city() ? a.city() + ', ' : '') + (a.state() ? a.state() + ' ' : '') + (a.post_code() ? a.post_code() : '');
+ print_data.city = a.city();
+ print_data.state = a.state();
+ print_data.county = a.county();
+ print_data.country = a.country();
+ print_data.post_code = a.post_code();
+ msg += print_data.city_state_zip + '\n';
} else {
- msg += document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address');
+ print_data.street1 = document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address');
+ print_data.no_address = true;
+ msg += print_data.street1;
msg += '\n';
}
} catch(E) {
- msg += document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address.error');
- msg += '\n';
+ var err_msg = document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address.error');
+ print_data.error_msg += err_msg + '\n';
+ msg += err_msg + '\n';
error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address.error'), E);
}
msg += '\n';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [check.payload.copy.barcode()]);
+ print_data.item_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [check.payload.copy.barcode()]);
+ print_data.item_barcode = check.payload.copy.barcode();
+ msg += print_data.item_barcode_msg;
msg += '\n';
var payload_title = (check.payload.record ? check.payload.record.title() : check.payload.copy.dummy_title() );
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.title', [payload_title]);
+ print_data.item_title_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.title', [payload_title]);
+ print_data.item_title = payload_title;
+ msg += print_data.item_title_msg;
msg += '\n';
var payload_author = (check.payload.record ? check.payload.record.author() :check.payload.copy.dummy_author());
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.author', [payload_author]);
+ print_data.item_author_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.author', [payload_author]);
+ print_data.item_author = payload_author;
+ msg += print_data.item_author_msg;
msg += '\n';
JSAN.use('util.date');
if (check.payload.hold) {
JSAN.use('patron.util');
var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() );
+ print_data.user = au_obj;
msg += '\n';
if (au_obj.alias()) {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias', [au_obj.alias()]);
+ print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias', [au_obj.alias()]);
+ print_data.hold_for_alias = au_obj.alias();
+ msg += print_data.hold_for_msg;
} else {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron', [au_obj.family_name(), au_obj.first_given_name(), au_obj.second_given_name()]);
+ print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron', [au_obj.family_name() ? au_obj.family_name() : '', au_obj.first_given_name() ? au_obj.first_given_name() : '', au_obj.second_given_name() ? au_obj.second_given_name() : '']);
+ msg += print_data.hold_for_msg;
+ print_data.hold_for_family_name = au_obj.family_name() ? au_obj.family_name() : '';
+ print_data.hold_for_first_given_name = au_obj.first_given_name() ? au_obj.first_given_name() : '';
+ print_data.hold_for_second_given_name = au_obj.second_given_name() ? au_obj.second_given_name() : '';
}
msg += '\n';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [au_obj.card().barcode()]);
+ print_data.user_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [au_obj.card().barcode()]);
+ print_data.user_barcode = au_obj.card().barcode();
+ msg += print_data.user_barcode_msg;
msg += '\n';
if (check.payload.hold.phone_notify()) {
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.phone_notify', [check.payload.hold.phone_notify()]);
+ print_data.notify_by_phone_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.phone_notify', [check.payload.hold.phone_notify()]);
+ print_data.notify_by_phone = check.payload.hold.phone_notify();
+ msg += print_data.notify_by_phone_msg;
msg += '\n';
}
if (get_bool(check.payload.hold.email_notify())) {
var payload_email = au_obj.email() ? au_obj.email() : '';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]);
+ print_data.notify_by_email_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]);
+ print_data.notify_by_email = payload_email;
+ msg += print_data.notify_by_email_msg;
msg += '\n';
}
msg += '\n';
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.request_date', [util.date.formatted_date(check.payload.hold.request_time(),'%F')]);
+ print_data.request_date = util.date.formatted_date(check.payload.hold.request_time(),'%F');
+ print_data.request_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.request_date', [print_data.request_date]);
+ msg += print_data.request_date_msg;
msg += '\n';
}
var rv = 0;
- msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.slip_date', [util.date.formatted_date(new Date(),'%F')]);
+ print_data.slip_date = util.date.formatted_date(new Date(),'%F');
+ print_data.slip_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.slip_date', [print_data.slip_date]);
+ msg += print_data.slip_date_msg;
+ print_data.payload = check.payload;
+
if (!auto_print) {
rv = error.yns_alert_formatted(
msg,
@@ -2390,13 +2526,28 @@
'/xul/server/skin/media/images/turtle.gif'
);
}
-
if (rv == 0) {
try {
JSAN.use('util.print'); var print = new util.print();
- //print.simple( msg, { 'no_prompt' : true, 'content_type' : 'text/plain' } );
- msg = msg.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\n/g,'<br/>');
- print.simple( msg , { 'no_prompt' : true, 'content_type' : 'text/html' } );
+ var old_template = String( data.hash.aous['ui.circ.old_harcoded_slip_template'] ) == 'true';
+ if (old_template) {
+ msg = msg.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\n/g,'<br/>');
+ print.simple( msg , { 'no_prompt' : true, 'content_type' : 'text/html' } );
+ } else {
+ var template = check.payload.hold ? 'hold_transit_slip' : 'transit_slip';
+ var params = {
+ 'patron' : print_data.user,
+ 'lib' : data.hash.aou[ check.payload.hold ? check.payload.hold.pickup_lib() : check.payload.transit.source() ],
+ 'staff' : data.list.au[0],
+ 'header' : data.print_list_templates[ template ].header,
+ 'line_item' : data.print_list_templates[ template ].line_item,
+ 'footer' : data.print_list_templates[ template ].footer,
+ 'type' : data.print_list_templates[ template ].type,
+ 'list' : [ {} ],
+ 'data' : print_data
+ };
+ print.tree_list( params );
+ }
} catch(E) {
var err_msg = document.getElementById('commonStrings').getString('common.error');
err_msg += '\nFIXME: ' + E + '\n';
More information about the open-ils-commits
mailing list