[open-ils-commits] r14242 - trunk/Open-ILS/xul/staff_client/server/circ (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 30 17:12:26 EDT 2009


Author: phasefx
Date: 2009-09-30 17:12:20 -0400 (Wed, 30 Sep 2009)
New Revision: 14242

Modified:
   trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
   trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
Alright, now that we know how to juggle multiple async fleshing calls for util.list, let's go ahead and use the newly added objects we get from the checkin call payload instead of fetching them ourselves. :)



Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.js	2009-09-30 21:02:01 UTC (rev 14241)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.js	2009-09-30 21:12:20 UTC (rev 14242)
@@ -293,40 +293,28 @@
                 var row = params.row;
                 if (typeof params.on_retrieve == 'function') params.on_retrieve(row);
 
-                if (row.my.circ && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) {
-                    obj.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),row.my.circ.id()], function(req) {
-                        JSAN.use('util.money');
-                        var bill = req.getResultObject();
-                        row.my.mbts = bill;
-                        if (typeof params.on_retrieve == 'function') params.on_retrieve(row);
-                        if (Number(bill.balance_owed()) == 0) { return; }
-                        if (document.getElementById('no_change_label')) {
-                            var m = document.getElementById('no_change_label').getAttribute('value');
-                            document.getElementById('no_change_label').setAttribute(
-                                'value', 
-                                m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.billable.amount', [row.my.acp.barcode(), util.money.sanitize(bill.balance_owed())]) + '  '
-                            );
-                            document.getElementById('no_change_label').setAttribute('hidden','false');
-                        }
-                        if (document.getElementById('fine_tally')) {
-                            var amount = Number( document.getElementById('fine_tally').getAttribute('amount') ) + Number( bill.balance_owed() );
-                            document.getElementById('fine_tally').setAttribute('amount',amount);
-                            document.getElementById('fine_tally').setAttribute(
-                                'value',
-                                document.getElementById('circStrings').getFormattedString('staff.circ.utils.fine_tally_text', [ util.money.sanitize( amount ) ])
-                            );
-                            document.getElementById('fine_tally').setAttribute('hidden','false');
-                        }
-                    });
-
-                    if (row.my.circ) {
-                        obj.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID.authoritative', [ses(),row.my.circ.usr()], function(req) {
-                            var au_obj = req.getResultObject();
-                            row.my.au = au_obj;
-                            if (typeof params.on_retrieve == 'function') params.on_retrieve(row);
-                        } );
+                if (row.my.mbts && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) {
+                    var bill = row.my.mbts;
+                    if (Number(bill.balance_owed()) == 0) { return; }
+                    if (document.getElementById('no_change_label')) {
+                        var m = document.getElementById('no_change_label').getAttribute('value');
+                        document.getElementById('no_change_label').setAttribute(
+                            'value', 
+                            m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.billable.amount', [row.my.acp.barcode(), util.money.sanitize(bill.balance_owed())]) + '  '
+                        );
+                        document.getElementById('no_change_label').setAttribute('hidden','false');
                     }
+                    if (document.getElementById('fine_tally')) {
+                        var amount = Number( document.getElementById('fine_tally').getAttribute('amount') ) + Number( bill.balance_owed() );
+                        document.getElementById('fine_tally').setAttribute('amount',amount);
+                        document.getElementById('fine_tally').setAttribute(
+                            'value',
+                            document.getElementById('circStrings').getFormattedString('staff.circ.utils.fine_tally_text', [ util.money.sanitize( amount ) ])
+                        );
+                        document.getElementById('fine_tally').setAttribute('hidden','false');
+                    }
                 }
+
             } catch(E) {
                 alert('Error in checkin.js, list_retrieve_row(): ' + E);
             }
@@ -437,15 +425,16 @@
 					'row' : {
 						'my' : {
 							'circ' : checkin.circ,
+							'mbts' : checkin.circ ? checkin.circ.billable_transaction().summary() : null,
 							'mvr' : checkin.record,
 							'acp' : checkin.copy,
+							'au' : checkin.patron,
 							'status' : checkin.status,
 							'route_to' : checkin.route_to,
 							'message' : checkin.message
 						}
 					},
 					'to_top' : true
-				//I could override map_row_to_column here
 				}
 			);
 			obj.list.node.view.selection.select(0);

Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js	2009-09-30 21:02:01 UTC (rev 14241)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js	2009-09-30 21:12:20 UTC (rev 14242)
@@ -2191,6 +2191,7 @@
 		if (check.payload && check.payload.copy) { check.copy = check.payload.copy; }
 		if (check.payload && check.payload.record) { check.record = check.payload.record; }
 		if (check.payload && check.payload.circ) { check.circ = check.payload.circ; }
+		if (check.payload && check.payload.patron) { check.patron = check.payload.patron; }
 
 		if (!check.route_to) { check.route_to = '   '; }
 



More information about the open-ils-commits mailing list