IDEMPIERE-832 not shows the new request created in the Calendar / fix timezone problems - make alternate timezone configurable via CALENDAR_ALTERNATE_TIMEZONE sysconfig key

This commit is contained in:
Carlos Ruiz 2013-04-23 17:07:31 -05:00
parent dfb3b1cee9
commit 976654ef25
2 changed files with 19 additions and 4 deletions

View File

@ -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

View File

@ -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<Event> {
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() {