diff --git a/base/src/org/compiere/model/MCountry.java b/base/src/org/compiere/model/MCountry.java
index 6d9907df80..2aae129dc5 100644
--- a/base/src/org/compiere/model/MCountry.java
+++ b/base/src/org/compiere/model/MCountry.java
@@ -35,6 +35,9 @@ import org.compiere.util.Language;
*
* @author Jorg Janke
* @version $Id: MCountry.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $
+ *
+ * * @author Michael Judd (Akuna Ltd)
+ *
BF [ 2695078 ] Country is not translated on invoice
*/
public final class MCountry extends X_C_Country
implements Comparator, Serializable
@@ -219,6 +222,19 @@ public final class MCountry extends X_C_Country
return m_trlName;
} // getTrlName
+ /**
+ * Get Translated Name
+ * @param language
+ * @return name
+ */
+ public String getTrlName(String language)
+ {
+ if ( language != null)
+ {
+ m_trlName = get_Translation(COLUMNNAME_Name, language);
+ }
+ return m_trlName;
+ } // getTrlName
/**
diff --git a/base/src/org/compiere/model/MLocation.java b/base/src/org/compiere/model/MLocation.java
index 6d1f81e4dc..cd3d54e4b1 100644
--- a/base/src/org/compiere/model/MLocation.java
+++ b/base/src/org/compiere/model/MLocation.java
@@ -27,6 +27,7 @@ import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
+import org.compiere.util.Language;
import org.compiere.util.Util;
/**
@@ -34,6 +35,9 @@ import org.compiere.util.Util;
*
* @author Jorg Janke
* @version $Id: MLocation.java,v 1.3 2006/07/30 00:54:54 jjanke Exp $
+ *
+ * @author Michael Judd (Akuna Ltd)
+ * BF [ 2695078 ] Country is not translated on invoice
*/
public class MLocation extends X_C_Location implements Comparator
{
@@ -225,7 +229,20 @@ public class MLocation extends X_C_Location implements Comparator
return null;
return getCountryName();
} // getCountry
-
+ /**
+ * Get Country Line
+ * @param local if true only foreign country is returned
+ * @return country or null
+ */
+ public String getCountry (boolean local, String language)
+ {
+ if (local
+ && getC_Country_ID() == MCountry.getDefault(getCtx()).getC_Country_ID())
+ return null;
+ MCountry mc = getCountry();
+ return mc.getTrlName(language);
+
+ } // getCountry
/**
* Set Region
@@ -595,5 +612,5 @@ public class MLocation extends X_C_Location implements Comparator
+ " OR C_LocTo_ID=" + getC_Location_ID() + ")", get_TrxName());
return success;
} // afterSave
-
+
} // MLocation
diff --git a/base/src/org/compiere/print/layout/LayoutEngine.java b/base/src/org/compiere/print/layout/LayoutEngine.java
index 4e5c9ebb21..7ea86ff190 100644
--- a/base/src/org/compiere/print/layout/LayoutEngine.java
+++ b/base/src/org/compiere/print/layout/LayoutEngine.java
@@ -88,6 +88,8 @@ import org.compiere.util.ValueNamePair;
* @author victor.perez@e-evolution.com, e-Evolution
* BF [ 2011567 ] Implement Background Image for Document printed
* http://sourceforge.net/tracker/index.php?func=detail&aid=2011567&group_id=176962&atid=879335
+ * @author Michael Judd (Akuna Ltd)
+ * BF [ 2695078 ] Country is not translated on invoice
*/
public class LayoutEngine implements Pageable, Printable, Doc
{
@@ -1389,7 +1391,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
if (data.getDisplayType() == DisplayType.Location)
{
e = new LocationElement(m_printCtx, ((KeyNamePair)ID).getKey(), font, color,
- item.isHeightOneLine(), label, labelSuffix);
+ item.isHeightOneLine(), label, labelSuffix, m_format.getLanguage().getAD_Language());
e.layout (maxWidth, item.getMaxHeight(), item.isHeightOneLine(), FieldAlignmentType);
}
else
diff --git a/base/src/org/compiere/print/layout/LocationElement.java b/base/src/org/compiere/print/layout/LocationElement.java
index d3f13370c6..728869a4ba 100644
--- a/base/src/org/compiere/print/layout/LocationElement.java
+++ b/base/src/org/compiere/print/layout/LocationElement.java
@@ -22,6 +22,7 @@ import java.util.Properties;
import java.util.regex.Pattern;
import org.compiere.model.MLocation;
+import org.compiere.util.Language;
/**
* Location/Address Element.
@@ -33,6 +34,10 @@ import org.compiere.model.MLocation;
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
* BF [ 1888085 ] One line location field not working
* BF [ 1888094 ] PF: label & label suffix not working for location field
+ * BF [ 2695078 } Country is not translated on invoice
+ *
+ * @author Michael Judd (Akuna Ltd)
+ * BF [ 2695078 ] Country is not translated on invoice
*/
public class LocationElement extends GridElement
{
@@ -48,7 +53,7 @@ public class LocationElement extends GridElement
*/
public LocationElement(Properties ctx, int C_Location_ID, Font font, Paint color,
boolean isHeightOneLine,
- String label, String labelSuffix)
+ String label, String labelSuffix, String language)
{
super(isHeightOneLine ? 1 : 10, 1); // max
setGap(0,0);
@@ -66,7 +71,7 @@ public class LocationElement extends GridElement
}
else if (ml.isAddressLinesReverse())
{
- setData(index++, 0, ml.getCountry(true), font, color);
+ setData(index++, 0, ml.getCountry(true, language), font, color);
String[] lines = Pattern.compile("$", Pattern.MULTILINE).split(ml.getCityRegionPostal());
for (int i = 0; i < lines.length; i++)
setData(index++, 0, lines[i], font, color);
@@ -92,7 +97,7 @@ public class LocationElement extends GridElement
String[] lines = Pattern.compile("$", Pattern.MULTILINE).split(ml.getCityRegionPostal());
for (int i = 0; i < lines.length; i++)
setData(index++, 0, lines[i], font, color);
- setData(index++, 0, ml.getCountry(true), font, color);
+ setData(index++, 0, ml.getCountry(true, language), font, color);
}
}
} // LocationElement
@@ -102,7 +107,7 @@ public class LocationElement extends GridElement
* @see #LocationElement(Properties, int, Font, Paint, boolean, String, String)
*/
public LocationElement(Properties ctx, int C_Location_ID, Font font, Paint color) {
- this(ctx, C_Location_ID, font, color, false, null, null);
+ this(ctx, C_Location_ID, font, color, false, null, null, null);
}
} // LocationElement