From 6d747f95e8c88775b6b2b3cecbc757a1455165d7 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 16 May 2014 10:03:45 -0700 Subject: [PATCH] LP#1320048: correctly display closures in the closed dates editor This patch fixes a problem introduced by the patch for bug 1187035 that caused the closed dates editor to display all closures as if they started and ended at the current time. Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../xul/staff_client/server/admin/closed_dates.js | 41 +++++++++------------- .../staff_client/server/admin/closed_dates.xhtml | 1 + 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/admin/closed_dates.js b/Open-ILS/xul/staff_client/server/admin/closed_dates.js index d784ff6627..45a9a6a5bc 100644 --- a/Open-ILS/xul/staff_client/server/admin/closed_dates.js +++ b/Open-ILS/xul/staff_client/server/admin/closed_dates.js @@ -1,3 +1,4 @@ +var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {}; var FETCH_CLOSED_DATES = 'open-ils.actor:open-ils.actor.org_unit.closed.retrieve.all'; var FETCH_CLOSED_DATE = 'open-ils.actor:open-ils.actor.org_unit.closed.retrieve'; var CREATE_CLOSED_DATE = 'open-ils.actor:open-ils.actor.org_unit.closed.create'; @@ -23,6 +24,19 @@ var myPerms = [ function cdEditorInit() { + try { + if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); } + JSAN.errorLevel = "die"; // none, warn, or die + JSAN.addRepository('..'); + JSAN.use('util.error'); g.error = new util.error(); + JSAN.use('util.date'); + } catch(E) { + var err_msg = "!! This software has encountered an error. Please tell your friendly " + + "system administrator or software developer the following:\nadmin/closed_dates.xhtml\n" + E + '\n'; + try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } + alert(err_msg); + } + /* set the various template rows */ cdTbody = $('cd_tbody'); cdRowTemplate = cdTbody.removeChild($('cd_row')); @@ -162,32 +176,11 @@ function cdBuild(r) { } function cdDateToHours(date) { - var d = new Date.W3CDTF(); - d.setW3CDTF(date.replace(/\.\d+/,'') + ":00"); - - var h = d.getHours() +''; - var m = d.getMinutes() +''; - var s = d.getSeconds() +''; - - if(h.length == 1) h = '0'+h; - if(m.length == 1) m = '0'+m; - if(s.length == 1) s = '0'+s; - - return h + ':' + m + ':' + s; + return util.date.formatted_date(date, '%H:%M'); } function cdDateToDate(date) { - var d = new Date.W3CDTF(); - d.setW3CDTF(date.replace(/\.\d+/,'') + ":00"); - - var y = d.getFullYear()+''; - var m = (d.getMonth() + 1)+''; - var d = d.getDate()+''; - - if(m.length == 1) m = '0'+m; - if(d.length == 1) d = '0'+d; - - return y + '-' + m + '-' + d; + return util.date.formatted_date(date, '%F'); } @@ -272,8 +265,6 @@ function cdDelete(row, date) { } -/* getW3CDTF */ - function cdVerifyDate(d) { return d && d.match(/\d{4}-\d{2}-\d{2}/); } diff --git a/Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml b/Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml index c831f7d999..12032c3414 100644 --- a/Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml +++ b/Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml @@ -22,6 +22,7 @@ + -- 2.11.0