From 3e23250e1854c4a6e989755dcf837c79f8e7b64e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 19 Feb 2014 09:32:43 -0500 Subject: [PATCH] IDEMPIERE-1747 when user click cancel button in "select role" in condition "change role". it should forward to system, not login / Peer review --- .../org/adempiere/webui/panel/RolePanel.java | 30 ++++++++++++------- .../adempiere/webui/window/LoginWindow.java | 2 +- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index fe94b09948..177dff5e80 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -79,7 +79,7 @@ public class RolePanel extends Window implements EventListener, Deferrabl /** * */ - private static final long serialVersionUID = 1071903027424763936L; + private static final long serialVersionUID = 4068073033610726196L; protected LoginWindow wndLogin; protected Login login; @@ -101,11 +101,19 @@ public class RolePanel extends Window implements EventListener, Deferrabl protected boolean m_show = true; private RolePanel component; - - public boolean isChangeRole = false; - + + private boolean isChangeRole = false; + + public boolean isChangeRole() { + return isChangeRole; + } + + public void setChangeRole(boolean isChangeRole) { + this.isChangeRole = isChangeRole; + } + // backup old value - private Properties b_ctx = null; + private Properties ctxBeforeChangeRole = null; private static final String ON_DEFER_LOGOUT = "onDeferLogout"; @@ -517,14 +525,14 @@ public class RolePanel extends Window implements EventListener, Deferrabl } else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) { - if (isChangeRole){ - changeRole(b_ctx); + if (isChangeRole()) { + changeRole(ctxBeforeChangeRole); validateRoles(); - }else{ + } else { + ctxBeforeChangeRole = null; SessionManager.logoutSession(); - wndLogin.loginCancelled(); + wndLogin.loginCancelled(); } - } else if (ON_DEFER_LOGOUT.equals(event.getName())) { @@ -548,7 +556,7 @@ public class RolePanel extends Window implements EventListener, Deferrabl } public void changeRole(Properties ctx) { - b_ctx = ctx; + ctxBeforeChangeRole = ctx; int AD_Client_ID = Env.getAD_Client_ID(ctx); lstClient.setValue(AD_Client_ID); updateRoleList(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java index 23ae5503be..f0c8270586 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java @@ -180,7 +180,7 @@ public class LoginWindow extends FWindow implements EventListener loginName = user.getLDAPUser() != null ? user.getLDAPUser() : user.getName(); loginOk(loginName, true, login.getClients()); getDesktop().getSession().setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx)); - pnlRole.isChangeRole = true; + pnlRole.setChangeRole(true); pnlRole.changeRole(ctx); } }