handle object or id for mbts
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Sep 2006 03:42:34 +0000 (03:42 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Sep 2006 03:42:34 +0000 (03:42 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5970 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/bill_history.xul

index 4502182..a8f2661 100644 (file)
                        
                                                function gen_func(r) {
                                                        return function() {
-                                                               g.bill_list.append( { 'retrieve_id' : r, 'row' : {} } );
+                                                               if (typeof r == 'object') {
+                                                                       g.bill_list.append( 
+                                                                               { 
+                                                                                       'retrieve_id' : r.id(), 
+                                                                                       'row' : { 
+                                                                                               'my' : { 
+                                                                                                       'mbts' : r 
+                                                                                               } 
+                                                                                       } 
+                                                                               } 
+                                                                       );
+                                                               } else {
+                                                                       g.bill_list.append( 
+                                                                               { 
+                                                                                       'retrieve_id' : r, 
+                                                                                       'row' : { 
+                                                                                               'my' : {} 
+                                                                                       } 
+                                                                               } 
+                                                                       );
+                                                               }
                                                        }
                                                }
                        
                     var id = params.retrieve_id;
                                        var row = params.row;
                                        if (id) {
-                                               var mbts_obj = g.network.simple_request('FM_MBTS_RETRIEVE',[ses(),id]);
                                                if (typeof row.my == 'undefined') row.my = {};
-                                               row.my.mbts = mbts_obj;
+                                               if ( typeof row.my.mbts == 'undefined' ) {
+                                                       var mbts_obj = g.network.simple_request('FM_MBTS_RETRIEVE',[ses(),id]);
+                                                       row.my.mbts = mbts_obj;
+                                               }
                                        }
                                        if (typeof params.on_retrieve == 'function') {
                                                params.on_retrieve(row);