From 0d443d4b65b00b409a909f5440e43e49708f9b99 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 17 Nov 2016 15:38:17 -0500 Subject: [PATCH] add Print Bills to Bill History FIXME: duplicated a code chunk, should probably refactor into a shared printBills FIXME: disable actions or make otherwise obvious that they only work on selected rows Signed-off-by: Jason Etheridge Signed-off-by: Kathy Lussier --- .../circ/patron/t_bill_history_xacts.tt2 | 2 ++ .../js/ui/default/staff/circ/patron/bills.js | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bill_history_xacts.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bill_history_xacts.tt2 index 70f48b6ca0..accbd36a98 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bill_history_xacts.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bill_history_xacts.tt2 @@ -10,6 +10,8 @@ label="[% l('Add Billing') %]" handler="addBilling"> + diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js index 8d2801d409..37c2a1845a 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js @@ -775,6 +775,39 @@ function($scope, $q , egCore , patronSvc , billSvc , egPromptDialog , $location }) } } + + $scope.printBills = function(selected) { // FIXME: refactor me + if (!selected.length) return; + // bills print receipt assumes nested hashes, but our grid + // stores flattener data. Fetch the selected xacts as + // fleshed pcrud objects and hashify. + // (Consider an alternate approach..) + var ids = selected.map(function(t){ return t.id }); + var xacts = []; + egCore.pcrud.search('mbt', + {id : ids}, + {flesh : 1, flesh_fields : {'mbt' : ['summary']}}, + {authoritative : true} + ).then( + function() { + egCore.print.print({ + context : 'receipt', + template : 'bills_historical', + scope : { + transactions : xacts, + current_location : egCore.idl.toHash( + egCore.org.get(egCore.auth.user().ws_ou())) + } + }); + }, + null, + function(xact) { + xacts.push(egCore.idl.toHash(xact)); + } + ); + } + + }]) .controller('BillPaymentHistoryCtrl', -- 2.43.2