bill summary in sidebar. quick ineffecient fix
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Sep 2006 17:40:45 +0000 (17:40 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Sep 2006 17:40:45 +0000 (17:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5964 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/summary.js

index e532cd8..0201019 100644 (file)
@@ -128,16 +128,21 @@ patron.summary.prototype = {
                                                        return function() { 
                                                                e.setAttribute('value','...');
                                                                obj.network.simple_request(
-                                                                       'FM_MOBTS_TOTAL_HAVING_BALANCE',
+                                                                       'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE',
                                                                        [ ses(), obj.patron.id() ],
                                                                        function(req) {
+                                                                               var list = req.getResultObject();
+                                                                               if (typeof list.ilsevent != 'undefined') {
+                                                                                       e.setAttribute('value', '??? See Bills');
+                                                                                       return;
+                                                                               }
+                                                                               var sum = 0;
+                                                                               for (var i = 0; i < list.length; i++) {
+                                                                                       var robj = obj.network.simple_request('FM_MBTS_RETRIEVE',[ses(),list[i]]);
+                                                                                       sum += robj.balance_owed();
+                                                                               }
                                                                                JSAN.use('util.money');
-                                                                               e.setAttribute('value',
-                                                                                       '$' + 
-                                                                                       util.money.sanitize( 
-                                                                                               req.getResultObject() 
-                                                                                       )
-                                                                               );
+                                                                               e.setAttribute('value', '$' + util.money.sanitize( sum ));
                                                                        }
                                                                );
                                                        };