BF [ 1817768 ] Isolate hardcoded table direct columns

This commit is contained in:
teo_sarca 2008-06-02 19:19:45 +00:00
parent 364f6b8327
commit 35911d8163
3 changed files with 28 additions and 16 deletions

View File

@ -27,7 +27,13 @@ import org.compiere.util.*;
* @author Jorg Janke
* @version $Id: MLookupFactory.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
*
* @author Teo Sarca - BF [ 1734394 ], BF [ 1714261 ], BF [ 1672820 ], BF [ 1739530 ], BF [ 1739544 ]
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>BF [ 1734394 ] MLookupFactory.getLookup_TableDirEmbed is not translated
* <li>BF [ 1714261 ] MLookupFactory: TableDirEmbed -> TableEmbed not supported
* <li>BF [ 1672820 ] Sorting should be language-sensitive
* <li>BF [ 1739530 ] getLookup_TableDirEmbed error when BaseColumn is sql query
* <li>BF [ 1739544 ] getLookup_TableEmbed error for self referecing references
* <li>BF [ 1817768 ] Isolate hardcoded table direct columns
*/
public class MLookupFactory
{
@ -588,12 +594,8 @@ public class MLookupFactory
return null;
}
// Hardcoded BPartner Org
if (ColumnName.equals("AD_OrgBP_ID"))
ColumnName = "AD_Org_ID";
String TableName = ColumnName.substring(0,ColumnName.length()-3);
String KeyColumn = ColumnName;
String KeyColumn = MQuery.getZoomColumnName(ColumnName);
String TableName = MQuery.getZoomTableName(ColumnName);
//boolean isSOTrx = !"N".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));
int ZoomWindow = 0;
int ZoomWindowPO = 0;
@ -755,8 +757,8 @@ public class MLookupFactory
static public String getLookup_TableDirEmbed (Language language,
String ColumnName, String BaseTable, String BaseColumn)
{
String TableName = ColumnName.substring(0,ColumnName.length()-3);
String KeyColumn = ColumnName;
String KeyColumn = MQuery.getZoomColumnName(ColumnName);
String TableName = MQuery.getZoomTableName(ColumnName);
// get display column name (first identifier column)
String sql = "SELECT c.ColumnName,c.IsTranslated,c.AD_Reference_ID,c.AD_Reference_Value_ID "

View File

@ -225,8 +225,17 @@ public class MQuery implements Serializable
if (columnName.equals("Bill_Location_ID"))
return "C_BPartner_Location_ID";
if (columnName.equals("Account_ID"))
return "C_ElementValue_ID";
// See also MTab.validateQuery
return "C_ElementValue_ID";
// Fix "*_To" columns
if (columnName.toUpperCase().endsWith("TO_ID")) {
return columnName.substring(0, columnName.length()-5)+"_ID";
}
if (columnName.toUpperCase().endsWith("_TO_ID")) {
return columnName.substring(0, columnName.length()-6)+"_ID";
}
if (columnName.equals("AD_OrgBP_ID"))
return "AD_Org_ID";
// See also GridTab.validateQuery
//
return columnName;
} // getZoomColumnName

View File

@ -43,7 +43,9 @@ import org.eevolution.model.*;
* @author Jorg Janke
* @version $Id: VLookup.java,v 1.5 2006/10/06 00:42:38 jjanke Exp $
*
* @author Teo Sarca - BF [ 1740835 ]
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>BF [ 1740835 ] NPE when closing a window
* <li>BF [ 1817768 ] Isolate hardcoded table direct columns
* @author Michael Judd (MultiSelect)
*/
public class VLookup extends JComponent
@ -1014,8 +1016,8 @@ public class VLookup extends JComponent
private String getDirectAccessSQL (String text)
{
StringBuffer sql = new StringBuffer();
m_tableName = m_columnName.substring(0, m_columnName.length()-3);
m_keyColumnName = m_columnName;
m_tableName = MQuery.getZoomTableName(m_columnName);
m_keyColumnName = MQuery.getZoomColumnName(m_columnName);
//
if (m_columnName.equals("M_Product_ID"))
{
@ -1151,7 +1153,6 @@ public class VLookup extends JComponent
+ " AND c.AD_Reference_ID IN (10,14)"
+ " AND EXISTS (SELECT * FROM AD_Column cc WHERE cc.AD_Table_ID=t.AD_Table_ID"
+ " AND cc.IsKey='Y' AND cc.ColumnName=?)";
m_keyColumnName = m_columnName;
sql = new StringBuffer();
PreparedStatement pstmt = null;
try
@ -1546,4 +1547,4 @@ final class VLookup_mouseAdapter extends java.awt.event.MouseAdapter
m_adaptee.popupMenu.setVisible(false);
} // mouse Clicked
} // VLookup_mouseAdapter
} // VLookup_mouseAdapter