Merge with release-1.0c

This commit is contained in:
Elaine Tan 2013-12-02 19:25:06 +08:00
commit f9b81ab26e
5 changed files with 51 additions and 19 deletions

View File

@ -3187,13 +3187,13 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
int parentLevel = currentLevel-1; int parentLevel = currentLevel-1;
if (parentLevel < 0) if (parentLevel < 0)
return tabNo; return tabNo;
while (parentLevel != currentLevel) while (parentLevel != currentLevel)
{ {
tabNo--; tabNo--;
currentLevel = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, GridTab.CTX_TabLevel); currentLevel = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, GridTab.CTX_TabLevel);
if (tabNo == 0) if (tabNo == 0)
break; break;
} }
return tabNo; return tabNo;
} }

View File

@ -166,6 +166,7 @@ public class GridWindow implements Serializable
if (mTabVO != null) if (mTabVO != null)
{ {
GridTab mTab = new GridTab(mTabVO, this, m_virtual); 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); m_tabs.add(mTab);
} }
} // for all tabs } // for all tabs

View File

@ -417,6 +417,8 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
} }
private void onOK() { private void onOK() {
if (!parameterPanel.validateParameters())
return;
this.startProcess(); this.startProcess();
} }

View File

@ -71,7 +71,7 @@ public class InfoProductWindow extends InfoWindow {
private Textbox fieldDescription; private Textbox fieldDescription;
/** ASI */ /** ASI */
private int m_M_AttributeSetInstance_ID; protected int m_M_AttributeSetInstance_ID;
private Borderlayout contentBorderLayout; private Borderlayout contentBorderLayout;
@ -121,6 +121,24 @@ public class InfoProductWindow extends InfoWindow {
} }
where.append("p.IsSummary='N' "); 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(); return where.toString();
} }

View File

@ -69,8 +69,15 @@ public class SessionContextListener implements ExecutionInit,
*/ */
public static void setupExecutionContextFromSession(Execution exec) { public static void setupExecutionContextFromSession(Execution exec) {
Session session = exec.getDesktop().getSession(); Session session = exec.getDesktop().getSession();
Properties ctx = (Properties)session.getAttribute(SESSION_CTX); Properties ctx = null;
HttpSession httpSession = (HttpSession)session.getNativeSession(); //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 //create empty context if there's no valid native session
if (httpSession == null) if (httpSession == null)
{ {
@ -217,14 +224,10 @@ public class SessionContextListener implements ExecutionInit,
public void complete(Component comp, Event evt) throws Exception public void complete(Component comp, Event evt) throws Exception
{ {
//in servlet thread //in servlet thread
try { if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid())
if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid()) {
{ setupExecutionContextFromSession(Executions.getCurrent());
setupExecutionContextFromSession(Executions.getCurrent()); }
}
} catch (IllegalStateException e) {
//safe to ignore session already invalidated
}
} }
/** /**
@ -309,7 +312,13 @@ public class SessionContextListener implements ExecutionInit,
return false; 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 (sessionCtx != null)
{ {
if (Env.getAD_Client_ID(sessionCtx) != Env.getAD_Client_ID(ctx)) 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()) if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid())
{ {
setupExecutionContextFromSession(Executions.getCurrent()); setupExecutionContextFromSession(Executions.getCurrent());
if (Env.getCtx().getProperty(SERVLET_SESSION_ID) == null)
return;
} }
int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Session_ID"); int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Session_ID");
if (AD_Session_ID > 0) { if (AD_Session_ID > 0) {