IDEMPIERE-5131 Base language cannot be changed by process 'change base language' (#1100)

This commit is contained in:
Carlos Ruiz 2022-01-02 06:26:58 +01:00 committed by GitHub
parent bf67ba45e0
commit 75bc20b404
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -72,7 +72,8 @@ public class ChangeBaseLanguage extends SvrProcess
if (Util.isEmpty(p_Language))
throw new AdempiereUserError("Language required");
MLanguage lang = MLanguage.get(getCtx(), p_Language);
MLanguage langCached = MLanguage.get(getCtx(), p_Language);
MLanguage lang = new MLanguage(getCtx(), langCached.getAD_Language_ID(), get_TrxName());
if (lang.isBaseLanguage())
throw new AdempiereUserError("Same base language");
if (lang.isSystemLanguage())
@ -82,7 +83,8 @@ public class ChangeBaseLanguage extends SvrProcess
throw new AdempiereUserError("Same base language");
// Disable the base flag on the actual
MLanguage baselang = MLanguage.get(getCtx(), Language.getBaseAD_Language());
MLanguage baselangCached = MLanguage.get(getCtx(), Language.getBaseAD_Language());
MLanguage baselang = new MLanguage(getCtx(), baselangCached.getAD_Language_ID(), get_TrxName());
baselang.setIsBaseLanguage(false);
baselang.saveEx(get_TrxName());

View File

@ -152,7 +152,8 @@ public class Translation implements IApplication
SAXParser parser = factory.newSAXParser();
parser.parse(in, handler);
if (log.isLoggable(Level.INFO)) log.info("Updated=" + handler.getUpdateCount());
MLanguage lang = MLanguage.get(m_ctx, AD_Language);
MLanguage langCached = MLanguage.get(m_ctx, AD_Language);
MLanguage lang = new MLanguage(m_ctx, langCached.getAD_Language_ID(), null);
if (! lang.isLoginLocale()) {
lang.setIsLoginLocale(true);
lang.saveEx();