From 74f6661322912001ec56e9307d67b4aec563c47f Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 8 Nov 2013 16:45:10 +0800 Subject: [PATCH] IDEMPIERE-1442 Additional confirmation on close and void action. Shouldn't pass document action value back to the document window until user have confirm the action. --- .../webui/panel/WDocActionPanel.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java index 5888e9b596..cb3b723598 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java @@ -305,13 +305,10 @@ public class WDocActionPanel extends Window implements EventListener, Dia if (Events.ON_CLICK.equals(event.getName())) { if (confirmPanel.getButton("Ok").equals(event.getTarget())) - { - m_OKpressed = true; - setValue(); + { MClientInfo clientInfo = MClientInfo.get(Env.getCtx()); if(clientInfo.isConfirmOnDocClose() || clientInfo.isConfirmOnDocVoid()) { - final Window window = this; String selected = lstDocAction.getSelectedItem().getValue().toString(); if((selected.equals(org.compiere.process.DocAction.ACTION_Close) && clientInfo.isConfirmOnDocClose()) || (selected.equals(org.compiere.process.DocAction.ACTION_Void) && clientInfo.isConfirmOnDocVoid())) @@ -323,17 +320,23 @@ public class WDocActionPanel extends Window implements EventListener, Dia @Override public void onCallback(Boolean result) { if(result) - window.detach(); + { + setValueAndClose(); + } else return; } }); } else - this.detach(); + { + setValueAndClose(); + } } else - this.detach(); + { + setValueAndClose(); + } } else if (confirmPanel.getButton("Cancel").equals(event.getTarget())) { @@ -351,6 +354,12 @@ public class WDocActionPanel extends Window implements EventListener, Dia } } + private void setValueAndClose() { + m_OKpressed = true; + setValue(); + detach(); + } + private void setValue() { int index = getSelectedIndex();