BF [ 2799362 ] You can press New button a lot of times

Fix uses status of aSave action (enabled or disabled) instead of m_curTab.needSave(), because the latter can return false even if there are yet unfilled mandatory fields
This commit is contained in:
tobi42 2009-08-13 10:39:25 +00:00
parent 1d5537e95b
commit 4f9b2b3b9c
1 changed files with 20 additions and 24 deletions

View File

@ -124,6 +124,8 @@ import org.compiere.util.Util;
* <li>BF [ 1998575 ] Document Print is discarding any error * <li>BF [ 1998575 ] Document Print is discarding any error
* @author victor.perez@e-evolution.com * @author victor.perez@e-evolution.com
* @see FR [ 1966328 ] New Window Info to MRP and CRP into View http://sourceforge.net/tracker/index.php?func=detail&aid=1966328&group_id=176962&atid=879335 * @see FR [ 1966328 ] New Window Info to MRP and CRP into View http://sourceforge.net/tracker/index.php?func=detail&aid=1966328&group_id=176962&atid=879335
* @autor tobi42, metas GmBH
* <li>BF [ 2799362 ] You can press New button a lot of times
* *
*/ */
public final class APanel extends CPanel public final class APanel extends CPanel
@ -1690,11 +1692,9 @@ public final class APanel extends CPanel
m_curGC.stopEditor(true); m_curGC.stopEditor(true);
m_curGC.acceptEditorChanges(); m_curGC.acceptEditorChanges();
// has anything changed? // BF [ 2799362 ] attempt to save if save action is enabled. Using
if (m_curTab.needSave(true, false)) // m_curTab.needSave instead might miss unfilled mandatory fields.
{ // do we have real change if(aSave.isEnabled()){
if (m_curTab.needSave(true, true))
{
// Automatic Save // Automatic Save
if (Env.isAutoCommit(m_ctx, m_curWindowNo)) if (Env.isAutoCommit(m_ctx, m_curWindowNo))
{ {
@ -1714,10 +1714,6 @@ public final class APanel extends CPanel
else // Don't save else // Don't save
m_curTab.dataIgnore(); m_curTab.dataIgnore();
} }
else // new record, but nothing changed
m_curTab.dataIgnore();
} // there is a change
m_curTab.dataNew (copy); m_curTab.dataNew (copy);
m_curGC.dynamicDisplay(0); m_curGC.dynamicDisplay(0);
// m_curTab.getTableModel().setChanged(false); // m_curTab.getTableModel().setChanged(false);