diff --git a/migration/i3.1/oracle/201511271630_IDEMPIERE-2973_1005382.sql b/migration/i3.1/oracle/201511271630_IDEMPIERE-2973_1005382.sql new file mode 100644 index 0000000000..f157ad4c29 --- /dev/null +++ b/migration/i3.1/oracle/201511271630_IDEMPIERE-2973_1005382.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Ticket #1005382: Requests are showing up on the wrong person's calendar +-- Nov 27, 2015 4:26:07 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200074,0,0,TO_DATE('2015-11-27 16:26:05','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2015-11-27 16:26:05','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE','CSU','C - Created by of the request is the logged in user; S - Sales Rep of the request is the logged in user; U - User/Contact of the request is the logged in user','D','C','f134d1ed-4101-4582-a3b3-0d2bf5c3577c') +; + +SELECT register_migration_script('201511271630_IDEMPIERE-2973_1005382.sql') FROM dual +; diff --git a/migration/i3.1/oracle/201512121213_IDEMPIERE-2716.sql b/migration/i3.1/oracle/201512121213_IDEMPIERE-2716.sql new file mode 100644 index 0000000000..8dd67f52a0 --- /dev/null +++ b/migration/i3.1/oracle/201512121213_IDEMPIERE-2716.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2716 Bank Register Report - add Bank Account Parameter +-- Jul 7, 2015 10:28:19 AM CEST +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200082,'C_BankAccount by Bank','S','C_BankAccount.C_Bank_ID=@C_Bank_ID@',0,0,'Y',TO_DATE('2015-07-07 10:28:18','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-07-07 10:28:18','YYYY-MM-DD HH24:MI:SS'),100,'C','923bb7a8-b071-4f8a-85de-794e06e43490') +; + +-- Jul 7, 2015 10:28:27 AM CEST +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200139,0,0,'Y',TO_DATE('2015-07-07 10:28:26','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-07-07 10:28:26','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account','Account at the Bank','The Bank Account identifies an account at this Bank.',200035,15,19,'N',200082,10,'N','C_BankAccount_ID','Y','D',836,'c852e4f4-417c-4955-b1ec-26d73d79b81c','N') +; + +SELECT register_migration_script('201512121213_IDEMPIERE-2716.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201511271630_IDEMPIERE-2973_1005382.sql b/migration/i3.1/postgresql/201511271630_IDEMPIERE-2973_1005382.sql new file mode 100644 index 0000000000..6524cf6b17 --- /dev/null +++ b/migration/i3.1/postgresql/201511271630_IDEMPIERE-2973_1005382.sql @@ -0,0 +1,7 @@ +-- Ticket #1005382: Requests are showing up on the wrong person's calendar +-- Nov 27, 2015 4:26:07 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200074,0,0,TO_TIMESTAMP('2015-11-27 16:26:05','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2015-11-27 16:26:05','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE','CSU','C - Created by of the request is the logged in user; S - Sales Rep of the request is the logged in user; U - User/Contact of the request is the logged in user','D','C','f134d1ed-4101-4582-a3b3-0d2bf5c3577c') +; + +SELECT register_migration_script('201511271630_IDEMPIERE-2973_1005382.sql') FROM dual +; diff --git a/migration/i3.1/postgresql/201512121213_IDEMPIERE-2716.sql b/migration/i3.1/postgresql/201512121213_IDEMPIERE-2716.sql new file mode 100644 index 0000000000..9b61ebf8be --- /dev/null +++ b/migration/i3.1/postgresql/201512121213_IDEMPIERE-2716.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-2716 Bank Register Report - add Bank Account Parameter +-- Jul 7, 2015 10:28:19 AM CEST +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200082,'C_BankAccount by Bank','S','C_BankAccount.C_Bank_ID=@C_Bank_ID@',0,0,'Y',TO_TIMESTAMP('2015-07-07 10:28:18','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-07-07 10:28:18','YYYY-MM-DD HH24:MI:SS'),100,'C','923bb7a8-b071-4f8a-85de-794e06e43490') +; + +-- Jul 7, 2015 10:28:27 AM CEST +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200139,0,0,'Y',TO_TIMESTAMP('2015-07-07 10:28:26','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-07-07 10:28:26','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account','Account at the Bank','The Bank Account identifies an account at this Bank.',200035,15,19,'N',200082,10,'N','C_BankAccount_ID','Y','D',836,'c852e4f4-417c-4955-b1ec-26d73d79b81c','N') +; + +SELECT register_migration_script('201512121213_IDEMPIERE-2716.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index f454192b09..510205cbb7 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 = 2300170888492939423L; + private static final long serialVersionUID = -5124493725187310483L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -142,6 +142,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String ZK_BROWSER_ICON = "ZK_BROWSER_ICON"; public static final String ZK_BROWSER_TITLE = "ZK_BROWSER_TITLE"; public static final String ZK_BUTTON_STYLE = "ZK_BUTTON_STYLE"; + public static final String ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE = "ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE"; public static final String ZK_DASHBOARD_PERFORMANCE_TIMEOUT = "ZK_DASHBOARD_PERFORMANCE_TIMEOUT"; public static final String ZK_DASHBOARD_REFRESH_INTERVAL = "ZK_DASHBOARD_REFRESH_INTERVAL"; public static final String ZK_DECIMALBOX_PROCESS_DOTKEYPAD = "ZK_DECIMALBOX_PROCESS_DOTKEYPAD"; diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index 70c5e58287..ce22b19d32 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -357,7 +357,7 @@ public class ReportEngine implements PrintServiceAttributeListener */ public String getName() { - return m_printFormat.getName(); + return m_printFormat.get_Translation("Name"); } // getName /** diff --git a/org.adempiere.base/src/org/compiere/report/BankRegister.java b/org.adempiere.base/src/org/compiere/report/BankRegister.java index c2a16fc4a4..3aa8cc159f 100644 --- a/org.adempiere.base/src/org/compiere/report/BankRegister.java +++ b/org.adempiere.base/src/org/compiere/report/BankRegister.java @@ -39,6 +39,8 @@ public class BankRegister extends SvrProcess { /** Bank Parameter */ private int p_C_Bank_ID = 0; + /** Bank Account Parameter */ + private int p_C_BankAccount_ID = 0; /** Period Parameter */ //private int p_C_Period_ID = 0; private Timestamp p_DateAcct_From = null; @@ -78,11 +80,15 @@ public class BankRegister extends SvrProcess } else if (name.equals("C_BPartner_ID")) p_C_BPartner_ID = ((BigDecimal)para[i].getParameter()).intValue(); + else if (name.equals("C_BankAccount_ID")) + p_C_BankAccount_ID = para[i].getParameterAsInt(); else log.log(Level.SEVERE, "Unknown Parameter: " + name); } m_parameterWhere.append(" fa.AD_Table_ID = (Select AD_Table_ID From AD_Table Where TableName = 'C_Payment') "); m_parameterWhere.append(" And b.C_Bank_ID = " + p_C_Bank_ID); + if(p_C_BankAccount_ID > 0) + m_parameterWhere.append(" AND ba.C_BankAccount_ID = " + p_C_BankAccount_ID); setDateAcct(); sb.append(" - DateAcct ").append(p_DateAcct_From).append("-").append(p_DateAcct_To); diff --git a/org.adempiere.base/src/org/compiere/util/WebUtil.java b/org.adempiere.base/src/org/compiere/util/WebUtil.java index e1cf47fba9..77b98b79e9 100644 --- a/org.adempiere.base/src/org/compiere/util/WebUtil.java +++ b/org.adempiere.base/src/org/compiere/util/WebUtil.java @@ -67,9 +67,7 @@ import org.compiere.model.MAttachmentEntry; import org.compiere.model.MMailMsg; import org.compiere.model.MRequest; import org.compiere.model.MStore; -import org.compiere.model.MSysConfig; import org.compiere.model.MUserMail; -import org.compiere.model.PO; /** * Servlet Utilities @@ -1317,45 +1315,4 @@ public final class WebUtil return retVal; } - /** Return the host name of the server (eg: demo.idempiere.com) */ - public static String getHostName() { - StringBuilder retValue = new StringBuilder(); - - try { - retValue.append(InetAddress.getLocalHost().getHostName()); - } catch (UnknownHostException e) { - log.log(Level.WARNING, "Local host or IP not found", e); - retValue.append(getHostIP()); - } - return retValue.toString(); - } - - /** Return the hardcoded link to the login page */ - public static String getLoginPage() { - return getHostName() + "/webui/index.zul"; - } - - /** Return the link for direct access to the record using tableID */ - public static String getZoomUrlTableID(PO po) - { - return getApplicationUrl(po) + "?Action=Zoom&AD_Table_ID=" + po.get_Table_ID() + "&Record_ID=" + po.get_ID(); - } - - /** Return the link for direct access to the record using tablename */ - public static String getZoomUrlTableName(PO po) - { - return getApplicationUrl(po) + "?Action=Zoom&TableName" + po.get_TableName() + "&Record_ID=" + po.get_ID(); - } - - /** Return the link to the login page */ - public static String getApplicationUrl(PO po) - { - String url = MSysConfig.getValue("APPLICATION_URL", po.getAD_Client_ID()); - - if (!Util.isEmpty(url) && !url.equals("USE_HARDCODED")) - return MSysConfig.getValue("APPLICATION_URL", po.getAD_Client_ID()); - else - return getLoginPage(); - } - } // WebUtil diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java index 395b3478ae..f61b16ce3e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java @@ -869,12 +869,15 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt */ public void checkDependants(ArrayList dependantFields){ - for ( GridField field : dependantFields ){ - + for (GridField field : dependantFields) { + if (field == null) + continue; WEditor editor = editors.get(field); + if (editor == null) + continue; boolean isEditable = field.isEditableGrid(true); editor.setReadWrite(isEditable); - if( isEditable ) + if (isEditable) gridPanel.refresh(gridTab); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 9cbd173724..cd7eab8467 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -54,8 +54,10 @@ import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MQuery; import org.compiere.model.MSession; +import org.compiere.model.MSysConfig; import org.compiere.model.MTable; import org.compiere.model.MZoomCondition; +import org.compiere.model.PO; import org.compiere.util.CCache; import org.compiere.util.CLogger; import org.compiere.util.CacheMgt; @@ -64,6 +66,7 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Ini; import org.compiere.util.Language; +import org.compiere.util.Util; import org.zkoss.web.servlet.Servlets; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Desktop; @@ -806,4 +809,35 @@ public final class AEnv } return fLanguageType; } + + private static String m_ApplicationUrl = null; + public static String getApplicationUrl() { + String url = MSysConfig.getValue("APPLICATION_URL", Env.getAD_Client_ID(Env.getCtx())); + if (!Util.isEmpty(url) && !url.equals("USE_HARDCODED")) + return MSysConfig.getValue("APPLICATION_URL", Env.getAD_Client_ID(Env.getCtx())); + if (m_ApplicationUrl != null) + return m_ApplicationUrl; + int port = Executions.getCurrent().getServerPort(); + String sch = Executions.getCurrent().getScheme(); + String sport = null; + if ( (sch.equals("http") && port == 80) || (sch.equals("https") && port == 443) ) + sport = ""; + else + sport = ":" + port; + m_ApplicationUrl = sch + "://" + Executions.getCurrent().getServerName() + sport + Executions.getCurrent().getContextPath() + Executions.getCurrent().getDesktop().getRequestPath(); + return m_ApplicationUrl; + } + + /** Return the link for direct access to the record using tableID */ + public static String getZoomUrlTableID(PO po) + { + return getApplicationUrl() + "?Action=Zoom&AD_Table_ID=" + po.get_Table_ID() + "&Record_ID=" + po.get_ID(); + } + + /** Return the link for direct access to the record using tablename */ + public static String getZoomUrlTableName(PO po) + { + return getApplicationUrl() + "?Action=Zoom&TableName" + po.get_TableName() + "&Record_ID=" + po.get_ID(); + } + } // AEnv diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java index 44bc423668..d53baee448 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java @@ -34,6 +34,7 @@ import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ServerPushTemplate; import org.compiere.model.I_R_Request; +import org.compiere.model.MSysConfig; import org.compiere.model.PO; import org.compiere.model.X_R_RequestType; import org.compiere.util.CLogger; @@ -200,13 +201,31 @@ public class DPCalendar extends DashboardPanel implements EventListener, } public static ArrayList getEvents(int RequestTypeID, Properties ctx) { + String mode = MSysConfig.getValue(MSysConfig.ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE, "CSU", Env.getAD_Client_ID(ctx)); + + String modeCondition = ""; + if (mode.indexOf('C') >= 0) + modeCondition += "r.CreatedBy = ?"; + if (mode.indexOf('S') >= 0) + { + if (modeCondition.length() > 0) + modeCondition += " OR "; + modeCondition += "r.SalesRep_ID = ?"; + } + if (mode.indexOf('U') >= 0) + { + if (modeCondition.length() > 0) + modeCondition += " OR "; + modeCondition += "r.AD_User_ID = ?"; + } + ArrayList events = new ArrayList(); String sql = "SELECT DISTINCT r.R_Request_ID, r.DateNextAction, " + "r.DateStartPlan, r.DateCompletePlan, r.StartTime, r.EndTime, " + "r.Summary, rt.HeaderColor, rt.ContentColor, rt.R_RequestType_ID " + "FROM R_Request r, R_RequestType rt " + "WHERE r.R_RequestType_ID = rt.R_RequestType_ID " - + "AND (r.SalesRep_ID = ? OR r.AD_User_ID = ? OR r.CreatedBy = ?) " + + "AND (" + modeCondition + ") " + "AND r.AD_Client_ID = ? AND r.IsActive = 'Y' " + "AND (r.R_Status_ID IS NULL OR r.R_Status_ID IN (SELECT R_Status_ID FROM R_Status WHERE IsClosed='N')) "; if(RequestTypeID > 0) @@ -214,16 +233,21 @@ public class DPCalendar extends DashboardPanel implements EventListener, PreparedStatement ps = null; ResultSet rs = null; + int count = 1; try { ps = DB.prepareStatement(sql, null); - ps.setInt(1, Env.getAD_User_ID(ctx)); - ps.setInt(2, Env.getAD_User_ID(ctx)); - ps.setInt(3, Env.getAD_User_ID(ctx)); - ps.setInt(4, Env.getAD_Client_ID(ctx)); + if (mode.indexOf('C') >= 0) + ps.setInt(count++, Env.getAD_User_ID(ctx)); + if (mode.indexOf('S') >= 0) + ps.setInt(count++, Env.getAD_User_ID(ctx)); + if (mode.indexOf('U') >= 0) + ps.setInt(count++, Env.getAD_User_ID(ctx)); + + ps.setInt(count++, Env.getAD_Client_ID(ctx)); if(RequestTypeID > 0) - ps.setInt(5, RequestTypeID); + ps.setInt(count++, RequestTypeID); rs = ps.executeQuery(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 3c06f98115..7efa3d65ff 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -2383,7 +2383,7 @@ public class FindWindow extends Window implements EventListener, ValueCha private boolean isSearchLike(GridField field) { return DisplayType.isText(field.getDisplayType()) - && MColumn.isSuggestSelectionColumn(field.getColumnName(), true); + && (field.isSelectionColumn() || MColumn.isSuggestSelectionColumn(field.getColumnName(), true)); } public boolean isValid() diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index 076b49d62e..d1a6f03d74 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -1061,10 +1061,10 @@ public class ZkReportViewer extends Window implements EventListener, ITab winExportFile.onClose(); AMedia media = null; if (data != null) - media = new AMedia(m_reportEngine.getPrintFormat().getName() + "." + ext, null, "application/octet-stream", data); + media = new AMedia(m_reportEngine.getName() + "." + ext, null, "application/octet-stream", data); else - media = new AMedia(m_reportEngine.getPrintFormat().getName() + "." + ext, null, "application/octet-stream", inputFile, true); - Filedownload.save(media, m_reportEngine.getPrintFormat().getName() + "." + ext); + media = new AMedia(m_reportEngine.getName() + "." + ext, null, "application/octet-stream", inputFile, true); + Filedownload.save(media, m_reportEngine.getName() + "." + ext); } catch (Exception e) {