From e6bdd72981b342185388459fb7f180b6e7cd56fb Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Thu, 28 Nov 2013 11:22:52 +0800 Subject: [PATCH 1/4] 1003569 Handle invalidated session. --- .../webui/session/SessionContextListener.java | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java index 920e10f7d5..b329771882 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java @@ -69,8 +69,15 @@ public class SessionContextListener implements ExecutionInit, */ public static void setupExecutionContextFromSession(Execution exec) { Session session = exec.getDesktop().getSession(); - Properties ctx = (Properties)session.getAttribute(SESSION_CTX); - HttpSession httpSession = (HttpSession)session.getNativeSession(); + Properties ctx = null; + //catch potential Session already invalidated exception + boolean sessionInvalidated = false; + try { + ctx = (Properties)session.getAttribute(SESSION_CTX); + } catch (IllegalStateException e) { + sessionInvalidated = true; + } + HttpSession httpSession = sessionInvalidated ? null : (HttpSession)session.getNativeSession(); //create empty context if there's no valid native session if (httpSession == null) { @@ -217,14 +224,10 @@ public class SessionContextListener implements ExecutionInit, public void complete(Component comp, Event evt) throws Exception { //in servlet thread - try { - if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid()) - { - setupExecutionContextFromSession(Executions.getCurrent()); - } - } catch (IllegalStateException e) { - //safe to ignore session already invalidated - } + if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid()) + { + setupExecutionContextFromSession(Executions.getCurrent()); + } } /** @@ -309,7 +312,13 @@ public class SessionContextListener implements ExecutionInit, return false; } - Properties sessionCtx = (Properties) session.getAttribute(SESSION_CTX); + Properties sessionCtx = null; + //catch invalidated session exception + try { + sessionCtx = (Properties) session.getAttribute(SESSION_CTX); + } catch (IllegalStateException e) { + return false; + } if (sessionCtx != null) { if (Env.getAD_Client_ID(sessionCtx) != Env.getAD_Client_ID(ctx)) @@ -341,6 +350,8 @@ public class SessionContextListener implements ExecutionInit, if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid()) { setupExecutionContextFromSession(Executions.getCurrent()); + if (Env.getCtx().getProperty(SERVLET_SESSION_ID) == null) + return; } int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Session_ID"); if (AD_Session_ID > 0) { From 4ff74bfef3d7074856872d9005012900f1c6dfee Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 28 Nov 2013 12:59:08 -0500 Subject: [PATCH 2/4] IDEMPIERE-1232 Zoom condition fixes / found problem obtaining parent tab on MZoomCondition as the variable _TabInfo_TabLevel has not been initialized - when navigating to BP Location it finds User BP Access as parent tab instead of the master BP --- .../src/org/compiere/model/GridTab.java | 14 +++++++------- .../src/org/compiere/model/GridWindow.java | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index a4b516641f..3e83e0232e 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -3163,13 +3163,13 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable int parentLevel = currentLevel-1; if (parentLevel < 0) return tabNo; - while (parentLevel != currentLevel) - { - tabNo--; - currentLevel = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, GridTab.CTX_TabLevel); - if (tabNo == 0) - break; - } + while (parentLevel != currentLevel) + { + tabNo--; + currentLevel = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, GridTab.CTX_TabLevel); + if (tabNo == 0) + break; + } return tabNo; } diff --git a/org.adempiere.base/src/org/compiere/model/GridWindow.java b/org.adempiere.base/src/org/compiere/model/GridWindow.java index 3eabbc77f3..af60c55880 100644 --- a/org.adempiere.base/src/org/compiere/model/GridWindow.java +++ b/org.adempiere.base/src/org/compiere/model/GridWindow.java @@ -166,6 +166,7 @@ public class GridWindow implements Serializable if (mTabVO != null) { GridTab mTab = new GridTab(mTabVO, this, m_virtual); + Env.setContext(m_vo.ctx, m_vo.WindowNo, t, GridTab.CTX_TabLevel, Integer.toString(mTab.getTabLevel())); m_tabs.add(mTab); } } // for all tabs From 953abf870cc9398aab5757493a3085785bbd3757 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Mon, 2 Dec 2013 17:08:29 +0800 Subject: [PATCH 3/4] IDEMPIERE-337 zkwebui - Improve Info Product window - Display only single row per product --- .../webui/info/InfoProductWindow.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java index f941aaea36..fd601e89d6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java @@ -71,7 +71,7 @@ public class InfoProductWindow extends InfoWindow { private Textbox fieldDescription; /** ASI */ - private int m_M_AttributeSetInstance_ID; + protected int m_M_AttributeSetInstance_ID; private Borderlayout contentBorderLayout; @@ -121,6 +121,24 @@ public class InfoProductWindow extends InfoWindow { } where.append("p.IsSummary='N' "); } + + for(WEditor editor : editors) { + if (editor.getGridField() != null && editor.getGridField().getColumnName().equals("C_BPartner_ID")) { + Number value = (Number) editor.getValue(); + if (value == null || value.intValue() == 0) + { + if (where.length() > 0) { + where.append(" AND "); + } + + where.append("CASE WHEN ppo.m_product_id > 0 THEN ppo.C_BPartner_ID IN ("); + where.append("SELECT MAX(ppo.C_BPartner_ID) FROM M_Product_PO ppo "); + where.append("WHERE p.M_Product_ID=ppo.M_Product_ID AND ppo.IsCurrentVendor='Y' AND ppo.IsActive='Y') "); + where.append("ELSE 1 = 1 END "); + } + break; + } + } return where.toString(); } From 5b3e0af93f516e4e1c5fb368b850a62988b751d6 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Mon, 2 Dec 2013 19:20:37 +0800 Subject: [PATCH 4/4] Validate mandatory fields, inform the user and allow the user to fill them without cancelling the report/process --- .../src/org/adempiere/webui/apps/ProcessModalDialog.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java index 0566bb62fd..91d671edc1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java @@ -417,6 +417,8 @@ public class ProcessModalDialog extends Window implements EventListener, } private void onOK() { + if (!parameterPanel.validateParameters()) + return; this.startProcess(); }