From 870569b06ff9b40e62ccdd65c7378920c67f1347 Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Mon, 29 Jan 2018 17:02:01 -0500 Subject: [PATCH] LP1737540: Add Patron Information to Receipts Adds the following fields to a patron object on print_data: first_given_name second_given_name family_name suffix barcode money_summary.balance_owed money_summary.total_paid money_summary.total_owed expire_date alias has_email has_phone On the following receipts: Checkout, Items Out, and Bill Payment. (money_summary left out on bill payment because it will always be out of date.) Signed-off-by: Jason Boyer Signed-off-by: Jason Stephenson --- .../share/print_templates/t_bill_payment.tt2 | 12 ++++++++++ .../share/print_templates/t_checkout.tt2 | 22 ++++++++++++++----- .../share/print_templates/t_items_out.tt2 | 19 +++++++++++++++- .../ui/default/staff/admin/workstation/app.js | 13 ++++++++++- .../js/ui/default/staff/circ/patron/bills.js | 18 ++++++++++++++- .../ui/default/staff/circ/patron/checkout.js | 17 +++++++++++++- .../ui/default/staff/circ/patron/items_out.js | 17 +++++++++++++- 7 files changed, 107 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2 index 57e50fe40e..d0189c9347 100644 --- a/Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2 +++ b/Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2 @@ -2,6 +2,18 @@ Template for bill payment receipts. Data specific to this template includes: +* patron - has several fields from the patron object, including a financial summary + + * first_given_name + * second_given_name + * family_name + * suffix + * card.barcode + * expire_date + * alias - aka Holds Alias + * has_email - boolean value to show/hide elements on the receipt + * has_phone - same as has_email + * current_location.name - name of workstation location * payment_type * payment_total - total paid diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 index 6b445b9de7..9ba5c31754 100644 --- a/Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 @@ -1,18 +1,28 @@
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_items_out.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_items_out.tt2 index 9d49e15c73..225fbb4ac1 100644 --- a/Open-ILS/src/templates/staff/share/print_templates/t_items_out.tt2 +++ b/Open-ILS/src/templates/staff/share/print_templates/t_items_out.tt2 @@ -2,11 +2,28 @@ Template for printing a list of items that a patron has checked out. Fields include: +* patron - has several fields from the patron object, including a financial summary + + * first_given_name + * second_given_name + * family_name + * suffix + * card.barcode + * money_summary.balance_owed - current balance + * money_summary.total_paid - payments made on outstanding fines/fees + * money_summary.total_owed - total of outstanding fines/fees + * expire_date + * alias - aka Holds Alias + * has_email - boolean value to show/hide elements on the receipt + * has_phone - same as has_email + * circulations - list of current loans, including + * title + * author + * call_number.label * copy.barcode * circ.due_date - * title -->
diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index 71e9117301..20973ffc1d 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -349,12 +349,23 @@ function($scope , $q , egCore , ngToast) { // alongside the templates. // NOTE: A lot of this data can be shared across templates. var seed_user = { + prefix : 'Mr', first_given_name : 'Slow', second_given_name : 'Joe', family_name : 'Jones', + suffix : 'III', card : { barcode : '30393830393' - } + }, + money_summary : { + balance_owed : 4, // This is currently how these values are returned to the client + total_billed : '5.00', + total_paid : '1.00' + }, + expire_date : '2020-12-31', + alias : 'the dude', + has_email : true, + has_phone : false } var seed_addr = { street1 : '123 Apple Rd', 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 97c2d93b99..ea21a3c194 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 @@ -350,6 +350,8 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, function printReceipt(type, payment_ids, payments_made, note) { var payment_blobs = []; + var cusr = patronSvc.current; + angular.forEach(payments_made, function(payment) { var xact_id = payment[0]; @@ -377,7 +379,21 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, payments : payment_blobs, current_location : egCore.idl.toHash( egCore.org.get(egCore.auth.user().ws_ou())) - } + }; + + // Not a good idea to use patron_stats.fines for this; it's out of date + print_data.patron = { + prefix : cusr.prefix(), + first_given_name : cusr.first_given_name(), + second_given_name : cusr.second_given_name(), + family_name : cusr.family_name(), + suffix : cusr.suffix(), + card : { barcode : cusr.card().barcode() }, + expire_date : cusr.expire_date(), + alias : cusr.alias(), + has_email : Boolean(patronSvc.current.email() && patronSvc.current.email().match(/.*@.*/).length), + has_phone : Boolean(cusr.day_phone() || cusr.evening_phone() || cusr.other_phone()) + }; print_data.new_balance = ( print_data.previous_balance * 100 - diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index 83a6a6fecd..10a97e4273 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -256,7 +256,8 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , } $scope.print_receipt = function() { - var print_data = {circulations : []} + var print_data = {circulations : []}; + var cusr = patronSvc.current; if ($scope.checkouts.length == 0) return $q.when(); @@ -272,7 +273,21 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , }; }); + // This is repeated in patron.* so everyting is in one place but left here so existing templates don't break. print_data.patron_money = patronSvc.patron_stats.fines; + print_data.patron = { + prefix : cusr.prefix(), + first_given_name : cusr.first_given_name(), + second_given_name : cusr.second_given_name(), + family_name : cusr.family_name(), + suffix : cusr.suffix(), + card : { barcode : cusr.card().barcode() }, + money_summary : patronSvc.patron_stats.fines, + expire_date : cusr.expire_date(), + alias : cusr.alias(), + has_email : Boolean($scope.has_email_address()), + has_phone : Boolean(cusr.day_phone() || cusr.evening_phone() || cusr.other_phone()) + }; return egCore.print.print({ context : 'default', diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js b/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js index 777900aa0d..ac189f95a5 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js @@ -345,7 +345,8 @@ function($scope, $q, $routeParams, $timeout, egCore , egUser, patronSvc , $ $scope.print_receipt = function(items) { if (items.length == 0) return $q.when(); - var print_data = {circulations : []} + var print_data = {circulations : []}; + var cusr = patronSvc.current; angular.forEach(patronSvc.items_out, function(circ) { print_data.circulations.push({ @@ -357,6 +358,20 @@ function($scope, $q, $routeParams, $timeout, egCore , egUser, patronSvc , $ }) }); + print_data.patron = { + prefix : cusr.prefix(), + first_given_name : cusr.first_given_name(), + second_given_name : cusr.second_given_name(), + family_name : cusr.family_name(), + suffix : cusr.suffix(), + card : { barcode : cusr.card().barcode() }, + money_summary : patronSvc.patron_stats.fines, + expire_date : cusr.expire_date(), + alias : cusr.alias(), + has_email : Boolean(patronSvc.current.email() && patronSvc.current.email().match(/.*@.*/).length), + has_phone : Boolean(cusr.day_phone() || cusr.evening_phone() || cusr.other_phone()) + }; + return egCore.print.print({ context : 'default', template : 'items_out', -- 2.43.2