LP 1198465: Fix staff client to handle new virtual field in mb object.
authorJason Stephenson <jason@sigio.com>
Fri, 21 Feb 2014 14:31:39 +0000 (09:31 -0500)
committerJason Stephenson <jason@sigio.com>
Fri, 21 Feb 2014 14:31:39 +0000 (09:31 -0500)
Alter server/patron/util.js to get values for voided, voider, and
void_time from the virtual void_payment object on the money.billing.

Alter server/patron/bill2.js to use the void_payment field instead
of the removed voided field to determine if a bill is voided.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/xul/staff_client/server/patron/bill2.js
Open-ILS/xul/staff_client/server/patron/util.js

index 8a248f3..323811f 100644 (file)
@@ -1028,7 +1028,7 @@ function void_all_billings(mobts_id) {
         var mb_list = g.network.simple_request( 'FM_MB_RETRIEVE_VIA_MBTS_ID.authoritative', [ ses(), mobts_id ] );
         if (typeof mb_list.ilsevent != 'undefined') throw(mb_list);
 
-        mb_list = util.functional.filter_list( mb_list, function(o) { return ! get_bool( o.voided() ) });
+        mb_list = util.functional.filter_list( mb_list, function(o) { return ! get_bool( o.void_payment() ) });
 
         if (mb_list.length == 0) { alert($("patronStrings").getString('staff.patron.bills.void_all_billings.all_voided')); return; }
 
index 6849c34..50be099 100644 (file)
@@ -151,20 +151,21 @@ patron.util.mb_columns = function(modify,params) {
         },
         {
             'persist' : 'hidden width ordinal', 'id' : 'voided', 'label' : commonStrings.getString('staff.mb_voided_label'), 'flex' : 1,
-            'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return get_bool( my.mb.voided() ) ? "Yes" : "No"; }
+            'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return ( typeof my.mb.void_payment() == 'undefined' ) ? "No" : "Yes"; }
         },
         {
             'persist' : 'hidden width ordinal', 'id' : 'voider', 'label' : commonStrings.getString('staff.mb_voider_label'), 'flex' : 1,
-            'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.voider() ? "Id = " + my.mb.voider() : ""; }
+            'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return ( typeof my.mb.void_payment() == 'undefined' ) ? "" : "Id = " +  my.mb.void_payment().accepting_usr(); }
         },
         {
             'persist' : 'hidden width ordinal', 'id' : 'void_time', 'label' : commonStrings.getString('staff.mb_void_time_label'), 'flex' : 1,
             'sort_type' : 'date',
-            'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mb.void_time(), "%{localized}" ); }
+            'primary' : false, 'hidden' : true, 'editable' : false,
+            'render' : function(my) { return ( typeof my.mb.void_payment() == 'undefined' ) ? "" : util.date.formatted_date( my.mb.void_payment().payment_ts(), "%{localized}" ); }
             ,'sort_value' : function(my) { return util.date.db_date2Date(
-                    my.mbts
-                    ? my.mb.void_time()
-                    : null
+                    ( typeof my.mb.void_payment() == 'undefined' )
+                    ? null
+                    : my.mb.void_payment().payment_ts()
                 ).getTime();
             }
         },