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:
parent
490cb806df
commit
042083872b
|
@ -83,12 +83,6 @@ public class ExportHelper {
|
||||||
/** XML Document */
|
/** XML Document */
|
||||||
private Document outDocument = null;
|
private Document outDocument = null;
|
||||||
|
|
||||||
/** Date Time Format */
|
|
||||||
private SimpleDateFormat m_dateTimeFormat = null;
|
|
||||||
|
|
||||||
/** Date Format */
|
|
||||||
private SimpleDateFormat m_dateFormat = null;
|
|
||||||
|
|
||||||
/** Custom Date Format */
|
/** Custom Date Format */
|
||||||
private SimpleDateFormat m_customDateFormat = null;
|
private SimpleDateFormat m_customDateFormat = null;
|
||||||
|
|
||||||
|
@ -103,14 +97,14 @@ public class ExportHelper {
|
||||||
m_AD_Client_ID = client.getAD_Client_ID();
|
m_AD_Client_ID = client.getAD_Client_ID();
|
||||||
m_rplStrategy = rplStrategy;
|
m_rplStrategy = rplStrategy;
|
||||||
|
|
||||||
m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Language.getLanguage(Env.getAD_Language(client.getCtx())));
|
DisplayType.getDateFormat(DisplayType.DateTime, Language.getLanguage(Env.getAD_Language(client.getCtx())));
|
||||||
m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Language.getLanguage(Env.getAD_Language(client.getCtx())));
|
DisplayType.getDateFormat(DisplayType.Date, Language.getLanguage(Env.getAD_Language(client.getCtx())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExportHelper(Properties ctx , int AD_Client_ID) {
|
public ExportHelper(Properties ctx , int AD_Client_ID) {
|
||||||
m_AD_Client_ID = AD_Client_ID;
|
m_AD_Client_ID = AD_Client_ID;
|
||||||
m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Language.getLanguage(Env.getAD_Language(ctx)));
|
DisplayType.getDateFormat(DisplayType.DateTime, Language.getLanguage(Env.getAD_Language(ctx)));
|
||||||
m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Language.getLanguage(Env.getAD_Language(ctx)));
|
DisplayType.getDateFormat(DisplayType.Date, Language.getLanguage(Env.getAD_Language(ctx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,8 +218,6 @@ public class ExportHelper {
|
||||||
throw new Exception(Msg.getMsg (po.getCtx(), "ExportNoneColumnKeyNotSupported"));//TODO: Create Mesagge.
|
throw new Exception(Msg.getMsg (po.getCtx(), "ExportNoneColumnKeyNotSupported"));//TODO: Create Mesagge.
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - get proper Export Format!
|
|
||||||
String version = "3.2.0";
|
|
||||||
outDocument = createNewDocument();
|
outDocument = createNewDocument();
|
||||||
|
|
||||||
|
|
||||||
|
@ -443,7 +435,7 @@ public class ExportHelper {
|
||||||
|
|
||||||
Collection<PO> instances = new Query(masterPO.getCtx(),tableEmbedded.getTableName(), whereClause.toString(),masterPO.get_TrxName())
|
Collection<PO> instances = new Query(masterPO.getCtx(),tableEmbedded.getTableName(), whereClause.toString(),masterPO.get_TrxName())
|
||||||
.setClient_ID()
|
.setClient_ID()
|
||||||
.setParameters(new Object[] { value })
|
.setParameters(value)
|
||||||
.list();
|
.list();
|
||||||
|
|
||||||
for (PO instance : instances)
|
for (PO instance : instances)
|
||||||
|
|
|
@ -526,7 +526,7 @@ public class ImportHelper {
|
||||||
{
|
{
|
||||||
final String whereClause = I_AD_Client.COLUMNNAME_Value + "= ? ";
|
final String whereClause = I_AD_Client.COLUMNNAME_Value + "= ? ";
|
||||||
MClient result = new Query(ctx,I_AD_Client.Table_Name,whereClause,trxName)
|
MClient result = new Query(ctx,I_AD_Client.Table_Name,whereClause,trxName)
|
||||||
.setParameters(new Object[]{value})
|
.setParameters(value)
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
|
|
||||||
s_log.info("Client_Value =[" + value + "]");
|
s_log.info("Client_Value =[" + value + "]");
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.sql.SQLException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.model.I_C_BPartner;
|
||||||
import org.compiere.model.MBPartner;
|
import org.compiere.model.MBPartner;
|
||||||
import org.compiere.model.MInvoice;
|
import org.compiere.model.MInvoice;
|
||||||
import org.compiere.model.MPayment;
|
import org.compiere.model.MPayment;
|
||||||
|
@ -84,9 +85,9 @@ public class BPartnerValidate extends SvrProcess
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String whereClause = "C_BP_Group_ID=?";
|
final String whereClause = "C_BP_Group_ID=?";
|
||||||
Iterator<MBPartner> it = new Query(getCtx(), MBPartner.Table_Name, whereClause, get_TrxName())
|
Iterator<MBPartner> it = new Query(getCtx(), I_C_BPartner.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{p_C_BP_Group_ID})
|
.setParameters(p_C_BP_Group_ID)
|
||||||
.setOnlyActiveRecords(true)
|
.setOnlyActiveRecords(true)
|
||||||
.iterate();
|
.iterate();
|
||||||
while(it.hasNext())
|
while(it.hasNext())
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
|
import org.compiere.model.I_T_DistributionRunDetail;
|
||||||
import org.compiere.model.MBPartner;
|
import org.compiere.model.MBPartner;
|
||||||
import org.compiere.model.MDistributionRun;
|
import org.compiere.model.MDistributionRun;
|
||||||
import org.compiere.model.MDistributionRunDetail;
|
import org.compiere.model.MDistributionRunDetail;
|
||||||
|
@ -723,9 +724,9 @@ public class DistributionRun extends SvrProcess
|
||||||
+" WHERE rl.M_DistributionRun_ID="+p_M_DistributionRun_ID+" AND l.RatioTotal<>0 AND rl.IsActive='Y' AND ll.IsActive='Y'";
|
+" WHERE rl.M_DistributionRun_ID="+p_M_DistributionRun_ID+" AND l.RatioTotal<>0 AND rl.IsActive='Y' AND ll.IsActive='Y'";
|
||||||
no = DB.executeUpdate(sql, get_TrxName());
|
no = DB.executeUpdate(sql, get_TrxName());
|
||||||
|
|
||||||
Query query = MTable.get(getCtx(), MDistributionRunDetail.Table_ID).
|
Query query = MTable.get(getCtx(), I_T_DistributionRunDetail.Table_ID).
|
||||||
createQuery(MDistributionRunDetail.COLUMNNAME_M_DistributionRun_ID + "=?", get_TrxName());
|
createQuery(MDistributionRunDetail.COLUMNNAME_M_DistributionRun_ID + "=?", get_TrxName());
|
||||||
query.setParameters(new Object[]{p_M_DistributionRun_ID});
|
query.setParameters(p_M_DistributionRun_ID);
|
||||||
|
|
||||||
List<MDistributionRunDetail> records = query.list();
|
List<MDistributionRunDetail> records = query.list();
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.eevolution.process;
|
package org.eevolution.process;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
|
import org.compiere.model.I_EXP_Format;
|
||||||
import org.compiere.model.MColumn;
|
import org.compiere.model.MColumn;
|
||||||
import org.compiere.model.MEXPFormat;
|
import org.compiere.model.MEXPFormat;
|
||||||
import org.compiere.model.MEXPFormatLine;
|
import org.compiere.model.MEXPFormatLine;
|
||||||
|
@ -147,7 +147,7 @@ public class ExportFormatGenerator extends SvrProcess
|
||||||
return format.getValue();
|
return format.getValue();
|
||||||
|
|
||||||
String where=" value = ? ";
|
String where=" value = ? ";
|
||||||
Query sql = new Query(getCtx(),MEXPFormat.Table_Name,where,get_TrxName()).setParameters(new Object[]{formatValue});
|
Query sql = new Query(getCtx(),I_EXP_Format.Table_Name,where,get_TrxName()).setParameters(formatValue);
|
||||||
if(sql.match())
|
if(sql.match())
|
||||||
{
|
{
|
||||||
format = (MEXPFormat) sql.first();
|
format = (MEXPFormat) sql.first();
|
||||||
|
|
Loading…
Reference in New Issue