IDEMPIERE-1747:when user click cancel button in "select role" in condition "change role". it should forward to system, not login.

This commit is contained in:
hieplq 2014-02-11 00:42:13 +07:00
parent aab81ae1c7
commit fc810c64db
2 changed files with 15 additions and 3 deletions

View File

@ -102,6 +102,11 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
private RolePanel component; private RolePanel component;
public boolean isChangeRole = false;
// backup old value
private Properties b_ctx = null;
private static final String ON_DEFER_LOGOUT = "onDeferLogout"; private static final String ON_DEFER_LOGOUT = "onDeferLogout";
public RolePanel(Properties ctx, LoginWindow loginWindow, String userName, boolean show, KeyNamePair[] clientsKNPairs) { public RolePanel(Properties ctx, LoginWindow loginWindow, String userName, boolean show, KeyNamePair[] clientsKNPairs) {
@ -512,8 +517,14 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
} }
else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{ {
if (isChangeRole){
changeRole(b_ctx);
validateRoles();
}else{
SessionManager.logoutSession(); SessionManager.logoutSession();
wndLogin.loginCancelled(); wndLogin.loginCancelled();
}
} }
else if (ON_DEFER_LOGOUT.equals(event.getName())) else if (ON_DEFER_LOGOUT.equals(event.getName()))
{ {
@ -537,6 +548,7 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
} }
public void changeRole(Properties ctx) { public void changeRole(Properties ctx) {
b_ctx = ctx;
int AD_Client_ID = Env.getAD_Client_ID(ctx); int AD_Client_ID = Env.getAD_Client_ID(ctx);
lstClient.setValue(AD_Client_ID); lstClient.setValue(AD_Client_ID);
updateRoleList(); updateRoleList();

View File

@ -180,7 +180,7 @@ public class LoginWindow extends FWindow implements EventListener<Event>
loginName = user.getLDAPUser() != null ? user.getLDAPUser() : user.getName(); loginName = user.getLDAPUser() != null ? user.getLDAPUser() : user.getName();
loginOk(loginName, true, login.getClients()); loginOk(loginName, true, login.getClients());
getDesktop().getSession().setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx)); getDesktop().getSession().setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx));
pnlRole.isChangeRole = true;
pnlRole.changeRole(ctx); pnlRole.changeRole(ctx);
} }
} }