IDEMPIERE-2235 Report wizard : ability to change the print format name - peer review
This commit is contained in:
parent
155d591aa9
commit
2fb07c0bb8
|
@ -107,7 +107,7 @@ public abstract class PO
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2731993630208549493L;
|
private static final long serialVersionUID = 8237905660667141657L;
|
||||||
|
|
||||||
public static final String LOCAL_TRX_PREFIX = "POSave";
|
public static final String LOCAL_TRX_PREFIX = "POSave";
|
||||||
|
|
||||||
|
@ -1882,16 +1882,22 @@ public abstract class PO
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<String,String> trl_cache = new CCache<String,String>("po_trl", 5);
|
private static CCache<String,String> trl_cache = new CCache<String,String>("po_trl", 5);
|
||||||
|
|
||||||
|
public String get_Translation (String columnName, String AD_Language)
|
||||||
|
{
|
||||||
|
return get_Translation(columnName, AD_Language, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Translation of column (if needed).
|
* Get Translation of column (if needed).
|
||||||
* It checks if the base language is used or the column is not translated.
|
* It checks if the base language is used or the column is not translated.
|
||||||
* If there is no translation then it fallback to original value.
|
* If there is no translation then it fallback to original value.
|
||||||
* @param columnName
|
* @param columnName
|
||||||
* @param AD_Language
|
* @param AD_Language
|
||||||
|
* @boolean reload
|
||||||
* @return translated string
|
* @return translated string
|
||||||
* @throws IllegalArgumentException if columnName or AD_Language is null or model has multiple PK
|
* @throws IllegalArgumentException if columnName or AD_Language is null or model has multiple PK
|
||||||
*/
|
*/
|
||||||
public String get_Translation (String columnName, String AD_Language)
|
public String get_Translation (String columnName, String AD_Language, boolean reload)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Check if columnName, AD_Language is valid or table support translation (has 1 PK) => error
|
// Check if columnName, AD_Language is valid or table support translation (has 1 PK) => error
|
||||||
|
@ -1907,7 +1913,7 @@ public abstract class PO
|
||||||
|
|
||||||
String key = get_TableName() + "." + columnName + "|" + get_ID() + "|" + AD_Language;
|
String key = get_TableName() + "." + columnName + "|" + get_ID() + "|" + AD_Language;
|
||||||
String retValue = null;
|
String retValue = null;
|
||||||
if (trl_cache.containsKey(key)) {
|
if (! reload && trl_cache.containsKey(key)) {
|
||||||
retValue = trl_cache.get(key);
|
retValue = trl_cache.get(key);
|
||||||
return retValue;
|
return retValue;
|
||||||
|
|
||||||
|
|
|
@ -422,8 +422,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
||||||
trl.set_ValueOfColumn("Name", (String) name.getValue());
|
trl.set_ValueOfColumn("Name", (String) name.getValue());
|
||||||
trl.saveEx();
|
trl.saveEx();
|
||||||
|
|
||||||
String key = fm.getTranslationKey("Name", trl.get_ValueAsString("AD_Language"));
|
fm.get_Translation("Name", trl.get_ValueAsString("AD_Language"), true); // reload
|
||||||
fm.removeTrlFromCache(key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -623,7 +623,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
{
|
{
|
||||||
MPrintFormat printFormat = new MPrintFormat (Env.getCtx(), rs, null);
|
MPrintFormat printFormat = new MPrintFormat (Env.getCtx(), rs, null);
|
||||||
|
|
||||||
KeyNamePair pp = new KeyNamePair(printFormat.get_ID(), printFormat.get_Translation(MPrintFormat.COLUMNNAME_Name));
|
KeyNamePair pp = new KeyNamePair(printFormat.get_ID(), printFormat.get_Translation(MPrintFormat.COLUMNNAME_Name, Env.getAD_Language(Env.getCtx()), true));
|
||||||
Listitem li = comboReport.appendItem(pp.getName(), pp.getKey());
|
Listitem li = comboReport.appendItem(pp.getName(), pp.getKey());
|
||||||
if (rs.getInt(1) == AD_PrintFormat_ID)
|
if (rs.getInt(1) == AD_PrintFormat_ID)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue