From: phasefx Date: Wed, 16 Dec 2009 23:39:30 +0000 (+0000) Subject: balance owed total for group members in horizontal patron summary pane, group tab... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fb77d7d503f5dacc6f6f77cb7cc6acb684a6b0f5;p=evergreen%2Fbjwebb.git balance owed total for group members in horizontal patron summary pane, group tab label. Need to figure out why the CSS isn't working git-svn-id: svn://svn.open-ils.org/ILS/trunk@15178 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 dd3d0f571..841cbbd9d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -51,6 +51,7 @@ const api = { 'BLOB_MBTS_DETAILS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transaction.fleshed.retrieve', 'secure' : false }, 'BLOB_MOBTS_CIRC_MVR_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.fleshed' }, 'BLOB_MOBTS_CIRC_MVR_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.fleshed' }, + 'BLOB_BALANCE_OWED_VIA_USERGROUP' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.members.balance_owed.authoritative' }, 'BUCKET_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.create' }, 'BUCKET_FLESH' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.flesh' }, 'BUCKET_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.full_delete' }, diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index 6e4a41ee4..9567f0857 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -332,6 +332,8 @@ staff.patron.summary.group_list.column.family_name.label=Family Name staff.patron.summary.group_list.column.first_given_name.label=First Name staff.patron.summary.group_list.column.second_given_name.label=Middle Name staff.patron.summary.group_list.column.home_ou.label=Home Lib +staff.patron.summary.group_list.column.balance_owed.label=Balance Owed +staff.patron.summary.tab.group_list_with_total_owed.label=Group: %1$s staff.patron.staged.register_patron=Registering Pending Patron: %1$s staff.patron.staged.confirm_patron_delete=Delete the selected patrons? staff.patron.staged.error_on_delete=Error deleting pending patron with row_id = %1$s diff --git a/Open-ILS/xul/staff_client/server/patron/summary.js b/Open-ILS/xul/staff_client/server/patron/summary.js index 62be6483f..5405ab17a 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary.js +++ b/Open-ILS/xul/staff_client/server/patron/summary.js @@ -46,7 +46,10 @@ patron.summary.prototype = { 'render' : function(my) { return my.second_given_name; } }, { 'id' : 'gl_home_lib', 'flex' : 1, 'hidden' : true, 'label' : patronStrings.getString('staff.patron.summary.group_list.column.home_ou.label'), - 'render' : function(my) { return obj.OpenILS.data.hash.aou[ my.home_ou ].shortname(); } } + 'render' : function(my) { return obj.OpenILS.data.hash.aou[ my.home_ou ].shortname(); } }, + { 'id' : 'gl_balance_owed', 'flex' : 1, + 'label' : patronStrings.getString('staff.patron.summary.group_list.column.balance_owed.label'), + 'render' : function(my) { return my.balance_owed; } } ], 'retrieve_row' : function(params) { var id = params.retrieve_id; @@ -56,6 +59,9 @@ patron.summary.prototype = { row.my.first_given_name = blob[1]; row.my.second_given_name = blob[2]; row.my.home_ou = blob[3]; + if (obj.group_owed[ id ]) { + row.my.balance_owed = obj.group_owed[ id ]; + } if (typeof params.on_retrieve == 'function') { params.on_retrieve(row); } @@ -246,31 +252,75 @@ patron.summary.prototype = { } } obj.network.simple_request( - 'FM_MOUS_RETRIEVE.authoritative', - [ ses(), obj.patron.id() ], + 'BLOB_BALANCE_OWED_VIA_USERGROUP', + [ ses(), obj.patron.usrgroup() ], function(req) { try { JSAN.use('util.money'); var robj = req.getResultObject(); - util.widgets.set_text(e, patronStrings.getFormattedString('staff.patron.summary.patron_bill.money', [util.money.sanitize( robj.balance_owed() )])); - if (under_btn) util.widgets.set_text(under_btn, - patronStrings.getFormattedString('staff.patron.summary.patron_bill.money', [util.money.sanitize( robj.balance_owed() )])); - var show_billing_tab_on_bills = String( obj.OpenILS.data.hash.aous['ui.circ.show_billing_tab_on_bills'] ) == 'true'; - if (show_billing_tab_on_bills && Number(robj.balance_owed()) > 0) { - if (xulG) { - if (xulG.display_window) { - if (! obj.show_billing_tab_on_bills_done_once ) { - xulG.display_window.g.patron.skip_hide_summary = true; - xulG.display_window.util.widgets.dispatch('command','cmd_patron_bills'); - obj.show_billing_tab_on_bills_done_once = 1; + if (typeof robj.ils_event != 'undefined') { throw(robj); } + + var sum = 0; /* in cents */ + obj.group_owed = {}; + + function render_main_patron_bill_summary(bs) { + try { + util.widgets.set_text( + e, + patronStrings.getFormattedString('staff.patron.summary.patron_bill.money', [util.money.sanitize( bs.balance_owed )]) + ); + if (under_btn) { + util.widgets.set_text( + under_btn, + patronStrings.getFormattedString('staff.patron.summary.patron_bill.money', [util.money.sanitize( bs.balance_owed )]) + ); + } + var show_billing_tab_on_bills = String( obj.OpenILS.data.hash.aous['ui.circ.show_billing_tab_on_bills'] ) == 'true'; + if (show_billing_tab_on_bills && Number(bs.balance_owed) > 0) { + if (xulG) { + if (xulG.display_window) { + if (! obj.show_billing_tab_on_bills_done_once ) { + xulG.display_window.g.patron.skip_hide_summary = true; + xulG.display_window.util.widgets.dispatch('command','cmd_patron_bills'); + obj.show_billing_tab_on_bills_done_once = 1; + } + } + } + }; + obj.bills_summary = bs; + if (obj.holds_summary && obj.bills_summary) { + if (typeof window.xulG == 'object' && typeof window.xulG.stop_sign_page == 'function') { + window.xulG.stop_sign_page( obj.patron, { 'holds_summary' : obj.holds_summary, 'bills_summary' : obj.bills_summary } ); } } + } catch(E) { + alert('Error in summary.js, render_main_patron_bill_summary(): ' + E); } } - obj.bills_summary = robj; - if (obj.holds_summary && obj.bills_summary) - if (typeof window.xulG == 'object' && typeof window.xulG.stop_sign_page == 'function') - window.xulG.stop_sign_page( obj.patron, { 'holds_summary' : obj.holds_summary, 'bills_summary' : obj.bills_summary } ); + + var rendered_main_patron_bill_summary = false; + for (var i = 0; i < robj.length; i++) { + if (robj[i].usr == obj.patron.id()) { + render_main_patron_bill_summary( robj[i] ); + rendered_main_patron_bill_summary = true; + } else { + sum += util.money.dollars_float_to_cents_integer( robj[i].balance_owed ); + obj.group_owed[ robj[i].usr ] = robj[i].balance_owed; + } + } + if (!rendered_main_patron_bill_summary) { + render_main_patron_bill_summary( { balance_owed: 0.00, usr: obj.patron.id() } ); + } + if (sum > 0) { + var tab = $('group_tab'); + addCSSClass(tab,'balance_owed'); + } else { + removeCSSClass(tab,'balance_owed'); + } + tab.setAttribute( + 'label', + patronStrings.getFormattedString('staff.patron.summary.tab.group_list_with_total_owed.label',[ util.money.cents_as_dollars( sum ) ]) + ); } catch(E) { alert('Error in summary.js, patron_bill callback: ' + E); } diff --git a/Open-ILS/xul/staff_client/server/skin/patron_summary.css b/Open-ILS/xul/staff_client/server/skin/patron_summary.css index 0f085e065..cb4d4f1ea 100755 --- a/Open-ILS/xul/staff_client/server/skin/patron_summary.css +++ b/Open-ILS/xul/staff_client/server/skin/patron_summary.css @@ -3,6 +3,8 @@ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); @namespace html url("http://www.w3.org/TR/REC-html40"); +.balance_owed { border: solid thin red; } + .NO_PENALTY { background-color: lime; color: black; } .PENALTY_RENEW { background-color: yellow; color: black; } .PENALTY_HOLD { background-color: orange; color: black; }