[open-ils-commits] r15178 - in trunk/Open-ILS/xul/staff_client: chrome/content/main server/locale/en-US server/patron server/skin (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Dec 16 18:39:37 EST 2009


Author: phasefx
Date: 2009-12-16 18:39:30 -0500 (Wed, 16 Dec 2009)
New Revision: 15178

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
   trunk/Open-ILS/xul/staff_client/server/patron/summary.js
   trunk/Open-ILS/xul/staff_client/server/skin/patron_summary.css
Log:
balance owed total for group members in horizontal patron summary pane, group tab label.  Need to figure out why the CSS isn't working

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-12-16 22:34:24 UTC (rev 15177)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-12-16 23:39:30 UTC (rev 15178)
@@ -51,6 +51,7 @@
     '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' },

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties	2009-12-16 22:34:24 UTC (rev 15177)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties	2009-12-16 23:39:30 UTC (rev 15178)
@@ -332,6 +332,8 @@
 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

Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary.js	2009-12-16 22:34:24 UTC (rev 15177)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary.js	2009-12-16 23:39:30 UTC (rev 15178)
@@ -46,7 +46,10 @@
                     '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 @@
                 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 @@
                                     }
                                 }
                                 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);
                                         }

Modified: trunk/Open-ILS/xul/staff_client/server/skin/patron_summary.css
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/skin/patron_summary.css	2009-12-16 22:34:24 UTC (rev 15177)
+++ trunk/Open-ILS/xul/staff_client/server/skin/patron_summary.css	2009-12-16 23:39:30 UTC (rev 15178)
@@ -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; }



More information about the open-ils-commits mailing list