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.

This commit is contained in:
Heng Sin Low 2013-11-08 16:45:10 +08:00
parent d19475f4bf
commit 74f6661322
1 changed files with 16 additions and 7 deletions

View File

@ -306,12 +306,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
{ {
if (confirmPanel.getButton("Ok").equals(event.getTarget())) if (confirmPanel.getButton("Ok").equals(event.getTarget()))
{ {
m_OKpressed = true;
setValue();
MClientInfo clientInfo = MClientInfo.get(Env.getCtx()); MClientInfo clientInfo = MClientInfo.get(Env.getCtx());
if(clientInfo.isConfirmOnDocClose() || clientInfo.isConfirmOnDocVoid()) if(clientInfo.isConfirmOnDocClose() || clientInfo.isConfirmOnDocVoid())
{ {
final Window window = this;
String selected = lstDocAction.getSelectedItem().getValue().toString(); String selected = lstDocAction.getSelectedItem().getValue().toString();
if((selected.equals(org.compiere.process.DocAction.ACTION_Close) && clientInfo.isConfirmOnDocClose()) if((selected.equals(org.compiere.process.DocAction.ACTION_Close) && clientInfo.isConfirmOnDocClose())
|| (selected.equals(org.compiere.process.DocAction.ACTION_Void) && clientInfo.isConfirmOnDocVoid())) || (selected.equals(org.compiere.process.DocAction.ACTION_Void) && clientInfo.isConfirmOnDocVoid()))
@ -323,17 +320,23 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
if(result) if(result)
window.detach(); {
setValueAndClose();
}
else else
return; return;
} }
}); });
} }
else else
this.detach(); {
setValueAndClose();
}
} }
else else
this.detach(); {
setValueAndClose();
}
} }
else if (confirmPanel.getButton("Cancel").equals(event.getTarget())) else if (confirmPanel.getButton("Cancel").equals(event.getTarget()))
{ {
@ -351,6 +354,12 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
} }
} }
private void setValueAndClose() {
m_OKpressed = true;
setValue();
detach();
}
private void setValue() private void setValue()
{ {
int index = getSelectedIndex(); int index = getSelectedIndex();