From: Bill Erickson Date: Wed, 28 Nov 2018 16:14:00 +0000 (-0500) Subject: JBAS-2153 Limit lost refund tracking by ptype/cirdmod X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=90a1541009121894332a79760caa6e4e95973421;p=working%2FEvergreen.git 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 --- 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 ) ) {