From a2c30f2fbeef718d3339c823c1c7ecb1c786c1d2 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 14 Jan 2019 16:11:01 -0500 Subject: [PATCH] JBAS-2118 Reprint refundable; show staff login in details Show lost/paid receipt reprint options in main billing list and in payments history list. Show staff A/D login under new "Staff" column in billing payment details. Remove the bogus "@ library" for the "Login" column since it referred to the home library and not the payment library -- best to just not show it. Signed-off-by: Bill Erickson --- .../staff/circ/patron/t_bill_history_payments.tt2 | 4 + .../templates/staff/circ/patron/t_bills_list.tt2 | 3 + .../staff/circ/patron/t_xact_details_details.tt2 | 9 +- .../web/js/ui/default/staff/circ/patron/bills.js | 107 ++++++++++++++++++++- 4 files changed, 120 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bill_history_payments.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bill_history_payments.tt2 index 328ab1d097..a11f215dde 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bill_history_payments.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bill_history_payments.tt2 @@ -7,9 +7,13 @@ grid-controls="gridControls" dateformat="{{$root.egDateAndTimeFormat}}" persist-key="circ.patron.billhistory_payments"> + + + diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 index d622db6c47..48c0499d01 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 @@ -50,6 +50,9 @@ + + diff --git a/Open-ILS/src/templates/staff/circ/patron/t_xact_details_details.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_xact_details_details.tt2 index 6cd026a801..15e363b11c 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_xact_details_details.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_xact_details_details.tt2 @@ -35,7 +35,12 @@ - {{item.staff_name}} ({{item.staff_barcode}}) @ {{item.staff_org}} + + {{item.staff_name}} ({{item.staff_barcode}}) + + + + @@ -52,7 +57,7 @@ label="[% l('Staff Barcode') %]" hidden required> + label="[% l('Staff Home Org Unit') %]" hidden required> 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 0f34ab380d..2c70efd226 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 @@ -954,6 +954,48 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, } + // Reprints the lost/paid (refundable payment) receipt for the + // most recent payment on a refundable transaction. + $scope.printLostPaidReceipt = function(items) { + if (items.length == 0) return; + + var ids = items.map(function(item) {return item.id}); + + function printOne() { + var id = ids.shift(); + if (!id) return $q.when(); + + return egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.refundable_payment.receipt.by_xact.html', + egCore.auth.token(), id + ).then(function(receipt) { + + if (receipt && + receipt.textcode == 'MONEY_REFUNDABLE_XACT_SUMMARY_NOT_FOUND') { + alert('Cannot generate lost/paid receipt for transaction #' + id); + return; + } + + if (!receipt || !receipt.template_output()) { + return alert( + 'Error creating refundable payment receipt for transaction #' + id); + } + + var html = receipt.template_output().data(); + return egCore.print.print({ + context : 'default', + content_type: 'text/html', + content: html, + show_dialog: true, + scope : {} + }); + }).then(printOne); + } + + printOne(); + } + // note this is functionally equivalent to selecting a neg. transaction // then clicking Apply Payment -- this just adds a speed bump (ditto // the XUL client). @@ -1010,7 +1052,29 @@ function($scope, $q , $routeParams , egCore , egGridDataProvider , patronSvc , var paymentGrid = $scope.paymentGridControls = { setQuery : function() { return {xact : xact_id} }, - setSort : function() { return ['payment_ts'] } + setSort : function() { return ['payment_ts'] }, + allItemsRetrieved: function() { + // See if any of these payments are refundable. + // If so, fetch the staff A/D login name for display. + var items = $scope.paymentGridControls.allItems().concat([]); + + function fetchOne() { + var item = items.shift(); + if (!item) { return $q.when(); } + return egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.refundable_payment.retrieve.by_payment', + egCore.auth.token(), item.id + ).then(function(rfPayment) { + if (rfPayment) { + item.refundable_payment_staff = + rfPayment.staff_email().replace(/@.*/g, ''); // remove @kcls.org + } + fetchOne(); + }) + } + fetchOne(); + } } // -- actions @@ -1151,6 +1215,47 @@ function($scope, $q , $routeParams , egCore , patronSvc , billSvc , egPromptDia if (end == today) end = 'now'; return [start, end]; } + + // Reprints the lost/paid (refundable payment) receipt for selected payments + $scope.printLostPaidReceipt = function(items) { + if (items.length == 0) return; + + var ids = items.map(function(item) {return item.id}); + + function printOne() { + var id = ids.shift(); + if (!id) return $q.when(); + + return egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.refundable_payment.receipt.by_pay.html', + egCore.auth.token(), id + ).then(function(receipt) { + + if (receipt && + receipt.textcode == 'MONEY_REFUNDABLE_PAYMENT_SUMMARY_NOT_FOUND') { + alert('Cannot generate lost/paid receipt for payment #' + id); + return; + } + + if (!receipt || !receipt.template_output()) { + return alert( + 'Error creating refundable payment receipt for payment #' + id); + } + + var html = receipt.template_output().data(); + return egCore.print.print({ + context : 'default', + content_type: 'text/html', + content: html, + show_dialog: true, + scope : {} + }); + }).then(printOne); + } + + printOne(); + } }]) -- 2.11.0