hg merge release-2.1 (merge release2.1 into development)

This commit is contained in:
Carlos Ruiz 2015-08-11 12:12:04 -05:00
commit b58749e8bb
2 changed files with 6 additions and 12 deletions

View File

@ -425,8 +425,6 @@ public abstract class PO
*/ */
public Properties getCtx() public Properties getCtx()
{ {
if (p_ctx.size() == 0 && Env.getCtx().size() > 0)
p_ctx = Env.getCtx();
return p_ctx; return p_ctx;
} // getCtx } // getCtx
@ -4707,7 +4705,7 @@ public abstract class PO
} }
private void checkValidContext() { private void checkValidContext() {
if (getCtx().size() == 0) if (getCtx().isEmpty() && getCtx().getProperty("#AD_Client_ID") == null)
throw new AdempiereException("Context lost"); throw new AdempiereException("Context lost");
} }

View File

@ -39,8 +39,6 @@ public class CompiereService {
private static CLogger log = CLogger.getCLogger(CompiereService.class); private static CLogger log = CLogger.getCLogger(CompiereService.class);
private Properties m_ctx;
private int m_AD_Client_ID; private int m_AD_Client_ID;
private int m_AD_Org_ID; private int m_AD_Org_ID;
private int m_AD_User_ID; private int m_AD_User_ID;
@ -92,7 +90,7 @@ public class CompiereService {
* @return context of current request * @return context of current request
*/ */
public Properties getCtx() { public Properties getCtx() {
return m_ctx; return Env.getCtx();
} }
/** /**
@ -113,11 +111,10 @@ public class CompiereService {
{ {
CompiereUtil.initWeb(); CompiereUtil.initWeb();
m_ctx = new Properties();
m_connected = true; m_connected = true;
ServerContext.setCurrentInstance(m_ctx); ServerContext.setCurrentInstance(new Properties());
Env.setContext( m_ctx, "#AD_Language", "en_US" ); Env.setContext(getCtx(), "#AD_Language", "en_US" );
m_language = Language.getLanguage("en_US"); m_language = Language.getLanguage("en_US");
dateFormat = DisplayType.getDateFormat(DisplayType.Date, m_language); dateFormat = DisplayType.getDateFormat(DisplayType.Date, m_language);
@ -138,7 +135,6 @@ public class CompiereService {
{ {
Env.logout(); Env.logout();
ServerContext.dispose(); ServerContext.dispose();
m_ctx = null;
m_loggedin = false; m_loggedin = false;
m_connected = false; m_connected = false;
} }
@ -255,7 +251,7 @@ public class CompiereService {
m_locale = Lang; m_locale = Lang;
m_userName = MUser.getNameOfUser(m_AD_User_ID); m_userName = MUser.getNameOfUser(m_AD_User_ID);
Env.setContext( m_ctx, "#AD_Language", Lang); Env.setContext( getCtx(), "#AD_Language", Lang);
m_language = Language.getLanguage(Lang); m_language = Language.getLanguage(Lang);
Env.verifyLanguage( getCtx(), m_language ); Env.verifyLanguage( getCtx(), m_language );
@ -274,7 +270,7 @@ public class CompiereService {
if (log.isLoggable(Level.INFO)) log.info(" #Date = "+ Env.getContextAsDate( getCtx(), "#Date")); if (log.isLoggable(Level.INFO)) log.info(" #Date = "+ Env.getContextAsDate( getCtx(), "#Date"));
Env.setContext( getCtx(), "#M_Warehouse_ID", M_Warehouse_ID ); Env.setContext( getCtx(), "#M_Warehouse_ID", M_Warehouse_ID );
Env.setContext(m_ctx, Env.LANGUAGE, m_language.getAD_Language()); Env.setContext(getCtx(), Env.LANGUAGE, m_language.getAD_Language());
// Create session // Create session
MSession session = MSession.get (getCtx(), false); MSession session = MSession.get (getCtx(), false);