BF [ 2695078 ] Country is not translated on invoice

This commit is contained in:
mjudd 2009-03-23 20:39:53 +00:00
parent c0ccf339be
commit ac51d2a734
4 changed files with 47 additions and 7 deletions

View File

@ -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)
* <li>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
/**

View File

@ -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)
* <li>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

View File

@ -88,6 +88,8 @@ import org.compiere.util.ValueNamePair;
* @author victor.perez@e-evolution.com, e-Evolution
* <li>BF [ 2011567 ] Implement Background Image for Document printed
* <li>http://sourceforge.net/tracker/index.php?func=detail&aid=2011567&group_id=176962&atid=879335
* @author Michael Judd (Akuna Ltd)
* <li>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

View File

@ -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
* <li>BF [ 1888085 ] One line location field not working
* <li>BF [ 1888094 ] PF: label & label suffix not working for location field
* <li>BF [ 2695078 } Country is not translated on invoice
*
* @author Michael Judd (Akuna Ltd)
* <li>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