BF [ 1748449 ] Info Account - Posting Type is not translated

http://sourceforge.net/tracker/index.php?func=detail&aid=1748449&group_id=176962&atid=879332
This commit is contained in:
teo_sarca 2007-07-10 08:28:42 +00:00
parent d6a35fc815
commit d433b9c78e
3 changed files with 28 additions and 11 deletions

View File

@ -27,6 +27,8 @@ import org.compiere.util.*;
*
* @author Jorg Janke
* @version $Id: MRefList.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $
*
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1748449 ]
*/
public class MRefList extends X_AD_Ref_List
{
@ -137,15 +139,24 @@ public class MRefList extends X_AD_Ref_List
/**
* Get Reference List
* @param AD_Reference_ID reference
* @param optional if true add "",""
* @return List or null
* Get Reference List (translated)
* @param ctx context
* @param AD_Reference_ID reference
* @param optional if true add "",""
* @return List or null
*/
public static ValueNamePair[] getList (int AD_Reference_ID, boolean optional)
public static ValueNamePair[] getList (Properties ctx, int AD_Reference_ID, boolean optional)
{
String sql = "SELECT Value, Name FROM AD_Ref_List "
+ "WHERE AD_Reference_ID=? AND IsActive='Y' ORDER BY 1";
String ad_language = Env.getAD_Language(ctx);
boolean isBaseLanguage = Env.isBaseLanguage(ad_language, "AD_Ref_List");
String sql = isBaseLanguage ?
"SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=? AND IsActive='Y' ORDER BY Name"
:
"SELECT r.Value, t.Name FROM AD_Ref_List_Trl t"
+ " INNER JOIN AD_Ref_List r ON (r.AD_Ref_List_ID=t.AD_Ref_List_ID)"
+ " WHERE r.AD_Reference_ID=? AND t.AD_Language=? AND r.IsActive='Y'"
+ " ORDER BY t.Name"
;
PreparedStatement pstmt = null;
ArrayList<ValueNamePair> list = new ArrayList<ValueNamePair>();
if (optional)
@ -154,6 +165,8 @@ public class MRefList extends X_AD_Ref_List
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Reference_ID);
if (!isBaseLanguage)
pstmt.setString(2, ad_language);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new ValueNamePair(rs.getString(1), rs.getString(2)));

View File

@ -30,7 +30,9 @@ import org.compiere.util.*;
* Account Viewer State - maintaines State information for the Account Viewer
*
* @author Jorg Janke
* @version $Id: AcctViewerData.java,v 1.3 2006/08/10 01:00:27 jjanke Exp $
* @version $Id: AcctViewerData.java,v 1.3 2006/08/10 01:00:27 jjanke Exp $
*
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1748449 ]
*/
class AcctViewerData
{
@ -149,7 +151,7 @@ class AcctViewerData
protected void fillPostingType (JComboBox cb)
{
int AD_Reference_ID = 125;
ValueNamePair[] pt = MRefList.getList(AD_Reference_ID, true);
ValueNamePair[] pt = MRefList.getList(Env.getCtx(), AD_Reference_ID, true);
for (int i = 0; i < pt.length; i++)
cb.addItem(pt[i]);
} // fillPostingType

View File

@ -35,6 +35,8 @@ import org.compiere.wf.*;
*
* @author Jorg Janke
* @version $Id: WFActivity.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
*
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1748449 ]
*/
public class WFActivity extends CPanel
implements FormPanel, ActionListener
@ -392,13 +394,13 @@ public class WFActivity extends CPanel
int dt = m_column.getAD_Reference_ID();
if (dt == DisplayType.YesNo)
{
ValueNamePair[] values = MRefList.getList(319, false); // _YesNo
ValueNamePair[] values = MRefList.getList(Env.getCtx(), 319, false); // _YesNo
fAnswerList.setModel(new DefaultComboBoxModel(values));
fAnswerList.setVisible(true);
}
else if (dt == DisplayType.List)
{
ValueNamePair[] values = MRefList.getList(m_column.getAD_Reference_Value_ID(), false);
ValueNamePair[] values = MRefList.getList(Env.getCtx(), m_column.getAD_Reference_Value_ID(), false);
fAnswerList.setModel(new DefaultComboBoxModel(values));
fAnswerList.setVisible(true);
}