From: phasefx Date: Wed, 9 Dec 2009 13:36:50 +0000 (+0000) Subject: rough-cut of a payment-history interface X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=536518d916bc9d06ee7845b2a9dbe56e84d6ad79;p=contrib%2FConifer.git rough-cut of a payment-history interface git-svn-id: svn://svn.open-ils.org/ILS/trunk@15114 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 7c8bf63a37..3284d8b4dc 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2532,6 +2532,10 @@ + + + + diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index 1d22a879db..cd11be8cc5 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -228,6 +228,7 @@ const api = { 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids.authoritative' }, 'FM_MP_RETRIEVE_VIA_MBTS_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all' }, 'FM_MP_RETRIEVE_VIA_MBTS_ID.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all.authoritative' }, + 'FM_MP_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.payments.retrieve' }, 'FM_MP_NOTE_EDIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.note.edit' }, 'FM_MG_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.create' }, 'FM_MG_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.retrieve' }, diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.js b/Open-ILS/xul/staff_client/server/patron/bill_history.js index f7648f0046..e96d4898f4 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.js +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.js @@ -1,4 +1,5 @@ function $(id) { return document.getElementById(id); } +var payment_history_fetched = false; function tally_selected() { try { @@ -76,6 +77,11 @@ function retrieve_mbts_for_list() { function init_lists() { JSAN.use('util.list'); JSAN.use('circ.util'); + init_main_list(); + init_payments_list(); +} + +function init_main_list() { g.bill_list_selection = []; g.bill_list = new util.list('bill_tree'); @@ -130,6 +136,34 @@ function init_lists() { g.bill_list.set_list_actions(); } +function init_payments_list() { + g.payments_list_selection = []; + + g.payments_list = new util.list('payments_tree'); + + g.payments_list.init( { + 'columns' : g.payments_list.fm_columns('mp'), + 'on_select' : function(ev) { + JSAN.use('util.functional'); + g.payments_list_selection = util.functional.map_list( + g.payments_list.retrieve_selection(), + function(o) { return o.getAttribute('retrieve_id'); } + ); + }, + 'retrieve_row' : function(params) { + var id = params.retrieve_id; + var row = params.row; + if (typeof params.on_retrieve == 'function') { + params.on_retrieve(row); + }; + return row; + }, + } ); + + $('payments_list_actions').appendChild( g.payments_list.render_list_actions() ); + g.payments_list.set_list_actions(); +} + function my_init() { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); @@ -247,4 +281,51 @@ function print_bills() { } } +function payment_history_init() { + try { + if (payment_history_fetched) { return; } else { payment_history_fetched = true; } + + g.payments_list.clear(); + + $('payments_meter').hidden = false; + fieldmapper.standardRequest( + [ api.FM_MP_RETRIEVE_VIA_USER.app, api.FM_MP_RETRIEVE_VIA_USER.method ], + { async: true, + params: [ses(), g.patron_id], + onresponse: function(r) { + try { + var result = r.recv().content(); + + if (result && typeof result.ilsevent == 'undefined') { + g.payments_list.append( + { + 'retrieve_id' : result.id(), + 'row' : { + 'my' : { + 'mp' : result + } + } + } + ); + } else { + throw( js2JSON(result) ); + } + } catch(E) { + alert('Error retrieving payment in bill_history.js, onresponse: ' + E); + } + }, + oncomplete: function() { + $('payments_meter').hidden = true; + }, + onerror: function(r) { + var result = r.recv().content(); + alert('Error retrieving payment in bill_history.js, onerror: ' + js2JSON(result)); + } + } + ); + + } catch(E) { + alert('Error in bill_history.js, payment_history_init(): ' + E); + } +} diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.xul b/Open-ILS/xul/staff_client/server/patron/bill_history.xul index 613e9bd05a..53e7c79c2e 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.xul @@ -26,8 +26,8 @@ - - + +