Fix for IDEMPIERE-1878 Printformat name in login language / throwing exception SEVERE: TableName not correctly parsed - TableNameIn=AD_PrintFormat - AccessSqlParser[|0]

This commit is contained in:
Carlos Ruiz 2014-12-17 16:41:58 -05:00
parent c0f90d236b
commit 7d5d604095
1 changed files with 10 additions and 9 deletions

View File

@ -1171,16 +1171,17 @@ public class MPrintFormat extends X_AD_PrintFormat
*/ */
public static List<KeyNamePair> getAccessiblePrintFormats (int AD_Table_ID, int AD_Window_ID, String trxName, boolean makeNewWhenEmpty) public static List<KeyNamePair> getAccessiblePrintFormats (int AD_Table_ID, int AD_Window_ID, String trxName, boolean makeNewWhenEmpty)
{ {
// append WHERE to can use MRole.getDefault().addAccessSQL String constantForRoleAccess = "SELECT * FROM AD_PrintFormat WHERE ";
String sqlWhere = " WHERE AD_Table_ID=? AND IsTableBased='Y' "; StringBuilder sqlWhereB = new StringBuilder(constantForRoleAccess)
.append("AD_Table_ID=? AND IsTableBased='Y' ");
if (AD_Window_ID > 0) if (AD_Window_ID > 0)
sqlWhere += "AND (AD_Window_ID=? OR AD_Window_ID IS NULL) "; sqlWhereB.append("AND (AD_Window_ID=? OR AD_Window_ID IS NULL)");
// //
sqlWhere = MRole.getDefault().addAccessSQL ( String sqlWhere = MRole.getDefault().addAccessSQL (
sqlWhere, "AD_PrintFormat", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); sqlWhereB.toString(), "AD_PrintFormat", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
// remove " WHERE " to use in Query // remove " WHERE " to use in Query
sqlWhere = sqlWhere.substring(6); sqlWhere = sqlWhere.substring(constantForRoleAccess.length());
// add sql parameter // add sql parameter
List<Object> lsParameter = new ArrayList<Object>(); List<Object> lsParameter = new ArrayList<Object>();