IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows / use case 2 / peer review

This commit is contained in:
Carlos Ruiz 2013-07-23 19:13:18 -05:00
parent f81147ec4d
commit eab98bfc54
6 changed files with 8 additions and 2 deletions

View File

@ -7,6 +7,7 @@ INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,V
-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200208 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('20130718094134_IDEMPIERE-984.sql') FROM dual
;

View File

@ -7,6 +7,7 @@ INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,V
-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200208 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('20130718094134_IDEMPIERE-984.sql') FROM dual
;

View File

@ -86,7 +86,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
/**
*
*/
private static final long serialVersionUID = -208259686238044047L;
private static final long serialVersionUID = 6505634026383902627L;
private static final String SAVED_CONTEXT = "saved.context";

View File

@ -33,6 +33,7 @@ public interface IWebClient {
* logout
*/
public void logout();
/**
* logout after browser destroyed
*/

View File

@ -79,7 +79,7 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
{
String s = Msg.getMsg(Env.getCtx(), "CloseTabFromBrowser?").replace("\n", "<br>");
Clients.confirmClose(s);
lblUserNameValue = (Label) component.getFellowIfAny("loginUserAndRole", true);
lblUserNameValue = (Label) component.getFellowIfAny("loginUserAndRole", true);
lblUserNameValue.setValue(getUserName() + "@" + getClientName() + "." + getOrgName()+"/"+this.getRoleName());
lblUserNameValue.addEventListener(Events.ON_CLICK, this);
@ -242,11 +242,13 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
}
else if (ON_DEFER_LOGOUT.equals(event.getName()))
{
Clients.confirmClose(null);
SessionManager.logoutSession();
}
else if (ON_DEFER_CHANGE_ROLE.equals(event.getName()))
{
MUser user = MUser.get(ctx);
Clients.confirmClose(null);
SessionManager.changeRole(user);
}

View File

@ -100,6 +100,7 @@ public class SessionManager
if (app != null)
app.logout();
}
public static void logoutSessionAfterBrowserDestroyed()
{
IWebClient app = getSessionApplication();