IDEMPIERE-2283 Print format - footer hardcoded idempiere instead installation name / integrate patch from Nicolas Micoud (nmicoud)

This commit is contained in:
Carlos Ruiz 2015-02-04 10:58:04 -05:00
parent 62e7adb3bf
commit 80c885c5b4
2 changed files with 15 additions and 3 deletions

View File

@ -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 ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; 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_DASHBOARD_REFRESH_INTERVAL = "ZK_DASHBOARD_REFRESH_INTERVAL";
public static final String ZK_DECIMALBOX_PROCESS_DOTKEYPAD = "ZK_DECIMALBOX_PROCESS_DOTKEYPAD"; 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_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_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_LOGIN_ALLOW_REMEMBER_ME = "ZK_LOGIN_ALLOW_REMEMBER_ME";
public static final String ZK_LOGO_LARGE = "ZK_LOGO_LARGE"; public static final String ZK_LOGO_LARGE = "ZK_LOGO_LARGE";

View File

@ -37,6 +37,7 @@ import java.io.Reader;
import java.io.Serializable; import java.io.Serializable;
import java.net.URL; import java.net.URL;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Properties; import java.util.Properties;
@ -48,6 +49,7 @@ import javax.print.attribute.DocAttributeSet;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PrintInfo; import org.compiere.model.PrintInfo;
import org.compiere.print.ArchiveEngine; import org.compiere.print.ArchiveEngine;
@ -70,6 +72,7 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.compiere.util.Util;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
/** /**
@ -969,12 +972,19 @@ public class LayoutEngine implements Pageable, Printable, Doc
element.setLocation(ft); element.setLocation(ft);
m_headerFooter.addElement(element); 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.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_Center);
element.setLocation(ft); element.setLocation(ft);
m_headerFooter.addElement(element); 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.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight);
element.setLocation(ft); element.setLocation(ft);
m_headerFooter.addElement(element); m_headerFooter.addElement(element);