From 835bac82ee0e6fc1fc775f1308c5c08b6b04eeaf Mon Sep 17 00:00:00 2001 From: Bill Erickson <berickxx@gmail.com> Date: Wed, 16 May 2018 17:24:05 -0400 Subject: [PATCH] LP#1639022 Webstaff convert change to credit Add support for converting change to patron credit in the patron bills interface, consistent with the XUL feature. When the 'circ.disable_patron_credit' org unit setting is applied, the option is hidden. Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Laura Sachjen <sachjenl@branchdistrictlibrary.org> Signed-off-by: Kathy Lussier <klussier@masslnc.org> --- .../src/templates/staff/circ/patron/t_bills.tt2 | 8 ++++++++ .../web/js/ui/default/staff/circ/patron/bills.js | 23 ++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 index bdc6c276d8..d37f336fbd 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 @@ -105,6 +105,14 @@ off to the right. flex-row is honoring the boundaries better. not sure what's up, there. --> <div class="flex-row" ng-if="!disable_auto_print"> <div class="flex-cell"></div> + <div ng-hide="disablePatronCredit" class="pad-right"> + <div class="checkbox"> + <label> + <input type="checkbox" ng-model="convert_to_credit.isChecked"> + [% l('Convert Change to Patron Credit') %] + </label> + </div> + </div> <form class="form-inline" role="form"> <div class="checkbox"> <label> 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 392b696179..e1d1686070 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 @@ -12,9 +12,12 @@ function($q , egCore , egWorkLog , patronSvc) { // fetch org unit settings specific to the bills display service.fetchBillSettings = function() { if (service.settings) return $q.when(service.settings); - return egCore.org.settings( - ['ui.circ.billing.uncheck_bills_and_unfocus_payment_box','ui.circ.billing.amount_warn','ui.circ.billing.amount_limit','circ.staff_client.do_not_auto_attempt_print'] - ).then(function(s) {return service.settings = s}); + return egCore.org.settings([ + 'ui.circ.billing.uncheck_bills_and_unfocus_payment_box', + 'ui.circ.billing.amount_warn', 'ui.circ.billing.amount_limit', + 'circ.staff_client.do_not_auto_attempt_print', + 'circ.disable_patron_credit' + ]).then(function(s) {return service.settings = s}); } // user billing summary @@ -24,7 +27,9 @@ function($q , egCore , egWorkLog , patronSvc) { .then(function(summary) {return service.summary = summary}) } - service.applyPayment = function(type, payments, note, check, cc_args) { + service.applyPayment = function( + type, payments, note, check, cc_args, patron_credit) { + return egCore.net.request( 'open-ils.circ', 'open-ils.circ.money.payment', @@ -34,7 +39,7 @@ function($q , egCore , egWorkLog , patronSvc) { payment_type : type, check_number : check, payments : payments, - patron_credit : 0, + patron_credit : patron_credit, cc_args : cc_args }, patronSvc.current.last_xact_id() @@ -179,6 +184,7 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, $scope.annotate_payment = false; $scope.receipt_count = 1; $scope.receipt_on_pay = { isChecked: false }; + $scope.convert_to_credit = {isChecked: false}; $scope.warn_amount = 1000; $scope.max_amount = 100000; $scope.amount_verified = false; @@ -338,8 +344,10 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, function sendPayment(note, cc_args) { $scope.applyingPayment = true; var make_payments = generatePayments(); + var patron_credit = $scope.convert_to_credit.isChecked ? + $scope.pending_change() : 0; billSvc.applyPayment($scope.payment_type, - make_payments, note, $scope.check_number, cc_args) + make_payments, note, $scope.check_number, cc_args, patron_credit) .then( function(payment_ids) { @@ -479,6 +487,9 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, s['circ.staff_client.do_not_auto_attempt_print'].indexOf('Bill Pay') > -1 ); } + if (s['circ.disable_patron_credit']) { + $scope.disablePatronCredit = true; + } }); $scope.gridControls.allItemsRetrieved = function() { -- 2.11.0