From 4f9b2b3b9c5c147d7890d4464fdddb2f9ca4cdb2 Mon Sep 17 00:00:00 2001 From: tobi42 Date: Thu, 13 Aug 2009 10:39:25 +0000 Subject: [PATCH] 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 --- client/src/org/compiere/apps/APanel.java | 44 +++++++++++------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/client/src/org/compiere/apps/APanel.java b/client/src/org/compiere/apps/APanel.java index c8ae361719..c50915ec77 100644 --- a/client/src/org/compiere/apps/APanel.java +++ b/client/src/org/compiere/apps/APanel.java @@ -124,6 +124,8 @@ import org.compiere.util.Util; *
  • BF [ 1998575 ] Document Print is discarding any error * @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 + * @autor tobi42, metas GmBH + *
  • BF [ 2799362 ] You can press New button a lot of times * */ public final class APanel extends CPanel @@ -1690,34 +1692,28 @@ public final class APanel extends CPanel m_curGC.stopEditor(true); m_curGC.acceptEditorChanges(); - // has anything changed? - if (m_curTab.needSave(true, false)) - { // do we have real change - if (m_curTab.needSave(true, true)) + // BF [ 2799362 ] attempt to save if save action is enabled. Using + // m_curTab.needSave instead might miss unfilled mandatory fields. + if(aSave.isEnabled()){ + // Automatic Save + if (Env.isAutoCommit(m_ctx, m_curWindowNo)) { - // Automatic Save - if (Env.isAutoCommit(m_ctx, m_curWindowNo)) - { - if (!cmd_save(true)) - { - return; - } + if (!cmd_save(true)) + { + return; } - // explicitly ask when changing tabs - else if (ADialog.ask(m_curWindowNo, this, "SaveChanges?", m_curTab.getCommitWarning())) - { // yes we want to save - if (!cmd_save(true)) - { - return; - } - } - else // Don't save - m_curTab.dataIgnore(); } - else // new record, but nothing changed + // explicitly ask when changing tabs + else if (ADialog.ask(m_curWindowNo, this, "SaveChanges?", m_curTab.getCommitWarning())) + { // yes we want to save + if (!cmd_save(true)) + { + return; + } + } + else // Don't save m_curTab.dataIgnore(); - } // there is a change - + } m_curTab.dataNew (copy); m_curGC.dynamicDisplay(0); // m_curTab.getTableModel().setChanged(false);