From a9776d5284e087d7b5de437b0bf40928bc2c0af1 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Tue, 13 Oct 2009 15:30:33 +0000 Subject: [PATCH] [ 2877874 ] Show error if document has no process associated https://sourceforge.net/tracker/?func=detail&aid=2877874&group_id=176962&atid=879332 Implemented to Swing and ZK. Please review. --- client/src/org/compiere/apps/APanel.java | 9 +++++++++ .../adempiere/webui/panel/AbstractADWindowPanel.java | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/client/src/org/compiere/apps/APanel.java b/client/src/org/compiere/apps/APanel.java index 8aea0a98a8..07d67af8bc 100644 --- a/client/src/org/compiere/apps/APanel.java +++ b/client/src/org/compiere/apps/APanel.java @@ -2306,6 +2306,8 @@ public final class APanel extends CPanel ADialog.error(m_curWindowNo, this, "SaveErrorRowNotFound"); return; } + + boolean isProcessMandatory = false; // Pop up Payment Rules if (col.equals("PaymentRule")) @@ -2324,6 +2326,7 @@ public final class APanel extends CPanel // Pop up Document Action (Workflow) else if (col.equals("DocAction")) { + isProcessMandatory = true; VDocAction vda = new VDocAction(m_curWindowNo, m_curTab, vButton, record_ID); // Something to select from? if (vda.getNumberOfOptions() == 0) @@ -2425,7 +2428,13 @@ public final class APanel extends CPanel log.config("Process_ID=" + vButton.getProcess_ID() + ", Record_ID=" + record_ID); if (vButton.getProcess_ID() == 0) + { + if (isProcessMandatory) + { + ADialog.error(m_curWindowNo, this, null, Msg.parseTranslation(m_ctx, "@NotFound@ @AD_Process_ID@")); + } return; + } // Save item changed if (m_curTab.needSave(true, false)) if (!cmd_save(true)) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index e9721357b6..b724187545 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -71,7 +71,6 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.WebDoc; -import org.jfree.util.Log; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.HtmlBasedComponent; @@ -1705,6 +1704,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To return; } + boolean isProcessMandatory = false; + // Pop up Payment Rules if (col.equals("PaymentRule")) @@ -1730,6 +1731,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To else if (col.equals("DocAction")) { + isProcessMandatory = true; WDocActionPanel win = new WDocActionPanel(curTab); if (win.getNumberOfOptions() == 0) { @@ -1834,7 +1836,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To logger.config("Process_ID=" + wButton.getProcess_ID() + ", Record_ID=" + record_ID); if (wButton.getProcess_ID() == 0) + { + if (isProcessMandatory) + { + FDialog.error(curWindowNo, null, null, Msg.parseTranslation(ctx, "@NotFound@ @AD_Process_ID@")); + } return; + } // Save item changed