From 80c885c5b4006a594a2510630b4c4f39b8f01239 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 4 Feb 2015 10:58:04 -0500 Subject: [PATCH] IDEMPIERE-2283 Print format - footer hardcoded idempiere instead installation name / integrate patch from Nicolas Micoud (nmicoud) --- .../src/org/compiere/model/MSysConfig.java | 4 +++- .../org/compiere/print/layout/LayoutEngine.java | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index f79f1fb876..70cb6bb958 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 = 7367738851235987225L; + private static final long serialVersionUID = 6107779915945715515L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -143,6 +143,8 @@ public class MSysConfig extends X_AD_SysConfig public static final String ZK_DASHBOARD_REFRESH_INTERVAL = "ZK_DASHBOARD_REFRESH_INTERVAL"; public static final String ZK_DECIMALBOX_PROCESS_DOTKEYPAD = "ZK_DECIMALBOX_PROCESS_DOTKEYPAD"; public static final String ZK_DESKTOP_CLASS = "ZK_DESKTOP_CLASS"; + public static final String ZK_FOOTER_SERVER_DATETIME_FORMAT = "ZK_FOOTER_SERVER_DATETIME_FORMAT"; + public static final String ZK_FOOTER_SERVER_MSG = "ZK_FOOTER_SERVER_MSG"; public static final String ZK_GRID_EDIT_MODELESS = "ZK_GRID_EDIT_MODELESS"; public static final String ZK_LOGIN_ALLOW_REMEMBER_ME = "ZK_LOGIN_ALLOW_REMEMBER_ME"; public static final String ZK_LOGO_LARGE = "ZK_LOGO_LARGE"; diff --git a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java index aad77cff3e..300bfb287e 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java +++ b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java @@ -37,6 +37,7 @@ import java.io.Reader; import java.io.Serializable; import java.net.URL; import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Properties; @@ -48,6 +49,7 @@ import javax.print.attribute.DocAttributeSet; import org.compiere.model.MClientInfo; import org.compiere.model.MQuery; +import org.compiere.model.MSysConfig; import org.compiere.model.MTable; import org.compiere.model.PrintInfo; import org.compiere.print.ArchiveEngine; @@ -70,6 +72,7 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; import org.compiere.util.NamePair; +import org.compiere.util.Util; import org.compiere.util.ValueNamePair; /** @@ -969,12 +972,19 @@ public class LayoutEngine implements Pageable, Printable, Doc element.setLocation(ft); m_headerFooter.addElement(element); // - element = new StringElement("@*Header@", font, color, null, true); + String s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_MSG, "@*Header@", Env.getAD_Client_ID(Env.getCtx())); + element = new StringElement(s, font, color, null, true); element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_Center); element.setLocation(ft); m_headerFooter.addElement(element); // - element = new StringElement("@*CurrentDateTime@", font, color, null, true); + String timestamp = ""; + s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_DATETIME_FORMAT, Env.getAD_Client_ID(Env.getCtx())); + if (!Util.isEmpty(s)) + timestamp = new SimpleDateFormat(s).format(System.currentTimeMillis()); + else + timestamp = "@*CurrentDateTime@"; + element = new StringElement(timestamp, font, color, null, true); element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight); element.setLocation(ft); m_headerFooter.addElement(element);