From eba24ce457949151ec96d73d4097b959f9c83c2e Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Wed, 30 Dec 2009 20:55:27 +0000 Subject: [PATCH] maintenance interface for patrons with negative balances. TODO: add library filter git-svn-id: svn://svn.open-ils.org/ILS/trunk@15254 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/locale/en-US/lang.dtd | 5 + .../staff_client/chrome/content/main/constants.js | 2 + .../xul/staff_client/chrome/content/main/menu.js | 10 ++ .../chrome/content/main/menu_frame_menus.xul | 2 + .../chrome/locale/en-US/offline.properties | 1 + .../server/admin/patrons_due_refunds.js | 173 +++++++++++++++++++++ .../server/admin/patrons_due_refunds.xul | 67 ++++++++ 7 files changed, 260 insertions(+) create mode 100644 Open-ILS/xul/staff_client/server/admin/patrons_due_refunds.js create mode 100644 Open-ILS/xul/staff_client/server/admin/patrons_due_refunds.xul diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 25e1748bb7..9da593cba6 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -181,6 +181,9 @@ <!ENTITY staff.admin.work_log.list1.retrieve_patron_btn.accesskey "P"> <!ENTITY staff.admin.work_log.list2.retrieve_patron_btn.label "Retrieve Patron"> <!ENTITY staff.admin.work_log.list2.retrieve_patron_btn.accesskey "n"> +<!ENTITY staff.admin.patrons_due_refunds.caption "Patrons With Negative Balances"> +<!ENTITY staff.admin.patrons_due_refunds.menu.actions.label "Actions for Selected Patrons"> +<!ENTITY staff.admin.patrons_due_refunds.menu.actions.accesskey "A"> <!ENTITY staff.auth.login_header "Log in"> <!ENTITY staff.auth.logoff_prompt "Log off"> <!ENTITY staff.auth.logoff_prompt.accesskey "f"> @@ -654,6 +657,8 @@ <!ENTITY staff.main.menu.admin.local_admin.hold_matrix_matchpoint.label "Hold Policies"> <!ENTITY staff.main.menu.admin.local_admin.work_log.label "Work Log"> <!ENTITY staff.main.menu.admin.local_admin.work_log.accesskey "W"> +<!ENTITY staff.main.menu.admin.local_admin.patrons_due_refunds.label "Patrons with Negative Balances"> +<!ENTITY staff.main.menu.admin.local_admin.patrons_due_refunds.accesskey "N"> <!ENTITY staff.main.menu.admin.server_admin.label "Server Administration"> <!ENTITY staff.main.menu.admin.server_admin.conify.org_unit_type.label "Organization Types"> 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 240bc0fb22..e5f039178b 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -152,6 +152,7 @@ const api = { 'FM_ATEV_APROPOS_CIRC_VIA_COPY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.copy.events.circ', 'secure' : true }, 'FM_ATEV_CANCEL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.event.cancel.batch', 'secure' : false }, 'FM_ATEV_RESET' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.event.reset.batch', 'secure' : false }, + 'FM_AU_BLOBS_WITH_NEGATIVE_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.users.negative_balance' }, 'FM_AU_ID_RETRIEVE_VIA_BARCODE_OR_USERNAME' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve_id_by_barcode_or_username' }, 'FM_AU_IDS_RETRIEVE_VIA_HASH' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.search.advanced' }, 'FM_AU_LIST_RETRIEVE_VIA_GROUP' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.members.retrieve' }, @@ -356,6 +357,7 @@ const urls = { 'XUL_PATRON_DISPLAY' : '/xul/server/patron/display.xul', 'XUL_PATRON_HORIZ_DISPLAY' : '/xul/server/patron/display_horiz.xul', 'XUL_PATRON_EDIT' : '/eg/actor/user/register', + 'XUL_PATRONS_DUE_REFUNDS' : '/xul/server/admin/patrons_due_refunds.xul', 'XUL_USER_PERM_EDITOR' : '/xul/server/patron/user_edit.xhtml', 'XUL_PATRON_HOLDS' : '/xul/server/patron/holds.xul', 'XUL_PATRON_INFO_NOTES' : '/xul/server/patron/info_notes.xul', diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index fe4cbea8a7..8f33a00469 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -581,6 +581,16 @@ main.menu.prototype = { ); } ], + 'cmd_local_admin_patrons_due_refunds' : [ + ['oncommand'], + function() { + obj.set_tab( + obj.url_prefix(urls.XUL_PATRONS_DUE_REFUNDS), + { 'tab_name' : offlineStrings.getString('menu.local_admin.patrons_due_refunds.tab') }, + {} + ); + } + ], 'cmd_server_admin_org_type' : [ ['oncommand'], function() { open_conify_page('actor/org_unit_type', null); } diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul index 3ea5cbf1cb..f1e1c6b6e5 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul @@ -114,6 +114,7 @@ <command id="cmd_local_admin_circ_matrix_matchpoint"/> <command id="cmd_local_admin_hold_matrix_matchpoint"/> <command id="cmd_local_admin_work_log"/> + <command id="cmd_local_admin_patrons_due_refunds"/> <!-- server admin menu commands --> <command id="cmd_server_admin_org_type"/> @@ -320,6 +321,7 @@ <menuitem label="&staff.server.admin.index.transit_list;" command="cmd_local_admin_transit_list"/> <menuitem label="&staff.main.menu.admin.local_admin.circ_matrix_matchpoint.label;" command="cmd_local_admin_circ_matrix_matchpoint"/> <menuitem label="&staff.main.menu.admin.local_admin.hold_matrix_matchpoint.label;" command="cmd_local_admin_hold_matrix_matchpoint"/> + <menuitem label="&staff.main.menu.admin.local_admin.patrons_due_refunds.label;" accesskey="&staff.main.menu.admin.local_admin.patrons_due_refunds.accesskey;" command="cmd_local_admin_patrons_due_refunds"/> <menuitem label="&staff.main.menu.admin.local_admin.work_log.label;" accesskey="&staff.main.menu.admin.local_admin.work_log.accesskey;" command="cmd_local_admin_work_log"/> </menupopup> </menu> diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties index 224ddfa881..4364aa28a1 100644 --- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties @@ -240,6 +240,7 @@ menu.cmd_booking_pull_list.tab=Booking Pull List menu.local_admin.circ_matrix_matchpoint.tab=Circulation Policies menu.local_admin.hold_matrix_matchpoint.tab=Hold Policies menu.local_admin.work_log.tab=Work Log +menu.local_admin.patrons_due_refunds.tab=Patrons With Negative Balances menu.circulation.staged_patrons.tab=Pending Patrons load_printer_settings_error_description=Printer settings did not load cleanly with this version of Evergreen. You should reconfigure your printer under Printer Settings Editor. load_printer_settings_error_title=Printer Settings diff --git a/Open-ILS/xul/staff_client/server/admin/patrons_due_refunds.js b/Open-ILS/xul/staff_client/server/admin/patrons_due_refunds.js new file mode 100644 index 0000000000..03e88d71cc --- /dev/null +++ b/Open-ILS/xul/staff_client/server/admin/patrons_due_refunds.js @@ -0,0 +1,173 @@ +var list; var error; var net; var rows; + +function $(id) { return document.getElementById(id); } + +//// parent interfaces often call these +function default_focus() { $('au_list').focus(); } +function refresh() { populate_list(); } +//// + +function patrons_due_refunds_init() { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + if (typeof JSAN == 'undefined') { + throw( + $('commonStrings').getString('common.jsan.missing') + ); + } + + JSAN.errorLevel = "die"; // none, warn, or die + JSAN.addRepository('..'); + + JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve(); + + JSAN.use('util.error'); error = new util.error(); + JSAN.use('util.network'); net = new util.network(); + JSAN.use('patron.util'); + JSAN.use('util.list'); + JSAN.use('util.money'); + JSAN.use('util.functional'); + JSAN.use('util.widgets'); + + dojo.require('openils.Util'); + dojo.require('dojo.date.locale'); + dojo.require('dojo.date.stamp'); + + init_list(); + $('list_actions').appendChild( list.render_list_actions() ); + list.set_list_actions(); + $('retrieve_patron').addEventListener('command', handle_retrieve, false); + populate_list(); + default_focus(); + + } catch(E) { + var err_prefix = 'patrons_due_refundss.js -> patrons_due_refunds_init() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } +} + +function handle_retrieve() { + try { + var sel = list.retrieve_selection(); + var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } ); + + var seen = {}; + for (var i = 0; i < ids.length; i++) { + var patron_id = ids[i]; + if (typeof patron_id == 'null') continue; + if (seen[patron_id]) continue; seen[patron_id] = true; + xulG.new_patron_tab( + {}, + { 'id' : patron_id } + ); + } + + } catch(E) { + alert('Error in admin/patrons_due_refunds.js, handle_retrieve(): ' + E); + } +} + +function init_list() { + try { + + list = new util.list( 'au_list' ); + list.init( + { + 'columns' : [].concat( + list.fm_columns('au',{ + '*' : { 'hidden' : true }, + 'au_family_name' : { 'hidden' : false }, + 'au_first_given_name' : { 'hidden' : false }, + 'au_second_given_name' : { 'hidden' : false }, + 'au_barred' : { 'hidden' : false }, + 'au_dob' : { 'hidden' : false } + }) + ).concat([ + { + 'id' : 'balance_owed', 'label' : 'Balance Owed', 'sort_type' : 'money', 'render' : function(my) { + return util.money.sanitize( my.balance_owed ); + } + }, + { + 'id' : 'last_billing_activity', 'label' : 'Last Billing Activity', 'sort_type' : 'date', 'render' : function(my) { + return dojo.date.locale.format( dojo.date.stamp.fromISOString(my.last_billing_activity) ); + } + } + ]), + 'retrieve_row' : retrieve_row, + 'on_select' : handle_selection + } + ); + + } catch(E) { + var err_prefix = 'patron_due_refunds.js -> init_list() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } +} + +function retrieve_row(params) { // callback function for fleshing rows in a list + params.row_node.setAttribute('retrieve_id',params.row.my.au.id()); + params.on_retrieve(params.row); + return params.row; +} + +function handle_selection(ev) { // handler for list row selection event + var sel = list.retrieve_selection(); + if (sel.length > 0) { + $('retrieve_patron').setAttribute('disabled','false'); + } else { + $('retrieve_patron').setAttribute('disabled','true'); + } +}; + +function populate_list() { + try { + + rows = {}; + list.clear(); + $('progress').hidden = false; + + function onResponse(r) { + try { + var robj = openils.Util.readResponse(r); + var row_params = { + 'row' : { + 'my' : { + 'au' : robj.usr, + 'balance_owed' : robj.balance_owed, + 'last_billing_activity' : robj.last_billing_activity + } + } + }; + rows[ robj.usr.id() ] = list.append( row_params ); + } catch(E) { + alert('Error in patrons_due_refunds.js, populate_list, onResponse(): ' + E); + } + } + + function onError(r) { + try { + var robj = openils.Util.readResponse(r); + alert('error, robj = ' + js2JSON(robj)); + } catch(E) { + alert('Error in patrons_due_refunds.js, populate_list, onError(): ' + E); + } + } + + fieldmapper.standardRequest( + [api['FM_AU_BLOBS_WITH_NEGATIVE_BALANCE'].app, api['FM_AU_BLOBS_WITH_NEGATIVE_BALANCE'].method ], + { async: true, + params: [ses()], + onresponse : onResponse, + onerror : onError, + oncomplete : function() { + $('progress').hidden = true; + } + } + ); + + } catch(E) { + alert('Error in patrons_due_refunds.js, populate_list(): ' + E); + } +} diff --git a/Open-ILS/xul/staff_client/server/admin/patrons_due_refunds.xul b/Open-ILS/xul/staff_client/server/admin/patrons_due_refunds.xul new file mode 100644 index 0000000000..94f7bab752 --- /dev/null +++ b/Open-ILS/xul/staff_client/server/admin/patrons_due_refunds.xul @@ -0,0 +1,67 @@ +<?xml version="1.0"?> +<!-- Application: Evergreen Staff Client --> +<!-- Screen: Cancel/Reset Action::Trigger Events for Patron --> + +<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// --> +<!-- PRESENTATION --> +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> +<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?> + +<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// --> +<!-- LOCALIZATION --> +<!DOCTYPE window PUBLIC "" ""[ + <!--#include virtual="/opac/locale/${locale}/lang.dtd"--> +]> + +<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// --> +<!-- OVERLAYS --> +<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?> + +<window id="patrons_due_refunds_win" onload="try { font_helper(); persist_helper(); patrons_due_refunds_init(); } catch(E) { alert(E); }" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// --> + <!-- BEHAVIOR --> + <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true;</script> + <scripts id="openils_util_scripts"/> + + <script type="text/javascript" src="/xul/server/main/JSAN.js"/> + <script type="text/javascript" src="patrons_due_refunds.js"/> + + <messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties" /> + + <commandset id="patrons_due_refunds_cmds"> + <command id="retrieve_patron" label="&staff.patron.display_overlay.retrieve_patron.label;" accesskey="&staff.patron.display_overlay.retrieve_patron.accesskey;" /> + </commandset> + + <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// --> + <!-- CONTENT --> + <groupbox id="patrons_due_refunds_groupbox" flex="1" class="my_overflow"> + <caption id="patrons_due_refunds_caption" label="&staff.admin.patrons_due_refunds.caption;"/> + <vbox flex="0"> + <hbox flex="1"> + <spacer flex="1" /> + <progressmeter id="progress" flex="1" hidden="true" mode="undetermined"/> + <menubar> + <menu label="&staff.admin.patrons_due_refunds.menu.actions.label;" + accesskey="&staff.admin.patrons_due_refunds.menu.actions.accesskey;" + style="-moz-user-focus: normal"> + <menupopup> + <menuitem command="retrieve_patron" /> + </menupopup> + </menu> + </menubar> + </hbox> + </vbox> + <tree id="au_list" flex="1" enableColumnDrag="true" context="au_actions" /> + <hbox id="list_actions" /> + </groupbox> + + <popupset id="au_popupset"> + <popup id="au_actions" position="at_pointer"> + <menuitem command="retrieve_patron" /> + </popup> + </popupset> + +</window> + -- 2.11.0