Review FR: [ 2214883 ] Remove SQL code and Replace for Query >> to incorporate Best Practice. 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:
parent
d2333e9026
commit
7fb5e6b54d
|
@ -100,7 +100,7 @@ public class MDunningRun extends X_C_DunningRun
|
||||||
"C_Dunning_ID=?",
|
"C_Dunning_ID=?",
|
||||||
get_TrxName())
|
get_TrxName())
|
||||||
.setOnlyActiveRecords(true)
|
.setOnlyActiveRecords(true)
|
||||||
.setParameters(new Object[]{getC_Dunning_ID()})
|
.setParameters(getC_Dunning_ID())
|
||||||
.setOrderBy("DaysAfterDue DESC, C_DunningLevel_ID")
|
.setOrderBy("DaysAfterDue DESC, C_DunningLevel_ID")
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,8 +223,8 @@ public class MElementValue extends X_C_ElementValue
|
||||||
//
|
//
|
||||||
// Check Valid Combinations - teo_sarca FR [ 1883533 ]
|
// Check Valid Combinations - teo_sarca FR [ 1883533 ]
|
||||||
String whereClause = MAccount.COLUMNNAME_Account_ID+"=?";
|
String whereClause = MAccount.COLUMNNAME_Account_ID+"=?";
|
||||||
POResultSet<MAccount> rs = new Query(getCtx(), MAccount.Table_Name, whereClause, get_TrxName())
|
POResultSet<MAccount> rs = new Query(getCtx(), I_C_ValidCombination.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.scroll();
|
.scroll();
|
||||||
try {
|
try {
|
||||||
while(rs.hasNext()) {
|
while(rs.hasNext()) {
|
||||||
|
|
|
@ -66,8 +66,8 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
return new MMatchInv[]{};
|
return new MMatchInv[]{};
|
||||||
//
|
//
|
||||||
final String whereClause = "M_InOutLine_ID=? AND C_InvoiceLine_ID=?";
|
final String whereClause = "M_InOutLine_ID=? AND C_InvoiceLine_ID=?";
|
||||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{M_InOutLine_ID, C_InvoiceLine_ID})
|
.setParameters(M_InOutLine_ID, C_InvoiceLine_ID)
|
||||||
.list();
|
.list();
|
||||||
return list.toArray (new MMatchInv[list.size()]);
|
return list.toArray (new MMatchInv[list.size()]);
|
||||||
} // get
|
} // get
|
||||||
|
@ -86,8 +86,8 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
return new MMatchInv[]{};
|
return new MMatchInv[]{};
|
||||||
//
|
//
|
||||||
String whereClause = "C_InvoiceLine_ID=?";
|
String whereClause = "C_InvoiceLine_ID=?";
|
||||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{C_InvoiceLine_ID})
|
.setParameters(C_InvoiceLine_ID)
|
||||||
.list();
|
.list();
|
||||||
return list.toArray (new MMatchInv[list.size()]);
|
return list.toArray (new MMatchInv[list.size()]);
|
||||||
} // getInvoiceLine
|
} // getInvoiceLine
|
||||||
|
@ -107,8 +107,8 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
//
|
//
|
||||||
final String whereClause = "EXISTS (SELECT 1 FROM M_InOutLine l"
|
final String whereClause = "EXISTS (SELECT 1 FROM M_InOutLine l"
|
||||||
+" WHERE M_MatchInv.M_InOutLine_ID=l.M_InOutLine_ID AND l.M_InOut_ID=?)";
|
+" WHERE M_MatchInv.M_InOutLine_ID=l.M_InOutLine_ID AND l.M_InOut_ID=?)";
|
||||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{M_InOut_ID})
|
.setParameters(M_InOut_ID)
|
||||||
.list();
|
.list();
|
||||||
return list.toArray (new MMatchInv[list.size()]);
|
return list.toArray (new MMatchInv[list.size()]);
|
||||||
} // getInOut
|
} // getInOut
|
||||||
|
@ -128,8 +128,8 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
//
|
//
|
||||||
final String whereClause = " EXISTS (SELECT 1 FROM C_InvoiceLine il"
|
final String whereClause = " EXISTS (SELECT 1 FROM C_InvoiceLine il"
|
||||||
+" WHERE M_MatchInv.C_InvoiceLine_ID=il.C_InvoiceLine_ID AND il.C_Invoice_ID=?)";
|
+" WHERE M_MatchInv.C_InvoiceLine_ID=il.C_InvoiceLine_ID AND il.C_Invoice_ID=?)";
|
||||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{C_Invoice_ID})
|
.setParameters(C_Invoice_ID)
|
||||||
.list();
|
.list();
|
||||||
return list.toArray (new MMatchInv[list.size()]);
|
return list.toArray (new MMatchInv[list.size()]);
|
||||||
} // getInvoice
|
} // getInvoice
|
||||||
|
@ -470,8 +470,8 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
final String whereClause = MMatchInv.COLUMNNAME_M_InOutLine_ID+"=?";
|
final String whereClause = MMatchInv.COLUMNNAME_M_InOutLine_ID+"=?";
|
||||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{M_InOutLine_ID})
|
.setParameters(M_InOutLine_ID)
|
||||||
.list();
|
.list();
|
||||||
return list.toArray (new MMatchInv[list.size()]);
|
return list.toArray (new MMatchInv[list.size()]);
|
||||||
} // getInOutLine
|
} // getInOutLine
|
||||||
|
|
|
@ -102,8 +102,8 @@ public class MMovement extends X_M_Movement implements DocAction
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
final String whereClause = "M_Movement_ID=?";
|
final String whereClause = "M_Movement_ID=?";
|
||||||
List<MMovement> list = new Query(getCtx(), MMovementLine.Table_Name, whereClause, get_TrxName())
|
List<MMovement> list = new Query(getCtx(), I_M_MovementLine.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{getM_Movement_ID()})
|
.setParameters(getM_Movement_ID())
|
||||||
.setOrderBy(MMovementLine.COLUMNNAME_Line)
|
.setOrderBy(MMovementLine.COLUMNNAME_Line)
|
||||||
.list();
|
.list();
|
||||||
m_lines = new MMovementLine[list.size ()];
|
m_lines = new MMovementLine[list.size ()];
|
||||||
|
@ -121,8 +121,8 @@ public class MMovement extends X_M_Movement implements DocAction
|
||||||
if (m_confirms != null && !requery)
|
if (m_confirms != null && !requery)
|
||||||
return m_confirms;
|
return m_confirms;
|
||||||
|
|
||||||
List<MMovementConfirm> list = new Query(getCtx(), MMovementConfirm.Table_Name, "M_Movement_ID=?", get_TrxName())
|
List<MMovementConfirm> list = new Query(getCtx(), I_M_MovementConfirm.Table_Name, "M_Movement_ID=?", get_TrxName())
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.list();
|
.list();
|
||||||
m_confirms = list.toArray(new MMovementConfirm[list.size()]);
|
m_confirms = list.toArray(new MMovementConfirm[list.size()]);
|
||||||
return m_confirms;
|
return m_confirms;
|
||||||
|
|
|
@ -335,7 +335,7 @@ public class MMovementLine extends X_M_MovementLine
|
||||||
whereClause += " AND (" + where + ")";
|
whereClause += " AND (" + where + ")";
|
||||||
//
|
//
|
||||||
List<MMovementLine> list = new Query(ctx, Table_Name, whereClause, trxName)
|
List<MMovementLine> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{DD_OrderLine_ID})
|
.setParameters(DD_OrderLine_ID)
|
||||||
.list();
|
.list();
|
||||||
return list.toArray(new MMovementLine[list.size()]);
|
return list.toArray(new MMovementLine[list.size()]);
|
||||||
} // getOfOrderLine
|
} // getOfOrderLine
|
||||||
|
|
|
@ -645,8 +645,8 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
if (orderClause.length() == 0)
|
if (orderClause.length() == 0)
|
||||||
orderClause = MOrderLine.COLUMNNAME_Line;
|
orderClause = MOrderLine.COLUMNNAME_Line;
|
||||||
//
|
//
|
||||||
List<MOrderLine> list = new Query(getCtx(), MOrderLine.Table_Name, whereClauseFinal.toString(), get_TrxName())
|
List<MOrderLine> list = new Query(getCtx(), I_C_OrderLine.Table_Name, whereClauseFinal.toString(), get_TrxName())
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.setOrderBy(orderClause)
|
.setOrderBy(orderClause)
|
||||||
.list();
|
.list();
|
||||||
for (MOrderLine ol : list) {
|
for (MOrderLine ol : list) {
|
||||||
|
@ -731,8 +731,8 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
if (m_taxes != null && !requery)
|
if (m_taxes != null && !requery)
|
||||||
return m_taxes;
|
return m_taxes;
|
||||||
//
|
//
|
||||||
List<MOrderTax> list = new Query(getCtx(), MOrderTax.Table_Name, "C_Order_ID=?", get_TrxName())
|
List<MOrderTax> list = new Query(getCtx(), I_C_OrderTax.Table_Name, "C_Order_ID=?", get_TrxName())
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.list();
|
.list();
|
||||||
m_taxes = list.toArray(new MOrderTax[list.size()]);
|
m_taxes = list.toArray(new MOrderTax[list.size()]);
|
||||||
return m_taxes;
|
return m_taxes;
|
||||||
|
@ -749,8 +749,8 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
+" WHERE il.C_Invoice_ID=C_Invoice.C_Invoice_ID"
|
+" WHERE il.C_Invoice_ID=C_Invoice.C_Invoice_ID"
|
||||||
+" AND il.C_OrderLine_ID=ol.C_OrderLine_ID"
|
+" AND il.C_OrderLine_ID=ol.C_OrderLine_ID"
|
||||||
+" AND ol.C_Order_ID=?)";
|
+" AND ol.C_Order_ID=?)";
|
||||||
List<MInvoice> list = new Query(getCtx(), MInvoice.Table_Name, whereClause, get_TrxName())
|
List<MInvoice> list = new Query(getCtx(), I_C_Invoice.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.setOrderBy("C_Invoice_ID DESC")
|
.setOrderBy("C_Invoice_ID DESC")
|
||||||
.list();
|
.list();
|
||||||
return list.toArray(new MInvoice[list.size()]);
|
return list.toArray(new MInvoice[list.size()]);
|
||||||
|
@ -780,8 +780,8 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
+" WHERE iol.M_InOut_ID=M_InOut.M_InOut_ID"
|
+" WHERE iol.M_InOut_ID=M_InOut.M_InOut_ID"
|
||||||
+" AND iol.C_OrderLine_ID=ol.C_OrderLine_ID"
|
+" AND iol.C_OrderLine_ID=ol.C_OrderLine_ID"
|
||||||
+" AND ol.C_Order_ID=?)";
|
+" AND ol.C_Order_ID=?)";
|
||||||
List<MInvoice> list = new Query(getCtx(), MInOut.Table_Name, whereClause, get_TrxName())
|
List<MInvoice> list = new Query(getCtx(), I_M_InOut.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.setOrderBy("M_InOut_ID DESC")
|
.setOrderBy("M_InOut_ID DESC")
|
||||||
.list();
|
.list();
|
||||||
return list.toArray(new MInOut[list.size()]);
|
return list.toArray(new MInOut[list.size()]);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class MOrg extends X_AD_Org
|
||||||
List<MOrg> list = new Query(po.getCtx(), Table_Name, "AD_Client_ID=?", null)
|
List<MOrg> list = new Query(po.getCtx(), Table_Name, "AD_Client_ID=?", null)
|
||||||
.setOrderBy(COLUMNNAME_Value)
|
.setOrderBy(COLUMNNAME_Value)
|
||||||
.setOnlyActiveRecords(true)
|
.setOnlyActiveRecords(true)
|
||||||
.setParameters(new Object[]{po.getAD_Client_ID()})
|
.setParameters(po.getAD_Client_ID())
|
||||||
.list();
|
.list();
|
||||||
for (MOrg org : list)
|
for (MOrg org : list)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class MOrgInfo extends X_AD_OrgInfo
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
retValue = new Query(ctx, Table_Name, "AD_Org_ID=?", null)
|
retValue = new Query(ctx, Table_Name, "AD_Org_ID=?", null)
|
||||||
.setParameters(new Object[]{AD_Org_ID})
|
.setParameters(AD_Org_ID)
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
if (retValue != null)
|
if (retValue != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class MPOS extends X_C_POS
|
||||||
{
|
{
|
||||||
String whereClause = field+"=?";
|
String whereClause = field+"=?";
|
||||||
List<MPOS> list = new Query(ctx, Table_Name, whereClause, null)
|
List<MPOS> list = new Query(ctx, Table_Name, whereClause, null)
|
||||||
.setParameters(new Object[]{ID})
|
.setParameters(ID)
|
||||||
.setOnlyActiveRecords(true)
|
.setOnlyActiveRecords(true)
|
||||||
.setOrderBy(COLUMNNAME_Name)
|
.setOrderBy(COLUMNNAME_Name)
|
||||||
.list();
|
.list();
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class MPaymentAllocate extends X_C_PaymentAllocate
|
||||||
{
|
{
|
||||||
final String whereClause = "C_Payment_ID=? AND IsActive=?";
|
final String whereClause = "C_Payment_ID=? AND IsActive=?";
|
||||||
Query query = MTable.get(parent.getCtx(), Table_ID).createQuery(whereClause, parent.get_TrxName());
|
Query query = MTable.get(parent.getCtx(), Table_ID).createQuery(whereClause, parent.get_TrxName());
|
||||||
query.setParameters(new Object[]{parent.getC_Payment_ID(), "Y"});
|
query.setParameters(parent.getC_Payment_ID(), "Y");
|
||||||
List<MPaymentAllocate> list = query.list();
|
List<MPaymentAllocate> list = query.list();
|
||||||
return list.toArray(new MPaymentAllocate[list.size()]);
|
return list.toArray(new MPaymentAllocate[list.size()]);
|
||||||
} // get
|
} // get
|
||||||
|
|
|
@ -589,9 +589,9 @@ public class MPeriod extends X_C_Period
|
||||||
" AND (? BETWEEN StartDate AND EndDate" +
|
" AND (? BETWEEN StartDate AND EndDate" +
|
||||||
" OR ? BETWEEN StartDate AND EndDate)" +
|
" OR ? BETWEEN StartDate AND EndDate)" +
|
||||||
" AND PeriodType=?",get_TrxName());
|
" AND PeriodType=?",get_TrxName());
|
||||||
query.setParameters(new Object[] {year.getC_Calendar_ID(),
|
query.setParameters(year.getC_Calendar_ID(),
|
||||||
getStartDate(), getEndDate(),
|
getStartDate(), getEndDate(),
|
||||||
getPeriodType()});
|
getPeriodType());
|
||||||
|
|
||||||
List<MPeriod> periods = query.list();
|
List<MPeriod> periods = query.list();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -87,7 +86,7 @@ public class MPriceList extends X_M_PriceList
|
||||||
// Get from DB
|
// Get from DB
|
||||||
final String whereClause = "AD_Client_ID=? AND IsDefault=? AND IsSOPriceList=?";
|
final String whereClause = "AD_Client_ID=? AND IsDefault=? AND IsSOPriceList=?";
|
||||||
retValue = new Query(ctx, Table_Name, whereClause, null)
|
retValue = new Query(ctx, Table_Name, whereClause, null)
|
||||||
.setParameters(new Object[]{AD_Client_ID, "Y", IsSOPriceList ? "Y" : "N"})
|
.setParameters(AD_Client_ID, "Y", IsSOPriceList ? "Y" : "N")
|
||||||
.setOrderBy("M_PriceList_ID")
|
.setOrderBy("M_PriceList_ID")
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
|
@ -134,7 +133,7 @@ public class MPriceList extends X_M_PriceList
|
||||||
// Get from DB
|
// Get from DB
|
||||||
final String whereClause = "AD_Client_ID=? AND IsDefault=? AND IsSOPriceList=? AND C_Currency_ID=?";
|
final String whereClause = "AD_Client_ID=? AND IsDefault=? AND IsSOPriceList=? AND C_Currency_ID=?";
|
||||||
retValue = new Query(ctx, Table_Name, whereClause, null)
|
retValue = new Query(ctx, Table_Name, whereClause, null)
|
||||||
.setParameters(new Object[]{AD_Client_ID, "Y", IsSOPriceList ? "Y" : "N", Integer.valueOf(M_Currency_ID)})
|
.setParameters(AD_Client_ID, "Y", IsSOPriceList ? "Y" : "N", Integer.valueOf(M_Currency_ID))
|
||||||
.setOrderBy("M_PriceList_ID")
|
.setOrderBy("M_PriceList_ID")
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
|
@ -244,8 +243,8 @@ public class MPriceList extends X_M_PriceList
|
||||||
return m_plv;
|
return m_plv;
|
||||||
|
|
||||||
final String whereClause = "M_PriceList_ID=? AND TRUNC(ValidFrom)<=? AND IsActive=?";
|
final String whereClause = "M_PriceList_ID=? AND TRUNC(ValidFrom)<=? AND IsActive=?";
|
||||||
m_plv = new Query(getCtx(), MPriceListVersion.Table_Name, whereClause, get_TrxName())
|
m_plv = new Query(getCtx(), I_M_PriceList_Version.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{getM_PriceList_ID(), valid, "Y"})
|
.setParameters(getM_PriceList_ID(), valid, "Y")
|
||||||
.setOrderBy("ValidFrom DESC")
|
.setOrderBy("ValidFrom DESC")
|
||||||
.first();
|
.first();
|
||||||
if (m_plv == null)
|
if (m_plv == null)
|
||||||
|
|
|
@ -71,10 +71,10 @@ public class MProcess extends X_AD_Process
|
||||||
*/
|
*/
|
||||||
public static MProcess getFromMenu (Properties ctx, int AD_Menu_ID)
|
public static MProcess getFromMenu (Properties ctx, int AD_Menu_ID)
|
||||||
{
|
{
|
||||||
String whereClause = "EXISTS (SELECT 1 FROM AD_Menu m"
|
final String whereClause = "EXISTS (SELECT 1 FROM AD_Menu m"
|
||||||
+" WHERE m.AD_Process_ID=AD_Process.AD_Process_ID AND m.AD_Menu_ID=?)";
|
+" WHERE m.AD_Process_ID=AD_Process.AD_Process_ID AND m.AD_Menu_ID=?)";
|
||||||
MProcess p = new Query(ctx, MProcess.Table_Name, whereClause, null)
|
MProcess p = new Query(ctx, I_AD_Process.Table_Name, whereClause, null)
|
||||||
.setParameters(new Object[]{AD_Menu_ID})
|
.setParameters(AD_Menu_ID)
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
if (p != null)
|
if (p != null)
|
||||||
{
|
{
|
||||||
|
@ -133,9 +133,9 @@ public class MProcess extends X_AD_Process
|
||||||
if (m_parameters != null)
|
if (m_parameters != null)
|
||||||
return m_parameters;
|
return m_parameters;
|
||||||
//
|
//
|
||||||
String whereClause = MProcessPara.COLUMNNAME_AD_Process_ID+"=?";
|
final String whereClause = MProcessPara.COLUMNNAME_AD_Process_ID+"=?";
|
||||||
List<MProcessPara> list = new Query(getCtx(), MProcessPara.Table_Name, whereClause, get_TrxName())
|
List<MProcessPara> list = new Query(getCtx(), I_AD_Process_Para.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.setOrderBy(MProcessPara.COLUMNNAME_SeqNo)
|
.setOrderBy(MProcessPara.COLUMNNAME_SeqNo)
|
||||||
.list();
|
.list();
|
||||||
//
|
//
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class MProduct extends X_M_Product
|
||||||
{
|
{
|
||||||
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
||||||
List<MProduct> list = new Query(ctx, Table_Name, "AD_Client_ID=? AND "+whereClause, trxName)
|
List<MProduct> list = new Query(ctx, Table_Name, "AD_Client_ID=? AND "+whereClause, trxName)
|
||||||
.setParameters(new Object[]{AD_Client_ID})
|
.setParameters(AD_Client_ID)
|
||||||
.list();
|
.list();
|
||||||
return list.toArray(new MProduct[list.size()]);
|
return list.toArray(new MProduct[list.size()]);
|
||||||
} // get
|
} // get
|
||||||
|
@ -102,9 +102,9 @@ public class MProduct extends X_M_Product
|
||||||
*/
|
*/
|
||||||
public static List<MProduct> getByUPC(Properties ctx, String upc, String trxName)
|
public static List<MProduct> getByUPC(Properties ctx, String upc, String trxName)
|
||||||
{
|
{
|
||||||
String whereClause = "AD_Client_ID=? AND UPC=?";
|
final String whereClause = "AD_Client_ID=? AND UPC=?";
|
||||||
Query q = new Query(ctx, Table_Name, whereClause, trxName);
|
Query q = new Query(ctx, Table_Name, whereClause, trxName);
|
||||||
q.setParameters(new Object[]{Env.getAD_Client_ID(ctx), upc});
|
q.setParameters(Env.getAD_Client_ID(ctx), upc);
|
||||||
return(q.list());
|
return(q.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,10 +533,10 @@ public class MProduct extends X_M_Product
|
||||||
if (m_downloads != null && !requery)
|
if (m_downloads != null && !requery)
|
||||||
return m_downloads;
|
return m_downloads;
|
||||||
//
|
//
|
||||||
List<MProductDownload> list = new Query(getCtx(), MProductDownload.Table_Name, "M_Product_ID=?", get_TrxName())
|
List<MProductDownload> list = new Query(getCtx(), I_M_ProductDownload.Table_Name, "M_Product_ID=?", get_TrxName())
|
||||||
.setOnlyActiveRecords(true)
|
.setOnlyActiveRecords(true)
|
||||||
.setOrderBy(MProductDownload.COLUMNNAME_Name)
|
.setOrderBy(I_M_ProductDownload.COLUMNNAME_Name)
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.list();
|
.list();
|
||||||
m_downloads = list.toArray(new MProductDownload[list.size()]);
|
m_downloads = list.toArray(new MProductDownload[list.size()]);
|
||||||
return m_downloads;
|
return m_downloads;
|
||||||
|
@ -646,10 +646,10 @@ public class MProduct extends X_M_Product
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if it has cost
|
//check if it has cost
|
||||||
boolean hasCosts = new Query(getCtx(), MCostDetail.Table_Name,
|
boolean hasCosts = new Query(getCtx(), I_M_CostDetail.Table_Name,
|
||||||
MCostDetail.COLUMNNAME_M_Product_ID+"=?", get_TrxName())
|
I_M_CostDetail.COLUMNNAME_M_Product_ID+"=?", get_TrxName())
|
||||||
.setOnlyActiveRecords(true)
|
.setOnlyActiveRecords(true)
|
||||||
.setParameters(new Object[]{get_ID()})
|
.setParameters(get_ID())
|
||||||
.match();
|
.match();
|
||||||
if (hasCosts)
|
if (hasCosts)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class MProductCategoryAcct extends X_M_Product_Category_Acct
|
||||||
|
|
||||||
final String whereClause = "M_Product_Category_ID=? AND C_AcctSchema_ID=?";
|
final String whereClause = "M_Product_Category_ID=? AND C_AcctSchema_ID=?";
|
||||||
acct = new Query(ctx, Table_Name, whereClause, trxName)
|
acct = new Query(ctx, Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{M_Product_Category_ID, C_AcctSchema_ID})
|
.setParameters(M_Product_Category_ID, C_AcctSchema_ID)
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
if (acct != null)
|
if (acct != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,10 +46,10 @@ public class MProductCosting extends X_M_Product_Costing
|
||||||
*/
|
*/
|
||||||
public static MProductCosting[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
|
public static MProductCosting[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
|
||||||
{
|
{
|
||||||
String whereClause = "M_Product_ID=?";
|
final String whereClause = "M_Product_ID=?";
|
||||||
|
|
||||||
List<MProductCosting> costs =new Query(ctx, MProductCosting.Table_Name,whereClause, trxName )
|
List<MProductCosting> costs =new Query(ctx, I_M_Product_Costing.Table_Name,whereClause, trxName )
|
||||||
.setParameters(new Object[]{M_Product_ID})
|
.setParameters(M_Product_ID)
|
||||||
.list();
|
.list();
|
||||||
return costs.toArray(new MProductCosting[costs.size()]);
|
return costs.toArray(new MProductCosting[costs.size()]);
|
||||||
} // getOfProduct
|
} // getOfProduct
|
||||||
|
@ -65,10 +65,10 @@ public class MProductCosting extends X_M_Product_Costing
|
||||||
public static MProductCosting get (Properties ctx, int M_Product_ID,
|
public static MProductCosting get (Properties ctx, int M_Product_ID,
|
||||||
int C_AcctSchema_ID, String trxName)
|
int C_AcctSchema_ID, String trxName)
|
||||||
{
|
{
|
||||||
String whereClause = "M_Product_ID=? AND C_AcctSchema_ID=?";
|
final String whereClause = "M_Product_ID=? AND C_AcctSchema_ID=?";
|
||||||
|
|
||||||
return new Query(ctx, MProductCosting.Table_Name,whereClause, trxName )
|
return new Query(ctx, I_M_Product_Costing.Table_Name,whereClause, trxName )
|
||||||
.setParameters(new Object[]{M_Product_ID, C_AcctSchema_ID})
|
.setParameters(M_Product_ID, C_AcctSchema_ID)
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class MProductPO extends X_M_Product_PO
|
||||||
{
|
{
|
||||||
final String whereClause = "M_Product_ID=? AND IsActive=?";
|
final String whereClause = "M_Product_ID=? AND IsActive=?";
|
||||||
List<MProductPO> list = new Query(ctx, Table_Name, whereClause, trxName)
|
List<MProductPO> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{M_Product_ID, "Y"})
|
.setParameters(M_Product_ID, "Y")
|
||||||
.setOrderBy("IsCurrentVendor DESC")
|
.setOrderBy("IsCurrentVendor DESC")
|
||||||
.list();
|
.list();
|
||||||
return list.toArray(new MProductPO[list.size()]);
|
return list.toArray(new MProductPO[list.size()]);
|
||||||
|
|
Loading…
Reference in New Issue