From e2af3a5516e21787a5bb256e6b1a0b0d287a925d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 12 Feb 2020 19:04:22 +0100 Subject: [PATCH] IDEMPIERE-4171 DB message on delete is lost --- .../src/org/compiere/model/GridTable.java | 6 +++--- .../src/org/compiere/util/CLogger.java | 13 +++++++++++++ .../webui/adwindow/AbstractADWindowContent.java | 10 +++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 9f766fcdfb..f7a8da5558 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -104,7 +104,7 @@ public class GridTable extends AbstractTableModel /** * */ - private static final long serialVersionUID = -2741647620577906242L; + private static final long serialVersionUID = 817894725729408648L; public static final String DATA_REFRESH_MESSAGE = "Refreshed"; public static final String DATA_UPDATE_COPIED_MESSAGE = "UpdateCopied"; @@ -3432,7 +3432,7 @@ public class GridTable extends AbstractTableModel e.setInfo(AD_Message, info, isError, !isError); } if (isError) - log.saveError(AD_Message, info); + log.saveWarning(AD_Message, info); fireDataStatusChanged (e); } // fireDataStatusEvent @@ -3499,7 +3499,7 @@ public class GridTable extends AbstractTableModel /** * */ - private static final long serialVersionUID = -8735217685095696892L; + private static final long serialVersionUID = -6866671239509705988L; /** * Construct Loader diff --git a/org.adempiere.base/src/org/compiere/util/CLogger.java b/org.adempiere.base/src/org/compiere/util/CLogger.java index 6c1837f600..a9e2278da9 100644 --- a/org.adempiere.base/src/org/compiere/util/CLogger.java +++ b/org.adempiere.base/src/org/compiere/util/CLogger.java @@ -241,6 +241,19 @@ public class CLogger extends Logger return true; } // saveWarning + /** + * Get Warning message from stack + * @param defaultMsg default message (used when there are no warnings on stack) + * @return error message, or defaultMsg if there is not error message saved + * @see #retrieveError() + */ + public static String retrieveWarningString(String defaultMsg) { + ValueNamePair vp = retrieveWarning(); + if (vp == null) + return defaultMsg; + return vp.getName(); + } + /** * Get Warning from Stack * @return AD_Message as Value and Message as String diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index f6476d435f..d8b5d1c96e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -2387,6 +2387,14 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements //other error will be catch in the dataStatusChanged event } + private void showLastWarning() { + String msg = CLogger.retrieveWarningString(null); + if (msg != null) + { + statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), msg), true); + } + } + /** * @see ToolbarListener#onSaveCreate() */ @@ -2470,7 +2478,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements adTabbox.getSelectedGridTab().dataRefreshAll(true, true); adTabbox.getSelectedGridTab().refreshParentTabs(); if (!success) - showLastError(); + showLastWarning(); adTabbox.getSelectedTabpanel().dynamicDisplay(0); focusToActivePanel();