From 976654ef252f2fff4c8fb1b7531a740bcc1388a1 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 23 Apr 2013 17:07:31 -0500 Subject: [PATCH] IDEMPIERE-832 not shows the new request created in the Calendar / fix timezone problems - make alternate timezone configurable via CALENDAR_ALTERNATE_TIMEZONE sysconfig key --- .../src/org/compiere/model/MSysConfig.java | 3 ++- .../webui/dashboard/CalendarWindow.java | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 08e36fa386..7e9ba4d630 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = -872111480299074889L; + private static final long serialVersionUID = -3368661022903012786L; public final static String PDF_FONT_DIR = "PDF_FONT_DIR"; public final static String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS"; @@ -116,6 +116,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String SHIPPING_SAVE_REQUEST_RESPONSE_LOG = "SHIPPING_SAVE_REQUEST_RESPONSE_LOG"; public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME"; public static final String ZK_MAX_UPLOAD_SIZE = "ZK_MAX_UPLOAD_SIZE"; + public static final String CALENDAR_ALTERNATE_TIMEZONE = "CALENDAR_ALTERNATE_TIMEZONE"; /** * Standard Constructor diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java index 9d1f496238..d923052a11 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java @@ -13,6 +13,8 @@ *****************************************************************************/ package org.adempiere.webui.dashboard; +import static org.compiere.model.MSysConfig.CALENDAR_ALTERNATE_TIMEZONE; + import java.awt.image.BufferedImage; import java.io.IOException; import java.math.BigDecimal; @@ -30,9 +32,11 @@ import java.util.TimeZone; import org.adempiere.webui.component.Window; import org.adempiere.webui.session.SessionManager; +import org.compiere.model.MSysConfig; import org.compiere.model.X_R_RequestType; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.Util; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.encoders.EncoderUtil; @@ -370,10 +374,20 @@ public class CalendarWindow extends Window implements EventListener { private String getTimeZone() { + String alternateTimeZone = MSysConfig.getValue(CALENDAR_ALTERNATE_TIMEZONE, "Pacific Time=PST", Env.getAD_Client_ID(Env.getCtx())); TimeZone defaultTimeZone = TimeZone.getDefault(); - String defaultTimeZoneName = defaultTimeZone.getDisplayName(); - int defaultTimeZoneOffset = defaultTimeZone.getOffset(0) / 3375000; - return defaultTimeZoneName + "=GMT" + (defaultTimeZoneOffset > 0 ? "+" : "-") + defaultTimeZoneOffset + ",Pacific Time=GMT-8"; + StringBuilder defaultTimeZoneName = new StringBuilder(defaultTimeZone.getDisplayName()); + int defaultTimeZoneOffset = defaultTimeZone.getOffset(0) / 3600000; + defaultTimeZoneName.append("=GMT"); + if (defaultTimeZoneOffset >= 0) + defaultTimeZoneName.append("+"); + defaultTimeZoneName.append(defaultTimeZoneOffset); + if (!Util.isEmpty(alternateTimeZone, true)) { + if (!alternateTimeZone.equalsIgnoreCase(defaultTimeZoneName.toString())) { + defaultTimeZoneName.append(",").append(alternateTimeZone); + } + } + return defaultTimeZoneName.toString(); } private void updateDateLabel() {