[open-ils-commits] r11257 - in trunk/Open-ILS/xul/staff_client: chrome/content/OpenILS chrome/content/main server/patron

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 18 13:17:39 EST 2008


Author: phasefx
Date: 2008-11-18 13:17:36 -0500 (Tue, 18 Nov 2008)
New Revision: 11257

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/patron/bill_wizard.js
Log:
Use new org-specific billing_type's with default prices, and remove the 'Billing Added' alert speedbump

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js	2008-11-18 18:16:06 UTC (rev 11256)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js	2008-11-18 18:17:36 UTC (rev 11257)
@@ -506,7 +506,6 @@
 			}
 		);
 
-
 		this.chain.push(
 			function() {
 				var f = gen_fm_retrieval_func(
@@ -744,8 +743,27 @@
 			}
 		);
 
+		this.chain.push(
+			function() {
+				var f = gen_fm_retrieval_func(
+					'cbt',
+					[
+						api.FM_CBT_RETRIEVE.app,
+						api.FM_CBT_RETRIEVE.method,
+						[ obj.session.key, obj.list.au[0].ws_ou() ],
+						false
+					]
+				);
+				try {
+					f();
+				} catch(E) {
+					var error = 'Error: ' + js2JSON(E);
+					obj.error.sdump('D_ERROR',error);
+					throw(E);
+				}
+			}
+		);
 
-
 		if (typeof this.on_complete == 'function') {
 
 			this.chain.push( this.on_complete );

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2008-11-18 18:16:06 UTC (rev 11256)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2008-11-18 18:17:36 UTC (rev 11257)
@@ -140,6 +140,7 @@
 	'FM_BRE_DELETE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record_entry.delete', 'secure' : false },
 	'FM_BRE_UNDELETE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record_entry.undelete', 'secure' : false },
 	'FM_BRN_FROM_MARCXML' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.marcxml_to_brn', 'secure' : false },
+	'FM_CBT_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.billing_type.ranged.retrieve.all', 'secure' : false },
 	'FM_CCS_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.config.copy_status.retrieve.all', 'secure' : false },
 	'FM_CIRC_DETAILS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.fleshed.retrieve' },
 	'FM_CIRC_DETAILS.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.fleshed.retrieve.authoritative' },

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_wizard.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_wizard.js	2008-11-18 18:16:06 UTC (rev 11256)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_wizard.js	2008-11-18 18:17:36 UTC (rev 11257)
@@ -100,18 +100,27 @@
         JSAN.use('util.functional');
         var ml = util.widgets.make_menulist(
             util.functional.map_list(
-                g.OpenILS.data.list.billing_type.sort(),
-                function(obj) { return [ obj, obj ]; }
-            )
+                g.OpenILS.data.list.cbt.sort( function(a,b) { if (a.name()>b.name()) return 1; if (a.name()<b.name()) return -1; return 0; } ), //g.OpenILS.data.list.billing_type.sort(),
+                function(obj) { return [ obj.name(), obj.id() ]; } //function(obj) { return [ obj, obj ]; }
+            ),
+            g.OpenILS.data.list.cbt.sort( function(a,b) { if (a.name()>b.name()) return 1; if (a.name()<b.name()) return -1; return 0; } )[0]
         );
         ml.setAttribute('id','billing_type');
         document.getElementById('menu_placeholder').appendChild(ml);
+        ml.addEventListener(
+            'command',
+            function() {
+                $('bill_amount').value = g.OpenILS.data.hash.cbt[ ml.value ].default_price();
+            },
+            false
+        ); 
 
         retrieve_patron();
 
         $('billing_location').setAttribute('value', g.OpenILS.data.hash.aou[ g.OpenILS.data.list.au[0].ws_ou() ].name() );
 
-        $('bill_amount').focus();
+        $('bill_amount').value = g.OpenILS.data.hash.cbt[ ml.value ].default_price();
+        $('bill_amount').select(); $('bill_amount').focus();
 
         if (xul_param('xact_id',{'modal_xulG':true})) { 
             g.mbts_id = xul_param('xact_id',{'modal_xulG':true});
@@ -150,14 +159,14 @@
                 billing.note( $('bill_note').value );
                 billing.xact( xact_id );
                 billing.amount( util.money.sanitize( $('bill_amount').value ) );
-                billing.billing_type( $('billing_type').value );
+                billing.billing_type( g.OpenILS.data.hash.cbt[$('billing_type').value].name() );
             var mb_id = g.network.request(
                 api.FM_MB_CREATE.app,
                 api.FM_MB_CREATE.method,
                 [ ses(), billing ]
             );
             if (typeof mb_id.ilsevent != 'undefined') throw(mb_id);
-            alert($('patronStrings').getString('staff.patron.bill_wizard.patron_bill_finish.billing_added'));
+            //alert($('patronStrings').getString('staff.patron.bill_wizard.patron_bill_finish.billing_added'));
         } else {
             throw(xact_id);
         }



More information about the open-ils-commits mailing list