IDEMPIERE-4650 Problems with Language Management in PO (#530)

* IDEMPIERE-4650 Problems with Language Management in PO

* * Set GardenWorld to use multi-lingual documents
This commit is contained in:
Carlos Ruiz 2021-01-18 12:57:33 +01:00 committed by GitHub
parent ebcf4b3e1c
commit 0cfa1c182a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 9 deletions

View File

@ -0,0 +1,25 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-4650 Problems with Language Management in PO
-- 2021 Jan 15 20:49:25 CET
UPDATE AD_Column SET ReadOnlyLogic='@#AD_Client_ID@=0',Updated=TO_DATE('2021-01-15 20:49:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7567
;
UPDATE AD_Client SET IsMultilingualDocument='Y' WHERE AD_Client_ID=0 AND IsMultilingualDocument!='Y';
-- 2021 Jan 15 20:51:26 CET
UPDATE AD_Process SET Help='In order to enable en_US as a translation you can enable any other language as base language.<br>
If you don''t want to have a base language choose a language that won''t be used for login.<br>
If all languages are going to be used as login, create an xx_XX language not login and use it as base.<br>
Please note that base language cannot be a system language.<br>
After running this process you must close all sessions and login again.<br>',Updated=TO_DATE('2021-01-15 20:51:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200040
;
-- Jan 17, 2021, 4:15:10 PM CET
UPDATE AD_Client SET IsMultiLingualDocument='Y',Updated=TO_DATE('2021-01-17 16:15:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Client_ID=11
;
SELECT register_migration_script('202101152101_IDEMPIERE-4650.sql') FROM dual
;

View File

@ -0,0 +1,22 @@
-- IDEMPIERE-4650 Problems with Language Management in PO
-- 2021 Jan 15 20:49:25 CET
UPDATE AD_Column SET ReadOnlyLogic='@#AD_Client_ID@=0',Updated=TO_TIMESTAMP('2021-01-15 20:49:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7567
;
UPDATE AD_Client SET IsMultilingualDocument='Y' WHERE AD_Client_ID=0 AND IsMultilingualDocument!='Y';
-- 2021 Jan 15 20:51:26 CET
UPDATE AD_Process SET Help='In order to enable en_US as a translation you can enable any other language as base language.<br>
If you don''t want to have a base language choose a language that won''t be used for login.<br>
If all languages are going to be used as login, create an xx_XX language not login and use it as base.<br>
Please note that base language cannot be a system language.<br>
After running this process you must close all sessions and login again.<br>',Updated=TO_TIMESTAMP('2021-01-15 20:51:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200040
;
-- Jan 17, 2021, 4:15:10 PM CET
UPDATE AD_Client SET IsMultiLingualDocument='Y',Updated=TO_TIMESTAMP('2021-01-17 16:15:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Client_ID=11
;
SELECT register_migration_script('202101152101_IDEMPIERE-4650.sql') FROM dual
;

View File

@ -3765,9 +3765,6 @@ public abstract class PO
return true;
String tableName = p_info.getTableName();
if (tableName.startsWith("AD") && getAD_Client_ID() == 0)
return true;
//
boolean trlColumnChanged = false;
for (int i = 0; i < p_info.getColumnCount(); i++)
@ -3820,12 +3817,14 @@ public abstract class PO
}
}
StringBuilder whereid = new StringBuilder(" WHERE ").append(keyColumn).append("=").append(get_ID());
StringBuilder andlang = new StringBuilder(" AND AD_Language=").append(DB.TO_STRING(client.getAD_Language()));
StringBuilder andnotlang = new StringBuilder(" AND AD_Language!=").append(DB.TO_STRING(client.getAD_Language()));
StringBuilder andClientLang = new StringBuilder(" AND AD_Language=").append(DB.TO_STRING(client.getAD_Language()));
StringBuilder andNotClientLang = new StringBuilder(" AND AD_Language!=").append(DB.TO_STRING(client.getAD_Language()));
String baselang = Language.getBaseAD_Language();
StringBuilder andBaseLang = new StringBuilder(" AND AD_Language=").append(DB.TO_STRING(baselang));
StringBuilder andNotBaseLang = new StringBuilder(" AND AD_Language!=").append(DB.TO_STRING(baselang));
int no = -1;
if (client.isMultiLingualDocument()) {
String baselang = Language.getBaseAD_Language();
if (client.getAD_Language().equals(baselang)) {
// tenant language = base language
// set all translations as untranslated
@ -3837,13 +3836,14 @@ public abstract class PO
if (log.isLoggable(Level.FINE)) log.fine("#" + no);
} else {
// tenant language <> base language
// auto update translation for tenant language
// for Tenants auto update translation for tenant language
// for System update translation for base language (which in fact must always update zero records as there must not be translations for base)
StringBuilder sqlexec = new StringBuilder()
.append(sqlupdate)
.append(sqlcols)
.append("IsTranslated='Y'")
.append(whereid)
.append(andlang);
.append(getAD_Client_ID() == 0 ? andBaseLang : andClientLang);
no = DB.executeUpdate(sqlexec.toString(), m_trxName);
if (log.isLoggable(Level.FINE)) log.fine("#" + no);
if (no >= 0) {
@ -3852,7 +3852,7 @@ public abstract class PO
.append(sqlupdate)
.append("IsTranslated='N'")
.append(whereid)
.append(andnotlang);
.append(getAD_Client_ID() == 0 ? andNotBaseLang : andNotClientLang);
no = DB.executeUpdate(sqlexec.toString(), m_trxName);
if (log.isLoggable(Level.FINE)) log.fine("#" + no);
}