* don't allow create new record in detail when parent is empty or new

This commit is contained in:
Heng Sin Low 2007-02-12 23:59:13 +00:00
parent c133d6dd00
commit 5ed8857806
1 changed files with 11 additions and 3 deletions

View File

@ -128,7 +128,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
/** Logger */
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
if (isDetail())
{
//m_parentNeedSave = false;
m_parentNeedSave = false;
String lc = getLinkColumnName();
if (lc.equals(""))
log.severe ("No link column");
@ -534,7 +534,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
{
//log.severe ("No value for link column " + lc);
//parent is new, can't retrieve detail
//m_parentNeedSave = true;
m_parentNeedSave = true;
if (where.length() != 0)
where.append(" AND ");
where.append(lc).append(" is null ");
@ -866,6 +866,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
}
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);
if (!retValue)
return retValue;
@ -1173,6 +1178,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
if (m_vo.IsReadOnly)
return true;
//hengsin, make detail readonly when parent is empty
if (m_parentNeedSave) return true;
// no restrictions
if (m_vo.ReadOnlyLogic == null || m_vo.ReadOnlyLogic.equals(""))
return m_vo.IsReadOnly;