IDEMPIERE-5123: On location dialog and location Editor, Region transl… (#1084)

* IDEMPIERE-5123: On location dialog and location Editor, Region translation is not respected.

* Update MRegion.java serialVersionUID

Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
Deepak Pansheriya 2021-12-23 16:29:07 +05:30 committed by GitHub
parent 9ae4a2636e
commit 5bfcedd0ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 7 deletions

View File

@ -560,7 +560,7 @@ public class MLocation extends X_C_Location implements Comparator<Object>, Immut
else if (token.equals("R")) else if (token.equals("R"))
{ {
if (getRegion() != null) // we have a region if (getRegion() != null) // we have a region
outStr.append(getRegion().getName()); outStr.append(getRegion().getTrlName());
else if (super.getRegionName() != null && super.getRegionName().length() > 0) else if (super.getRegionName() != null && super.getRegionName().length() > 0)
outStr.append(super.getRegionName()); // local region name outStr.append(super.getRegionName()); // local region name
} }
@ -585,8 +585,16 @@ public class MLocation extends X_C_Location implements Comparator<Object>, Immut
// Print Region Name if entered and not part of pattern // Print Region Name if entered and not part of pattern
if (c.getDisplaySequence().indexOf("@R@") == -1 if (c.getDisplaySequence().indexOf("@R@") == -1
&& super.getRegionName() != null && super.getRegionName().length() > 0) && super.getRegionName() != null && super.getRegionName().length() > 0) {
outStr.append(" ").append(super.getRegionName());
String regName =null;
if(getRegion()!=null)
regName =getRegion().getTrlName();
else
regName =super.getRegionName();
outStr.append(" ").append(regName);
}
String retValue = Util.replace(outStr.toString(), "\\n", "\n"); String retValue = Util.replace(outStr.toString(), "\\n", "\n");
if (log.isLoggable(Level.FINEST)) log.finest("parseCRP - " + c.getDisplaySequence() + " -> " + retValue); if (log.isLoggable(Level.FINEST)) log.finest("parseCRP - " + c.getDisplaySequence() + " -> " + retValue);

View File

@ -45,7 +45,7 @@ public class MRegion extends X_C_Region
/** /**
* *
*/ */
private static final long serialVersionUID = -752467671346696325L; private static final long serialVersionUID = 6956706379305907673L;
/** /**
* Load Regions (cached) * Load Regions (cached)
@ -257,9 +257,28 @@ public class MRegion extends X_C_Region
*/ */
public String toString() public String toString()
{ {
return getName(); return getTrlName();
} // toString } // toString
/**
* Get Translated Name
* @return name
*/
public String getTrlName()
{
return getTrlName(Env.getAD_Language(Env.getCtx()));
} // getTrlName
/**
* Get Translated Name
* @param language
* @return name
*/
public String getTrlName(String language)
{
return get_Translation(COLUMNNAME_Name, language);
} // getTrlName
/** /**
* Compare * Compare
* @param o1 object 1 * @param o1 object 1

View File

@ -192,7 +192,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
lstRegion.appendItem("", null); lstRegion.appendItem("", null);
for (MRegion region : MRegion.getRegions(m_origCountry_ID)) for (MRegion region : MRegion.getRegions(m_origCountry_ID))
{ {
lstRegion.appendItem(region.getName(),region); lstRegion.appendItem(region.getTrlName(),region);
} }
if (m_location.getCountry().isHasRegion()) { if (m_location.getCountry().isHasRegion()) {
if (m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName) != null if (m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName) != null
@ -543,7 +543,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
lstRegion.appendItem("", null); lstRegion.appendItem("", null);
for (MRegion region : MRegion.getRegions(country.getC_Country_ID())) for (MRegion region : MRegion.getRegions(country.getC_Country_ID()))
{ {
lstRegion.appendItem(region.getName(),region); lstRegion.appendItem(region.getTrlName(),region);
} }
if (m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName) != null if (m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName) != null
&& m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName).trim().length() > 0) && m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName).trim().length() > 0)