Review FR: [ 2214883 ] Remove SQL code and Replace for Query >> to incorporate Heng Sin's advice. No unit testing done but compiler tested OK.

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Redhuan D. Oon 2010-02-28 04:39:28 +00:00
parent fdfe4fb8b1
commit 490cb806df
1 changed files with 8 additions and 8 deletions

View File

@ -107,8 +107,8 @@ public class ExpenseTypesFromAccounts extends SvrProcess {
MProduct product;
// Read all existing applicable products into memory for quick comparison.
List<MProduct> products = new Query(getCtx(), MProduct.Table_Name, "ProductType=?", get_TrxName())
.setParameters(new Object[]{MProduct.PRODUCTTYPE_ExpenseType})
List<MProduct> products = new Query(getCtx(), I_M_Product.Table_Name, "ProductType=?", get_TrxName())
.setParameters(MProduct.PRODUCTTYPE_ExpenseType)
.list();
Map<String,MProduct> productMap = new TreeMap<String, MProduct>();
@ -121,10 +121,10 @@ public class ExpenseTypesFromAccounts extends SvrProcess {
MAccount validComb;
List<MAccount> validCombs = new Query(
getCtx(),
MAccount.Table_Name,
I_C_ValidCombination.Table_Name,
"C_AcctSchema_ID=? and AD_Client_ID=? and AD_Org_ID=0",
get_TrxName())
.setParameters(new Object[]{m_acctSchemaId, m_clientId})
.setParameters(m_acctSchemaId, m_clientId)
.list();
Map<Integer, MAccount> validCombMap = new TreeMap<Integer, MAccount>();
@ -136,10 +136,10 @@ public class ExpenseTypesFromAccounts extends SvrProcess {
// Read all accounttypes that fit the given criteria.
List<MElementValue> result = new Query(
getCtx(),
MElementValue.Table_Name,
I_C_ElementValue.Table_Name,
"AccountType=? and isSummary='N' and Value>=? and Value<=? and AD_Client_ID=?",
get_TrxName())
.setParameters(new Object[]{MElementValue.ACCOUNTTYPE_Expense, m_startElement, m_endElement, m_clientId})
.setParameters(MElementValue.ACCOUNTTYPE_Expense, m_startElement, m_endElement, m_clientId)
.list();
MElementValue elem;
@ -195,8 +195,8 @@ public class ExpenseTypesFromAccounts extends SvrProcess {
// TODO: It might be needed to make the accounting more specific, but the purpose
// of the process now is to create general accounts so this is intentional.
productAcct = new Query(getCtx(), X_M_Product_Acct.Table_Name, "M_Product_ID=? and C_AcctSchema_ID=?", get_TrxName())
.setParameters(new Object[]{product.get_ID(), m_acctSchemaId})
productAcct = new Query(getCtx(), I_M_Product_Acct.Table_Name, "M_Product_ID=? and C_AcctSchema_ID=?", get_TrxName())
.setParameters(product.get_ID(), m_acctSchemaId)
.first();
productAcct.setP_Expense_Acct(validComb.get_ID());
productAcct.setP_Revenue_Acct(validComb.get_ID());