From d433b9c78e32ae9548b3b4b74907e5af283ad729 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Tue, 10 Jul 2007 08:28:42 +0000 Subject: [PATCH] BF [ 1748449 ] Info Account - Posting Type is not translated http://sourceforge.net/tracker/index.php?func=detail&aid=1748449&group_id=176962&atid=879332 --- base/src/org/compiere/model/MRefList.java | 27 ++++++++++++++----- .../src/org/compiere/acct/AcctViewerData.java | 6 +++-- .../src/org/compiere/apps/wf/WFActivity.java | 6 +++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/base/src/org/compiere/model/MRefList.java b/base/src/org/compiere/model/MRefList.java index 400988f683..a8ac2d4ff2 100644 --- a/base/src/org/compiere/model/MRefList.java +++ b/base/src/org/compiere/model/MRefList.java @@ -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 list = new ArrayList(); 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))); diff --git a/client/src/org/compiere/acct/AcctViewerData.java b/client/src/org/compiere/acct/AcctViewerData.java index 4e57c13cef..09054c560c 100644 --- a/client/src/org/compiere/acct/AcctViewerData.java +++ b/client/src/org/compiere/acct/AcctViewerData.java @@ -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 diff --git a/client/src/org/compiere/apps/wf/WFActivity.java b/client/src/org/compiere/apps/wf/WFActivity.java index 4dfbd8ebb5..55b4ca84bd 100644 --- a/client/src/org/compiere/apps/wf/WFActivity.java +++ b/client/src/org/compiere/apps/wf/WFActivity.java @@ -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); }