From: Jason Etheridge Date: Wed, 20 Jul 2011 05:29:43 +0000 (-0400) Subject: adjust legacy xul column definitions for dates/timestamps to ensure correct sorting X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c6e73ef359f34c1495db622d260b3de16f5f6f96;p=contrib%2FConifer.git adjust legacy xul column definitions for dates/timestamps to ensure correct sorting Signed-off-by: Jason Etheridge Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 293c4380c8..722040cb8c 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -1103,6 +1103,7 @@ circ.util.columns = function(modify,params) { 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.acp.status_changed_time(), '%{localized}' ); }, 'persist' : 'hidden width ordinal' + ,'sort_value' : function(my) { return util.date.db_date2Date( my.acp.status_changed_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1136,6 +1137,7 @@ circ.util.columns = function(modify,params) { return ""; } } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.circ.xact_start() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1153,6 +1155,7 @@ circ.util.columns = function(modify,params) { return ""; } } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.circ.checkin_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1164,6 +1167,7 @@ circ.util.columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.circ ? util.date.formatted_date( my.circ.xact_finish(), '%{localized}' ) : ""; }, + 'sort_value' : function(my) { return util.date.db_date2Date( my.circ.xact_finish() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1181,6 +1185,7 @@ circ.util.columns = function(modify,params) { return ""; } } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.circ.due_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1192,7 +1197,7 @@ circ.util.columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.acp.create_date(), '%{localized}' ); } - ,'sort_value' : function(my) { return util.date.db_date2Date( my.acp.create_date() ).getTime();; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.acp.create_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1204,6 +1209,7 @@ circ.util.columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.acp.edit_date(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.acp.edit_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1355,6 +1361,7 @@ circ.util.columns = function(modify,params) { return ""; } } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.circ.stop_fines_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1450,6 +1457,7 @@ circ.util.columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.circ ? util.date.formatted_date( my.circ.checkin_scan_time(), '%{localized}' ) : ""; }, + 'sort_value' : function(my) { return util.date.db_date2Date( my.circ.checkin_scan_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1491,6 +1499,7 @@ circ.util.columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.bre ? util.date.formatted_date( my.bre.create_date(), '%{localized}' ) : ''; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.bre.create_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1502,6 +1511,7 @@ circ.util.columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.bre ? util.date.formatted_date( my.bre.edit_date(), '%{localized}' ) : ''; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.bre.edit_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1691,6 +1701,7 @@ circ.util.transit_columns = function(modify,params) { 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.atc.source_send_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.atc.source_send_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1716,6 +1727,7 @@ circ.util.transit_columns = function(modify,params) { 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.atc.dest_recv_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.atc.dest_recv_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1780,6 +1792,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.ahr.cancel_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.cancel_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1838,6 +1851,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.ahr.request_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.request_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1848,6 +1862,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.ahr.shelf_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.shelf_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1858,6 +1873,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.ahr.shelf_expire_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.shelf_expire_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1876,6 +1892,16 @@ circ.util.hold_columns = function(modify,params) { } return ""; } + ,'sort_value' : function(my) { + return util.date.db_date2Date( my.acp.create_date() ).getTime(); + if (my.ahr.transit() && my.ahr.transit().dest_recv_time()) { + return util.date.db_date2Date( my.ahr.transit().dest_recv_time() ).getTime(); + } + if (!my.ahr.transit() && my.ahr.capture_time()) { + return util.date.db_date2Date( my.ahr.capture_time() ).getTime(); + } + return 0; + } }, { 'persist' : 'hidden width ordinal', @@ -1886,6 +1912,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.ahr.capture_time() ? util.date.formatted_date( my.ahr.capture_time(), '%{localized}' ) : ""; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.capture_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -1974,6 +2001,7 @@ circ.util.hold_columns = function(modify,params) { return util.date.formatted_date( my.ahr.thaw_date(), '%{localized}' ); } } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.thaw_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -2055,6 +2083,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.ahr.expire_time() ? util.date.formatted_date( my.ahr.expire_time(), '%{localized}' ) : ''; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.expire_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -2065,6 +2094,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.ahr.fulfillment_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.fulfillment_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -2120,6 +2150,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.ahr.prev_check_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.prev_check_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -2251,6 +2282,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.ahr.notify_time(), '%{localized}' ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.notify_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -2285,6 +2317,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.ahr.transit() ? util.date.formatted_date( my.ahr.transit().source_send_time(), '%{localized}' ) : ""; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.transit().source_send_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', @@ -2304,6 +2337,7 @@ circ.util.hold_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.ahr.transit() ? util.date.formatted_date( my.ahr.transit().dest_recv_time(), '%{localized}' ) : ""; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ahr.transit().dest_recv_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js index 742b6b4995..8968e0ab12 100644 --- a/Open-ILS/xul/staff_client/server/patron/util.js +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -57,6 +57,7 @@ patron.util.mbts_columns = function(modify,params) { 'persist' : 'hidden width ordinal', 'id' : 'last_billing_ts', 'label' : commonStrings.getString('staff.mbts_last_billing_timestamp_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mbts.last_billing_ts(), "%{localized}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.mbts.last_billing_ts() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'last_payment_note', 'label' : commonStrings.getString('staff.mbts_last_payment_note_label'), 'flex' : 2, @@ -70,16 +71,19 @@ patron.util.mbts_columns = function(modify,params) { 'persist' : 'hidden width ordinal', 'id' : 'last_payment_ts', 'label' : commonStrings.getString('staff.mbts_last_payment_timestamp_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mbts.last_payment_ts(), "%{localized}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.mbts.last_payment_ts() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'mbts_xact_start', 'label' : commonStrings.getString('staff.mbts_xact_start_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_start() ? util.date.formatted_date( my.mbts.xact_start(), "%{localized}" ) : ""; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.mbts.xact_start() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'mbts_xact_finish', 'label' : commonStrings.getString('staff.mbts_xact_finish_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_finish() ? util.date.formatted_date( my.mbts.xact_finish(), "%{localized}" ) : ""; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.mbts.xact_finish() ).getTime(); } }, ]; for (var i = 0; i < c.length; i++) { @@ -136,6 +140,7 @@ patron.util.mb_columns = function(modify,params) { '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}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.mb.void_time() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'amount', 'label' : commonStrings.getString('staff.mb_amount_label'), 'flex' : 1, @@ -150,6 +155,7 @@ patron.util.mb_columns = function(modify,params) { 'persist' : 'hidden width ordinal', 'id' : 'billing_ts', 'label' : commonStrings.getString('staff.mb_billing_ts_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mb.billing_ts(), "%{localized}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.mb.billing_ts() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'note', 'label' : commonStrings.getString('staff.mb_note_label'), 'flex' : 2, @@ -216,6 +222,7 @@ patron.util.mp_columns = function(modify,params) { 'persist' : 'hidden width ordinal', 'id' : 'mp_payment_ts', 'label' : commonStrings.getString('staff.mp_payment_timestamp_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mp.payment_ts(), "%{localized}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.mp.payment_ts() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'mp_note', 'label' : commonStrings.getString('staff.mp_note_label'), 'flex' : 2, @@ -327,6 +334,7 @@ patron.util.ausp_columns = function(modify,params) { 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.ausp ? util.date.formatted_date( my.ausp.set_date(), "%{localized}" ) : ''; } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.ausp.set_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'ausp_note', 'label' : commonStrings.getString('staff.ausp_note_label'), 'flex' : 1, @@ -435,11 +443,13 @@ patron.util.columns = function(modify,params) { 'persist' : 'hidden width ordinal', 'id' : 'au_create_date', 'label' : commonStrings.getString('staff.au_create_date_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.au.create_date(), "%{localized}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.au.create_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'expire_date', 'label' : commonStrings.getString('staff.au_expire_date_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.au.expire_date(), "%{localized_date}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.au.expire_date() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'home_ou', 'label' : commonStrings.getString('staff.au_home_library_label'), 'flex' : 1, @@ -478,6 +488,7 @@ patron.util.columns = function(modify,params) { 'persist' : 'hidden width ordinal', 'id' : 'dob', 'label' : commonStrings.getString('staff.au_birth_date_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.au.dob(), "%{localized_date}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.au.dob() ).getTime(); } }, { 'persist' : 'hidden width ordinal', 'id' : 'ident_type', 'label' : commonStrings.getString('staff.au_ident_type_label'), 'flex' : 1,