* don't allow create new record in detail when parent is empty or new
This commit is contained in:
parent
c133d6dd00
commit
5ed8857806
|
@ -128,7 +128,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected CLogger log = CLogger.getCLogger(getClass());
|
protected CLogger log = CLogger.getCLogger(getClass());
|
||||||
|
|
||||||
//private boolean m_parentNeedSave = false;
|
private boolean m_parentNeedSave = false;
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -518,7 +518,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
// Detail Query
|
// Detail Query
|
||||||
if (isDetail())
|
if (isDetail())
|
||||||
{
|
{
|
||||||
//m_parentNeedSave = false;
|
m_parentNeedSave = false;
|
||||||
String lc = getLinkColumnName();
|
String lc = getLinkColumnName();
|
||||||
if (lc.equals(""))
|
if (lc.equals(""))
|
||||||
log.severe ("No link column");
|
log.severe ("No link column");
|
||||||
|
@ -534,7 +534,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
{
|
{
|
||||||
//log.severe ("No value for link column " + lc);
|
//log.severe ("No value for link column " + lc);
|
||||||
//parent is new, can't retrieve detail
|
//parent is new, can't retrieve detail
|
||||||
//m_parentNeedSave = true;
|
m_parentNeedSave = true;
|
||||||
if (where.length() != 0)
|
if (where.length() != 0)
|
||||||
where.append(" AND ");
|
where.append(" AND ");
|
||||||
where.append(lc).append(" is null ");
|
where.append(lc).append(" is null ");
|
||||||
|
@ -866,6 +866,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
}
|
}
|
||||||
log.finest("Processed=" + processed);
|
log.finest("Processed=" + processed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//hengsin, dont create new when parent is empty
|
||||||
|
if (isDetail() && m_parentNeedSave)
|
||||||
|
return false;
|
||||||
|
|
||||||
boolean retValue = m_mTable.dataNew (m_currentRow, copy);
|
boolean retValue = m_mTable.dataNew (m_currentRow, copy);
|
||||||
if (!retValue)
|
if (!retValue)
|
||||||
return retValue;
|
return retValue;
|
||||||
|
@ -1172,6 +1177,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
{
|
{
|
||||||
if (m_vo.IsReadOnly)
|
if (m_vo.IsReadOnly)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
//hengsin, make detail readonly when parent is empty
|
||||||
|
if (m_parentNeedSave) return true;
|
||||||
|
|
||||||
// no restrictions
|
// no restrictions
|
||||||
if (m_vo.ReadOnlyLogic == null || m_vo.ReadOnlyLogic.equals(""))
|
if (m_vo.ReadOnlyLogic == null || m_vo.ReadOnlyLogic.equals(""))
|
||||||
|
|
Loading…
Reference in New Issue