IDEMPIERE-4769 False result in validation for pending changes (#661)

* IDEMPIERE-4769 False result in validation for pending changes

* * Fix also the case that changing detail is not decorating the window title with prefix *
This commit is contained in:
Carlos Ruiz 2021-04-21 15:44:07 +02:00 committed by GitHub
parent 3be5c0ac92
commit 4e73c87e8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 64 additions and 65 deletions

View File

@ -184,8 +184,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
protected String title; protected String title;
private boolean boolChanges = false;
private int m_onlyCurrentDays = 0; private int m_onlyCurrentDays = 0;
private Component parent; private Component parent;
@ -1122,13 +1120,13 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/ */
public void onExit(Callback<Boolean> callback) public void onExit(Callback<Boolean> callback)
{ {
if (!boolChanges) if (isPendingChanges())
{ {
callback.onCallback(Boolean.TRUE); FDialog.ask(curWindowNo, null, "CloseUnSave?", callback);
} }
else else
{ {
FDialog.ask(curWindowNo, null, "CloseUnSave?", callback); callback.onCallback(Boolean.TRUE);
} }
} }
@ -1497,14 +1495,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (adTabbox.getSelectedGridTab() != gridTab) detailTab = true; if (adTabbox.getSelectedGridTab() != gridTab) detailTab = true;
} }
if (!detailTab)
{
String dbInfo = e.getMessage();
if (logger.isLoggable(Level.INFO)) logger.info(dbInfo);
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
dbInfo = "[ " + dbInfo + " ]";
breadCrumb.setStatusDB(dbInfo, e, adTabbox.getSelectedGridTab());
String adInfo = e.getAD_Message(); String adInfo = e.getAD_Message();
if ( adInfo == null if ( adInfo == null
|| GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo) || GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo)
@ -1516,8 +1506,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
) { ) {
String prefix = null; String prefix = null;
if (dbInfo.contains("*") || dbInfo.contains("?")) // ? used when not-autosave if (adTabbox.needSave(true, false) ||
adTabbox.getSelectedGridTab().isNew() ||
(adTabbox.getSelectedDetailADTabpanel() != null && adTabbox.getSelectedDetailADTabpanel().getGridTab().isNew())) {
// same condition as enableSave below
prefix = "*"; prefix = "*";
}
String titleLogic = null; String titleLogic = null;
int windowID = getADTab().getSelectedGridTab().getAD_Window_ID(); int windowID = getADTab().getSelectedGridTab().getAD_Window_ID();
@ -1560,6 +1554,14 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
SessionManager.getAppDesktop().setTabTitle(header, curWindowNo); SessionManager.getAppDesktop().setTabTitle(header, curWindowNo);
} }
if (!detailTab)
{
String dbInfo = e.getMessage();
if (logger.isLoggable(Level.INFO)) logger.info(dbInfo);
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
dbInfo = "[ " + dbInfo + " ]";
breadCrumb.setStatusDB(dbInfo, e, adTabbox.getSelectedGridTab());
} }
else if (adTabbox.getSelectedDetailADTabpanel() == null) else if (adTabbox.getSelectedDetailADTabpanel() == null)
{ {
@ -1711,9 +1713,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
boolean deleteRecord = !readOnly; boolean deleteRecord = !readOnly;
if (!detailTab) if (!detailTab)
{ {
// update Change
boolChanges = changed;
if (insertRecord) if (insertRecord)
{ {
insertRecord = tabPanel.getGridTab().isInsertRecord(); insertRecord = tabPanel.getGridTab().isInsertRecord();
@ -3663,7 +3662,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
public boolean isPendingChanges() { public boolean isPendingChanges() {
return boolChanges; return adTabbox.getDirtyADTabpanel() != null;
} }
public void setADWindow(ADWindow adwindow) { public void setADWindow(ADWindow adwindow) {