IDEMPIERE-3329 Issue with cached translations / integrate from Nicolas Micoud

This commit is contained in:
Carlos Ruiz 2017-04-12 23:49:59 +02:00
parent 28505bf01b
commit 19847dc4ce
1 changed files with 14 additions and 1 deletions

View File

@ -1909,7 +1909,7 @@ public abstract class PO
+ ", ID=" + m_IDs[0]);
}
String key = get_TableName() + "." + columnName + "|" + get_ID() + "|" + AD_Language;
String key = getTrlCacheKey(columnName, AD_Language);
String retValue = null;
if (! reload && trl_cache.containsKey(key)) {
retValue = trl_cache.get(key);
@ -1942,6 +1942,11 @@ public abstract class PO
return retValue;
} // get_Translation
/** Return the key used in the translation cache */
private String getTrlCacheKey(String columnName, String AD_Language) {
return get_TableName() + "." + columnName + "|" + get_ID() + "|" + AD_Language;
}
/**
* Get Translation of column
* @param ctx context
@ -3645,6 +3650,14 @@ public abstract class PO
else
sqlcols.append(value.toString());
sqlcols.append(",");
// Reset of related translation cache entries
String[] availableLanguages = Language.getNames();
for (String langName : availableLanguages) {
Language language = Language.getLanguage(langName);
String key = getTrlCacheKey(columnName, language.getAD_Language());
trl_cache.remove(key);
}
}
}
StringBuilder whereid = new StringBuilder(" WHERE ").append(keyColumn).append("=").append(get_ID());