From 9f9e61da29bd9c92e4ba95298fd406ed4ed818a3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 10 Dec 2009 23:33:18 +0000 Subject: [PATCH] BF [2910358] - Error in context when Key field is found in different tabs. https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2910358&group_id=176962 --- base/src/org/compiere/model/GridTab.java | 18 ++++++++++-------- base/src/org/compiere/model/GridTable.java | 2 +- client/src/org/compiere/apps/search/Find.java | 7 +++++-- .../webui/panel/AbstractADWindowPanel.java | 3 +-- .../org/adempiere/webui/window/FindWindow.java | 5 +++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/base/src/org/compiere/model/GridTab.java b/base/src/org/compiere/model/GridTab.java index 80fc0ea523..a7492a863e 100644 --- a/base/src/org/compiere/model/GridTab.java +++ b/base/src/org/compiere/model/GridTab.java @@ -102,7 +102,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable /** * */ - private static final long serialVersionUID = 7198494041906579986L; + private static final long serialVersionUID = -5882167959482156252L; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; @@ -187,13 +187,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable private DataStatusEvent m_lastDataStatusEvent; // Context property names: - public static final String CTX_KeyColumnName = "KeyColumnName"; - public static final String CTX_LinkColumnName = "LinkColumnName"; - public static final String CTX_TabLevel = "TabLevel"; - public static final String CTX_AccessLevel = "AccessLevel"; - public static final String CTX_AD_Tab_ID = "AD_Tab_ID"; - public static final String CTX_Name = "Name"; - public static final String CTX_AD_Table_ID = "AD_Table_ID"; + public static final String CTX_KeyColumnName = "_TabInfo_KeyColumnName"; + public static final String CTX_LinkColumnName = "_TabInfo_LinkColumnName"; + public static final String CTX_TabLevel = "_TabInfo_TabLevel"; + public static final String CTX_AccessLevel = "_TabInfo_AccessLevel"; + public static final String CTX_AD_Tab_ID = "_TabInfo_AD_Tab_ID"; + public static final String CTX_Name = "_TabInfo_Name"; + public static final String CTX_AD_Table_ID = "_TabInfo_AD_Table_ID"; + public static final String CTX_FindSQL = "_TabInfo_FindSQL"; + public static final String CTX_SQL = "_TabInfo_SQL"; diff --git a/base/src/org/compiere/model/GridTable.java b/base/src/org/compiere/model/GridTable.java index 5dca2d8f5d..a49ff799a9 100644 --- a/base/src/org/compiere/model/GridTable.java +++ b/base/src/org/compiere/model/GridTable.java @@ -359,7 +359,7 @@ public class GridTable extends AbstractTableModel m_SQL += " ORDER BY " + m_orderClause; // log.fine(m_SQL_Count); - Env.setContext(m_ctx, m_WindowNo, m_TabNo, "SQL", m_SQL); + Env.setContext(m_ctx, m_WindowNo, m_TabNo, GridTab.CTX_SQL, m_SQL); return m_SQL; } // createSelectSql diff --git a/client/src/org/compiere/apps/search/Find.java b/client/src/org/compiere/apps/search/Find.java index d393c8b953..25316aa2fc 100644 --- a/client/src/org/compiere/apps/search/Find.java +++ b/client/src/org/compiere/apps/search/Find.java @@ -75,6 +75,7 @@ import org.compiere.model.DataStatusEvent; import org.compiere.model.DataStatusListener; import org.compiere.model.GridField; import org.compiere.model.GridFieldVO; +import org.compiere.model.GridTab; import org.compiere.model.MLookupFactory; import org.compiere.model.MProduct; import org.compiere.model.MQuery; @@ -111,8 +112,10 @@ import org.compiere.util.ValueNamePair; public final class Find extends CDialog implements ActionListener, ChangeListener, DataStatusListener { + /** + * + */ private static final long serialVersionUID = 6414604433732835410L; - private int m_AD_Tab_ID; /** @@ -1425,7 +1428,7 @@ public final class Find extends CDialog String finalSQL = MRole.getDefault().addAccessSQL(sql.toString(), m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); finalSQL = Env.parseContext(Env.getCtx(), m_targetWindowNo, finalSQL, false); - Env.setContext(Env.getCtx(), m_targetWindowNo, TABNO, "FindSQL", finalSQL); + Env.setContext(Env.getCtx(), m_targetWindowNo, TABNO, GridTab.CTX_FindSQL, finalSQL); // Execute Qusery m_total = 999999; diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index be15ea062a..c574a5e1ae 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -427,8 +427,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To gridWindow.initTab(tabIndex); GridTab gTab = gridWindow.getTab(tabIndex); - Env.setContext(ctx, curWindowNo, tabIndex, "TabLevel", Integer - .toString(gTab.getTabLevel())); + Env.setContext(ctx, curWindowNo, tabIndex, GridTab.CTX_TabLevel, Integer.toString(gTab.getTabLevel())); // Query first tab if (tabIndex == 0) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index d14d28aa20..9b5ddbb5b8 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -60,6 +60,7 @@ import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.part.MultiTabPart; import org.compiere.model.GridField; import org.compiere.model.GridFieldVO; +import org.compiere.model.GridTab; import org.compiere.model.MLookupFactory; import org.compiere.model.MProduct; import org.compiere.model.MQuery; @@ -97,7 +98,7 @@ import org.zkoss.zul.Hbox; public class FindWindow extends Window implements EventListener,ValueChangeListener { /** - * + * */ private static final long serialVersionUID = 4937678675702382252L; /** Main Window for the Lookup Panel */ @@ -1480,7 +1481,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe String finalSQL = MRole.getDefault().addAccessSQL(sql.toString(), m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); finalSQL = Env.parseContext(Env.getCtx(), m_targetWindowNo, finalSQL, false); - Env.setContext(Env.getCtx(), m_targetWindowNo, TABNO, "FindSQL", finalSQL); + Env.setContext(Env.getCtx(), m_targetWindowNo, TABNO, GridTab.CTX_FindSQL, finalSQL); // Execute Qusery m_total = 999999;