'items_print_selected': function(which) {
var obj = this;
- JSAN.use('patron.util');
- JSAN.use('util.functional');
- var ui_list = ( which == 2 ? obj.list2 : obj.list);
- var id_list = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ try {
+ JSAN.use('patron.util');
+ // JSAN.use('util.functional');
+ var list = ( which == 2 ? obj.list2 : obj.list);
+ // Selected Rows
+ var list_dump = list.dump_with_keys();
+ var pick_list = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ if (!pick_list || pick_list.length == 0) return;
+
+ // I don't know a better way to just get all the data from one row
+ for (var i=0; i<pick_list.length; i++) {
+ var bc = pick_list[i].barcode;
+ for (var j=0; j<list_dump.length; j++) {
+ if (pick_list[i].barcode == list_dump[j].barcode) {
+ pick_list[i] = list_dump[j];
+ }
+ }
+ }
+
+ var params = {
+ 'list': pick_list,
+ 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id),
+ 'printer_context' : 'receipt',
+ 'template' : 'items_out'
+ };
- // Had to merge to make the right data for print
- for (var i=0; i < id_list.length; i++) {
- var x = id_list[i].circ_id;
- var r = obj.list_circ_map[x].row.my;
- id_list[i].title = r.mvr.title();
- id_list[i].due_date = r.circ.due_date();
+ list.print( params );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('items_print_selected has failed',E);
}
-
- var params = {
- 'list': id_list,
- 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id),
- 'printer_context' : 'receipt',
- 'template' : 'items_out'
- };
- ui_list.print( params );
},
'items_export' : function(which) {