From 90a1541009121894332a79760caa6e4e95973421 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 28 Nov 2018 11:14:00 -0500 Subject: [PATCH] JBAS-2153 Limit lost refund tracking by ptype/cirdmod Only track as refundable cash/check payments for checkouts on refunable circ modifiers. Signed-off-by: Bill Erickson --- Open-ILS/xul/staff_client/server/patron/bill2.js | 25 +++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index f2ca8e8c0c..708e821005 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -263,6 +263,8 @@ function event_listeners() { * being processed OR if the dialog is manually skipped. * Returns payment args (with 2ndry auth data) on successful Submit. */ +// TODO: move this designation into the database +var NO_REFUND_CIRC_MODIFIERS = ['1', '7', '45', '46', '66', '40', '41']; function handle_lost_payment_dialog(payment_blob) { var lostpaid_xacts = []; @@ -274,11 +276,16 @@ function handle_lost_payment_dialog(payment_blob) { row_ids.forEach(function(row_id) { var row_params = g.row_map[row_id]; var circ = row_params.row.my.circ; - if (!circ) return; - if (circ.id() == xact[0]) { - if (circ.stop_fines() == 'LOST' && !circ.checkin_time()) { - lostpaid_xacts.push(xact[0]); - } + var copy = row_params.row.my.acp; + + if (!circ || !copy) return; + if (circ.id() != xact[0]) return; + + if (circ.stop_fines() == 'LOST' && // lost payment + !circ.checkin_time() && // still checked out + NO_REFUND_CIRC_MODIFIERS.indexOf(''+copy.circ_modifier()) < 0) { + + lostpaid_xacts.push(xact[0]); } }); }); @@ -1185,8 +1192,12 @@ function apply_payment() { return; } - payment_blob = handle_lost_payment_dialog(payment_blob); - if (payment_blob === null) return; // payment canceled via dialog + if (payment_blob.payment_type == 'cash_payment' || + payment_blob.payment_type == 'check_payment') { + payment_blob = handle_lost_payment_dialog(payment_blob); + + if (payment_blob === null) return; // canceled via dialog + } if ( pay( payment_blob ) ) { -- 2.11.0