BF [ 3007342 ] Included tab context conflict issue
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=3007342
This commit is contained in:
parent
6b469af96f
commit
db2c6d7ec3
|
@ -64,6 +64,8 @@ import org.compiere.util.Evaluator;
|
||||||
* https://sourceforge.net/tracker/?func=detail&aid=2910358&group_id=176962&atid=879332
|
* https://sourceforge.net/tracker/?func=detail&aid=2910358&group_id=176962&atid=879332
|
||||||
* <li>BF [ 2910368 ] Error in context when IsActive field is found in different
|
* <li>BF [ 2910368 ] Error in context when IsActive field is found in different
|
||||||
* https://sourceforge.net/tracker/?func=detail&aid=2910368&group_id=176962&atid=879332
|
* https://sourceforge.net/tracker/?func=detail&aid=2910368&group_id=176962&atid=879332
|
||||||
|
* <li>BF [ 3007342 ] Included tab context conflict issue
|
||||||
|
* https://sourceforge.net/tracker/?func=detail&aid=3007342&group_id=176962&atid=879332
|
||||||
* @version $Id: GridField.java,v 1.5 2006/07/30 00:51:02 jjanke Exp $
|
* @version $Id: GridField.java,v 1.5 2006/07/30 00:51:02 jjanke Exp $
|
||||||
*/
|
*/
|
||||||
public class GridField
|
public class GridField
|
||||||
|
@ -435,8 +437,7 @@ public class GridField
|
||||||
|
|
||||||
// Record is Processed ***
|
// Record is Processed ***
|
||||||
if (checkContext
|
if (checkContext
|
||||||
&& (Env.getContext(m_vo.ctx, m_vo.WindowNo, "Processed").equals("Y")
|
&& ("Y".equals(get_ValueAsString("Processed")) || "Y".equals(get_ValueAsString("Processing"))) )
|
||||||
|| Env.getContext(m_vo.ctx, m_vo.WindowNo, "Processing").equals("Y")))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// IsActive field is editable, if record not processed
|
// IsActive field is editable, if record not processed
|
||||||
|
@ -798,7 +799,7 @@ public class GridField
|
||||||
*/
|
*/
|
||||||
public String get_ValueAsString (String variableName)
|
public String get_ValueAsString (String variableName)
|
||||||
{
|
{
|
||||||
return Env.getContext (m_vo.ctx, m_vo.WindowNo, variableName, true);
|
return Env.getContext (m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, variableName, false, true);
|
||||||
} // get_ValueAsString
|
} // get_ValueAsString
|
||||||
|
|
||||||
|
|
||||||
|
@ -1305,23 +1306,32 @@ public class GridField
|
||||||
else if (m_value instanceof Boolean)
|
else if (m_value instanceof Boolean)
|
||||||
{
|
{
|
||||||
backupValue(); // teo_sarca [ 1699826 ]
|
backupValue(); // teo_sarca [ 1699826 ]
|
||||||
|
if (!isParentTabField())
|
||||||
|
{
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
||||||
((Boolean)m_value).booleanValue());
|
((Boolean)m_value).booleanValue());
|
||||||
|
}
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName,
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName,
|
||||||
m_value==null ? null : (((Boolean)m_value) ? "Y" : "N"));
|
m_value==null ? null : (((Boolean)m_value) ? "Y" : "N"));
|
||||||
}
|
}
|
||||||
else if (m_value instanceof Timestamp)
|
else if (m_value instanceof Timestamp)
|
||||||
{
|
{
|
||||||
backupValue(); // teo_sarca [ 1699826 ]
|
backupValue(); // teo_sarca [ 1699826 ]
|
||||||
|
if (!isParentTabField())
|
||||||
|
{
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, (Timestamp)m_value);
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, (Timestamp)m_value);
|
||||||
|
}
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName,
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName,
|
||||||
m_value==null ? null : m_value.toString().substring(0, m_value.toString().indexOf(".")));
|
m_value==null ? null : m_value.toString().substring(0, m_value.toString().indexOf(".")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
backupValue(); // teo_sarca [ 1699826 ]
|
backupValue(); // teo_sarca [ 1699826 ]
|
||||||
|
if (!isParentTabField())
|
||||||
|
{
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
||||||
m_value==null ? null : m_value.toString());
|
m_value==null ? null : m_value.toString());
|
||||||
|
}
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName,
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName,
|
||||||
m_value==null ? null : m_value.toString());
|
m_value==null ? null : m_value.toString());
|
||||||
}
|
}
|
||||||
|
@ -1531,6 +1541,7 @@ public class GridField
|
||||||
sb.append("(Key)");
|
sb.append("(Key)");
|
||||||
if (isParentColumn())
|
if (isParentColumn())
|
||||||
sb.append("(Parent)");
|
sb.append("(Parent)");
|
||||||
|
sb.append(", IsDisplayed="+m_vo.IsDisplayed);
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
} // toString
|
} // toString
|
||||||
|
@ -1668,7 +1679,7 @@ public class GridField
|
||||||
*/
|
*/
|
||||||
private final void backupValue() {
|
private final void backupValue() {
|
||||||
if (!m_isBackupValue) {
|
if (!m_isBackupValue) {
|
||||||
m_backupValue = Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName);
|
m_backupValue = get_ValueAsString(m_vo.ColumnName);
|
||||||
if (CLogMgt.isLevelFinest())
|
if (CLogMgt.isLevelFinest())
|
||||||
log.finest("Backup " + m_vo.WindowNo + "|" + m_vo.ColumnName + "=" + m_backupValue);
|
log.finest("Backup " + m_vo.WindowNo + "|" + m_vo.ColumnName + "=" + m_backupValue);
|
||||||
m_isBackupValue = true;
|
m_isBackupValue = true;
|
||||||
|
@ -1681,11 +1692,20 @@ public class GridField
|
||||||
*/
|
*/
|
||||||
public void restoreValue() {
|
public void restoreValue() {
|
||||||
if (m_isBackupValue) {
|
if (m_isBackupValue) {
|
||||||
|
if (isParentTabField())
|
||||||
|
{
|
||||||
|
if (CLogMgt.isLevelFinest())
|
||||||
|
log.finest("Restore " + m_vo.WindowNo + "|" + m_vo.TabNo + "|" + m_vo.ColumnName + "=" + m_backupValue);
|
||||||
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName, m_backupValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (CLogMgt.isLevelFinest())
|
if (CLogMgt.isLevelFinest())
|
||||||
log.finest("Restore " + m_vo.WindowNo + "|" + m_vo.ColumnName + "=" + m_backupValue);
|
log.finest("Restore " + m_vo.WindowNo + "|" + m_vo.ColumnName + "=" + m_backupValue);
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, m_backupValue);
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, m_backupValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Feature Request [1707462]
|
* Feature Request [1707462]
|
||||||
|
@ -1793,4 +1813,27 @@ public class GridField
|
||||||
{
|
{
|
||||||
return m_gridTab;
|
return m_gridTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param columnName
|
||||||
|
* @return true if columnName also exist in parent tab
|
||||||
|
*/
|
||||||
|
private boolean isParentTabField(String columnName)
|
||||||
|
{
|
||||||
|
if (m_gridTab == null)
|
||||||
|
return false;
|
||||||
|
GridTab parentTab = m_gridTab.getParentTab();
|
||||||
|
if (parentTab == null)
|
||||||
|
return false;
|
||||||
|
return parentTab.getField(columnName) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return true if this field (m_vo.ColumnName) also exist in parent tab
|
||||||
|
*/
|
||||||
|
private boolean isParentTabField()
|
||||||
|
{
|
||||||
|
return isParentTabField(m_vo.ColumnName);
|
||||||
|
}
|
||||||
} // MField
|
} // MField
|
||||||
|
|
|
@ -84,6 +84,8 @@ import org.compiere.util.ValueNamePair;
|
||||||
* https://sourceforge.net/tracker/?func=detail&aid=2874109&group_id=176962&atid=879332
|
* https://sourceforge.net/tracker/?func=detail&aid=2874109&group_id=176962&atid=879332
|
||||||
* <li>BF [ 2905287 ] GridTab query is not build correctly
|
* <li>BF [ 2905287 ] GridTab query is not build correctly
|
||||||
* https://sourceforge.net/tracker/?func=detail&aid=2905287&group_id=176962&atid=879332
|
* https://sourceforge.net/tracker/?func=detail&aid=2905287&group_id=176962&atid=879332
|
||||||
|
* <li>BF [ 3007342 ] Included tab context conflict issue
|
||||||
|
* https://sourceforge.net/tracker/?func=detail&aid=3007342&group_id=176962&atid=879332
|
||||||
* @author Victor Perez , e-Evolution.SC
|
* @author Victor Perez , e-Evolution.SC
|
||||||
* <li>FR [1877902] Implement JSR 223 Scripting APIs to Callout
|
* <li>FR [1877902] Implement JSR 223 Scripting APIs to Callout
|
||||||
* <li>BF [ 2910358 ] Error in context when a field is found in different tabs.
|
* <li>BF [ 2910358 ] Error in context when a field is found in different tabs.
|
||||||
|
@ -1473,7 +1475,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
*/
|
*/
|
||||||
public String get_ValueAsString (String variableName)
|
public String get_ValueAsString (String variableName)
|
||||||
{
|
{
|
||||||
return Env.getContext (m_vo.ctx, m_vo.WindowNo, variableName, true);
|
return Env.getContext (m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, variableName, false, true);
|
||||||
} // get_ValueAsString
|
} // get_ValueAsString
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3077,4 +3079,12 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
}
|
}
|
||||||
return tabNo;
|
return tabNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridTab getParentTab()
|
||||||
|
{
|
||||||
|
int parentTabNo = getParentTabNo();
|
||||||
|
if (parentTabNo < 0 || parentTabNo == m_vo.TabNo)
|
||||||
|
return null;
|
||||||
|
return m_window.getTab(parentTabNo);
|
||||||
|
}
|
||||||
} // GridTab
|
} // GridTab
|
||||||
|
|
|
@ -544,6 +544,24 @@ public final class Env
|
||||||
* @return value or ""
|
* @return value or ""
|
||||||
*/
|
*/
|
||||||
public static String getContext (Properties ctx, int WindowNo, int TabNo, String context, boolean onlyTab)
|
public static String getContext (Properties ctx, int WindowNo, int TabNo, String context, boolean onlyTab)
|
||||||
|
{
|
||||||
|
final boolean onlyWindow = onlyTab ? true : false;
|
||||||
|
return getContext(ctx, WindowNo, TabNo, context, onlyTab, onlyWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Value of Context for Window & Tab,
|
||||||
|
* if not found global context if available.
|
||||||
|
* If TabNo is TAB_INFO only tab's context will be checked.
|
||||||
|
* @param ctx context
|
||||||
|
* @param WindowNo window no
|
||||||
|
* @param TabNo tab no
|
||||||
|
* @param context context key
|
||||||
|
* @param onlyTab if true, no window value is searched
|
||||||
|
* @param onlyWindow if true, no global context will be searched
|
||||||
|
* @return value or ""
|
||||||
|
*/
|
||||||
|
public static String getContext (Properties ctx, int WindowNo, int TabNo, String context, boolean onlyTab, boolean onlyWindow)
|
||||||
{
|
{
|
||||||
if (ctx == null || context == null)
|
if (ctx == null || context == null)
|
||||||
throw new IllegalArgumentException ("Require Context");
|
throw new IllegalArgumentException ("Require Context");
|
||||||
|
@ -553,7 +571,7 @@ public final class Env
|
||||||
return s != null ? s : "";
|
return s != null ? s : "";
|
||||||
//
|
//
|
||||||
if (s == null && ! onlyTab)
|
if (s == null && ! onlyTab)
|
||||||
return getContext(ctx, WindowNo, context, false);
|
return getContext(ctx, WindowNo, context, onlyWindow);
|
||||||
return s;
|
return s;
|
||||||
} // getContext
|
} // getContext
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue