From: berick Date: Fri, 4 Mar 2011 21:38:07 +0000 (-0500) Subject: refresh page after payment is made to clear out stale data; disable payment on <... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ce97a6a6b3f12e53169c8ba0d5ee655105903dd1;p=evergreen%2Fequinox.git refresh page after payment is made to clear out stale data; disable payment on <=0 fines --- diff --git a/Open-ILS/web/opac/skin/kcls/js/myopac.js b/Open-ILS/web/opac/skin/kcls/js/myopac.js index 2434cc0f86..e1094d01f4 100644 --- a/Open-ILS/web/opac/skin/kcls/js/myopac.js +++ b/Open-ILS/web/opac/skin/kcls/js/myopac.js @@ -256,7 +256,7 @@ function myOPACDrawSummary() { $('myopac_sum_pickup').innerHTML = "("+stats.holds.ready+")"; $('myopac_sum_checked').innerHTML = "("+ (stats.checkouts.out+stats.checkouts.overdue) +")"; $('myopac_sum_holds').innerHTML = "("+stats.holds.total+")"; - if(stats.fines.balance_owed > 0) { + if(stats.fines.balance_owed != 0) { var bal = $('myopac_sum_fines_bal'); bal.style.color = "red"; appendClear(bal, text("$" + Number(stats.fines.balance_owed).toFixed(2))); @@ -1466,14 +1466,14 @@ function _myopacDrawPayments(r) { ); } -function emailPaymentReceipt(paymentIds, callback) { +function emailPaymentReceipt(paymentIds, callback, noprog) { if(!G.user.email()) { if(callback) callback(); return; } - progressDialog.show(true); + if(!noprog) progressDialog.show(true); fieldmapper.standardRequest( ['open-ils.circ', 'open-ils.circ.money.payment_receipt.email'], @@ -1481,7 +1481,7 @@ function emailPaymentReceipt(paymentIds, callback) { async : true, params : [G.user.session, paymentIds], oncomplete : function(r) { - progressDialog.hide(); + if(!noprog) progressDialog.hide(); openils.Util.readResponse(r); if(callback) callback(); } @@ -1508,6 +1508,9 @@ function myopacShowGenericTransaction( trans ) { $n(row,'myopac_trans_balance').appendChild(text(_finesFormatNumber(trans.balance_owed()))); $n(row,'selector').balance_owed = trans.balance_owed(); $n(row,'selector').setAttribute("xact", trans.id()); + if(trans.balance_owed() <= 0) { + $n(row,'selector').disabled = true; + } var req = new Request(FETCH_MONEY_BILLING, G.user.session, trans.id()); req.send(true); @@ -1548,6 +1551,9 @@ function myOPACShowCircTransaction(trans, record, circ) { $n(row,'myopac_circ_trans_balance').appendChild(text(_finesFormatNumber(trans.balance_owed()))); $n(row,'selector').balance_owed = trans.balance_owed(); $n(row,'selector').setAttribute("xact",trans.id()); + if(trans.balance_owed() <= 0) { + $n(row,'selector').disabled = true; + } tbody.appendChild(row); unHideMe($('myopac_circ_trans_div')); @@ -1592,12 +1598,14 @@ function showPaymentForm() { } G.user.last_xact_id(resp.last_xact_id); // update to match latest from server $('cc-payment-error-message').innerHTML = ecom_event_map.SUCCESS; - printPaymentReceipt(resp.payments); - emailPaymentReceipt(resp.payments); + printPaymentReceipt(resp.payments, function() { location.href = location.href; } ); + emailPaymentReceipt(resp.payments, null, true); + /* hideMe($('pay_fines_now'));unHideMe($('acct_sum')); finesShown = false; myOPACShowFines(); showFinesDiv($('show_fines_link')); + */ } ); } @@ -2223,6 +2231,7 @@ function printData(data, numItems, callback) { frame.document.body.innerHTML = ''; // hideMe($('receipt-print-frame-wrapper')); receiptPrintDialog.hide(); + if(callback) callback(); } $('receipt-view-print-button').onclick = function() { @@ -2243,8 +2252,8 @@ function printData(data, numItems, callback) { } -function printPaymentReceipt(paymentIds, callback) { - progressDialog.show(true); +function printPaymentReceipt(paymentIds, callback, noprog) { + if(!noprog) progressDialog.show(true); fieldmapper.standardRequest( ['open-ils.circ', 'open-ils.circ.money.payment_receipt.print'], @@ -2255,7 +2264,7 @@ function printPaymentReceipt(paymentIds, callback) { var resp = openils.Util.readResponse(r); var output = ""; if(resp) output = resp.template_output(); - progressDialog.hide(); + if(!noprog) progressDialog.hide(); if(output) { printData(output.data(), 1, callback); } else {