Merged trunk 11345 to 11658 into branches/osgi/approach2
This commit is contained in:
parent
c33f850d6d
commit
0798948086
|
@ -137,5 +137,7 @@
|
|||
<classpathentry exported="true" kind="lib" path="packages/liberoMFG.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="tools/lib/iText-2.1.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="tools/lib/miglayout-3.7.1-swing.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="tools/lib/payflow.jar"/>
|
||||
<classpathentry kind="lib" path="tools/lib/cron4j-2.2.1.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.sql.Timestamp;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.PropertyResourceBundle;
|
||||
|
@ -60,6 +61,7 @@ import org.compiere.db.CConnection;
|
|||
import org.compiere.interfaces.MD5;
|
||||
import org.compiere.model.MAttachment;
|
||||
import org.compiere.model.MAttachmentEntry;
|
||||
import org.compiere.model.MBPartner;
|
||||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.X_AD_PInstance_Para;
|
||||
import org.compiere.process.ClientProcess;
|
||||
|
@ -368,6 +370,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
|||
String Name=pi.getTitle();
|
||||
int AD_PInstance_ID=pi.getAD_PInstance_ID();
|
||||
int Record_ID=pi.getRecord_ID();
|
||||
|
||||
log.info( "Name="+Name+" AD_PInstance_ID="+AD_PInstance_ID+" Record_ID="+Record_ID);
|
||||
String trxName = null;
|
||||
if (trx != null) {
|
||||
|
@ -424,6 +427,15 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
|||
String name = jasperReport.getName();
|
||||
File reportDir = data.getReportDir();
|
||||
|
||||
// Add reportDir to class path
|
||||
ClassLoader scl = ClassLoader.getSystemClassLoader();
|
||||
try {
|
||||
java.net.URLClassLoader ucl = new java.net.URLClassLoader(new java.net.URL[]{reportDir.toURI().toURL()}, scl);
|
||||
net.sf.jasperreports.engine.util.JRResourcesUtil.setThreadClassLoader(ucl);
|
||||
} catch (MalformedURLException me) {
|
||||
log.warning("Could not add report directory to classpath: "+ me.getMessage());
|
||||
}
|
||||
|
||||
if (jasperReport != null) {
|
||||
File[] subreports;
|
||||
|
||||
|
@ -462,9 +474,20 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
|||
// in iReports you can 'SELECT' AD_Client_ID, AD_Org_ID and AD_User_ID using only AD_PINSTANCE_ID
|
||||
params.put("AD_PINSTANCE_ID", new Integer( AD_PInstance_ID));
|
||||
|
||||
Language currLang = Env.getLanguage(Env.getCtx());
|
||||
params.put("CURRENT_LANG", currLang.getAD_Language());
|
||||
params.put(JRParameter.REPORT_LOCALE, currLang.getLocale());
|
||||
Language currLang = Env.getLanguage(Env.getCtx());
|
||||
ProcessInfoParameter[] pip = pi.getParameter();
|
||||
// Check for language parameter
|
||||
if (pip!=null) {
|
||||
for (int i=0; i<pip.length; i++) {
|
||||
if ("CURRENT_LANG".equalsIgnoreCase(pip[i].getParameterName())) {
|
||||
currLang = (Language)pip[i].getParameter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
params.put("CURRENT_LANG", currLang.getAD_Language());
|
||||
params.put(JRParameter.REPORT_LOCALE, currLang.getLocale());
|
||||
|
||||
// Resources
|
||||
File resFile = null;
|
||||
if (reportPath.startsWith("attachment:") && attachment != null) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<classpathentry kind="lib" path="/tools/lib/looks-2.0.4.jar"/>
|
||||
<classpathentry kind="lib" path="/tools/lib/commons-collections-3.1.jar"/>
|
||||
<classpathentry kind="lib" path="/tools/lib/activemq-core-5.0.0.jar"/>
|
||||
<classpathentry kind="lib" path="/tools/lib/cron4j-2.2.1.jar"/>
|
||||
<classpathentry kind="src" path="/JasperReportsTools"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="build"/>
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<pathelement path="../tools/lib/j2ee.jar"/>
|
||||
<pathelement path="../tools/lib/jnlp.jar"/>
|
||||
<pathelement path="../tools/lib/servlet-api.jar" />
|
||||
<pathelement path="../tools/lib/cron4j-2.2.1.jar" />
|
||||
</path>
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* - Trifon Trifonov (trifonnt@users.sourceforge.net) *
|
||||
* *
|
||||
* Sponsors: *
|
||||
* - E-evolution (http://www.e-evolution.com) *
|
||||
* - e-Evolution (http://www.e-evolution.com) *
|
||||
***********************************************************************/
|
||||
|
||||
package org.adempiere.model;
|
||||
|
@ -39,6 +39,7 @@ import org.compiere.model.PO;
|
|||
import org.compiere.model.X_AD_ReplicationDocument;
|
||||
import org.compiere.model.X_AD_ReplicationTable;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -50,11 +51,15 @@ import org.compiere.util.CLogger;
|
|||
* <li> https://sourceforge.net/tracker/?func=detail&aid=2875989&group_id=176962&atid=879332
|
||||
* <li>[ 2195090 ] Stabilization of replication
|
||||
* <li>https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2936561&group_id=176962
|
||||
* <li> BF2947615 The document recplicacion not working
|
||||
* <li> https://sourceforge.net/tracker/?func=detail&aid=2947615&group_id=176962&atid=879332
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ExportModelValidator implements ModelValidator
|
||||
{
|
||||
/** Context variable which says if replication is enabled */
|
||||
public static final String CTX_IsReplicationEnabled = "#IsReplicationEnabled";
|
||||
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(ExportModelValidator.class);
|
||||
|
@ -129,8 +134,8 @@ public class ExportModelValidator implements ModelValidator
|
|||
if (X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(rplTable.getReplicationType())
|
||||
|| X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(rplTable.getReplicationType()))
|
||||
{
|
||||
MTable table = MTable.get (client.getCtx(), rplTable.getAD_Table_ID());
|
||||
engine.addModelChange(table.getTableName(), this);
|
||||
String tableName = MTable.getTableName(client.getCtx(), rplTable.getAD_Table_ID());
|
||||
engine.addModelChange(tableName, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,9 +146,8 @@ public class ExportModelValidator implements ModelValidator
|
|||
if (X_AD_ReplicationDocument.REPLICATIONTYPE_Merge.equals(rplDocument.getReplicationType())
|
||||
|| X_AD_ReplicationDocument.REPLICATIONTYPE_Reference.equals(rplDocument.getReplicationType()))
|
||||
{
|
||||
//MDocType docType = MDocType.get(client.getCtx(), rplDocuments[i].getC_DocType_ID());
|
||||
MTable table = MTable.get (client.getCtx(), rplDocument.getAD_Table_ID());
|
||||
engine.addDocValidate(table.getTableName(), this);
|
||||
String tableName = MTable.getTableName(client.getCtx(), rplDocument.getAD_Table_ID());
|
||||
engine.addDocValidate(tableName, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,10 +171,16 @@ public class ExportModelValidator implements ModelValidator
|
|||
|| type == TYPE_AFTER_NEW
|
||||
|| type == TYPE_BEFORE_DELETE) // After Change or After New
|
||||
{
|
||||
expHelper.exportRecord( po,
|
||||
MReplicationStrategy.REPLICATION_TABLE,
|
||||
MReplicationStrategy.getReplicationTable(po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID()).getReplicationType(),
|
||||
type);
|
||||
X_AD_ReplicationTable replicationTable = MReplicationStrategy.getReplicationTable(
|
||||
po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID());
|
||||
if (replicationTable != null)
|
||||
{
|
||||
expHelper.exportRecord(
|
||||
po,
|
||||
MReplicationStrategy.REPLICATION_TABLE,
|
||||
replicationTable.getReplicationType(),
|
||||
type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +198,7 @@ public class ExportModelValidator implements ModelValidator
|
|||
*/
|
||||
public String docValidate (PO po, int type)
|
||||
{
|
||||
log.info("po.get_TableName() = " + po.get_TableName());
|
||||
log.info("Replicate the Document = " + po.get_TableName() + " with Type = " + type);
|
||||
String result = null;
|
||||
if (expHelper != null) {
|
||||
try {
|
||||
|
@ -196,13 +206,30 @@ public class ExportModelValidator implements ModelValidator
|
|||
|| type == TIMING_AFTER_CLOSE
|
||||
|| type == TIMING_AFTER_REVERSECORRECT
|
||||
|| type == TIMING_AFTER_VOID
|
||||
|| type == TIMING_AFTER_PREPARE
|
||||
//|| type == TIMING_AFTER_PREPARE
|
||||
)
|
||||
{
|
||||
expHelper.exportRecord( po,
|
||||
MReplicationStrategy.REPLICATION_DOCUMENT ,
|
||||
MReplicationStrategy.getReplicationDocument(po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID()).getReplicationType(),
|
||||
type);
|
||||
X_AD_ReplicationDocument replicationDocument = null;
|
||||
int C_DocType_ID = po.get_ValueAsInt("C_DocType_ID");
|
||||
if (C_DocType_ID > 0)
|
||||
{
|
||||
replicationDocument = MReplicationStrategy.getReplicationDocument(
|
||||
po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID(), C_DocType_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
replicationDocument = MReplicationStrategy.getReplicationDocument(
|
||||
po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID());
|
||||
}
|
||||
|
||||
|
||||
if (replicationDocument != null) {
|
||||
expHelper.exportRecord(
|
||||
po,
|
||||
MReplicationStrategy.REPLICATION_DOCUMENT,
|
||||
replicationDocument.getReplicationType(),
|
||||
type);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -223,6 +250,7 @@ public class ExportModelValidator implements ModelValidator
|
|||
*/
|
||||
public String login (int AD_Org_ID, int AD_Role_ID, int AD_User_ID)
|
||||
{
|
||||
Env.setContext(Env.getCtx(), CTX_IsReplicationEnabled, true);
|
||||
m_AD_Org_ID = AD_Org_ID;
|
||||
m_AD_Role_ID = AD_Role_ID;
|
||||
m_AD_User_ID = AD_User_ID;
|
||||
|
|
|
@ -102,13 +102,15 @@ public class GridTabWrapper implements InvocationHandler
|
|||
GridField field = m_gridTab.getField(propertyName);
|
||||
if (field != null)
|
||||
{
|
||||
return field.getValue();
|
||||
final Object value = field.getValue();
|
||||
return value instanceof Boolean ? value : "Y".equals(value);
|
||||
}
|
||||
//
|
||||
field = m_gridTab.getField("Is"+propertyName);
|
||||
if (field != null)
|
||||
{
|
||||
return field.getValue();
|
||||
final Object value = field.getValue();
|
||||
return value instanceof Boolean ? value : "Y".equals(value);
|
||||
}
|
||||
//
|
||||
throw new IllegalArgumentException("Method not supported - "+methodName);
|
||||
|
|
|
@ -37,9 +37,6 @@ import org.compiere.model.MOrder;
|
|||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.model.X_M_PromotionDistribution;
|
||||
import org.compiere.model.X_M_PromotionLine;
|
||||
import org.compiere.model.X_M_PromotionReward;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
@ -97,17 +94,17 @@ public class PromotionRule {
|
|||
"M_PromotionDistribution.M_Promotion_ID = ? AND M_PromotionDistribution.IsActive = 'Y'", order.get_TrxName());
|
||||
query.setParameters(new Object[]{entry.getKey()});
|
||||
query.setOrderBy("SeqNo");
|
||||
List<X_M_PromotionDistribution> list = query.<X_M_PromotionDistribution>list();
|
||||
List<MPromotionDistribution> list = query.<MPromotionDistribution>list();
|
||||
|
||||
Query rewardQuery = new Query(Env.getCtx(), MTable.get(order.getCtx(), I_M_PromotionReward.Table_ID),
|
||||
"M_PromotionReward.M_Promotion_ID = ? AND M_PromotionReward.IsActive = 'Y'", order.get_TrxName());
|
||||
rewardQuery.setParameters(new Object[]{entry.getKey()});
|
||||
rewardQuery.setOrderBy("SeqNo");
|
||||
List<X_M_PromotionReward> rewardList = rewardQuery.<X_M_PromotionReward>list();
|
||||
List<MPromotionReward> rewardList = rewardQuery.<MPromotionReward>list();
|
||||
|
||||
List<X_M_PromotionLine> promotionLines = new ArrayList<X_M_PromotionLine>();
|
||||
List<MPromotionLine> promotionLines = new ArrayList<MPromotionLine>();
|
||||
for (Integer M_PromotionLine_ID : entry.getValue()) {
|
||||
X_M_PromotionLine promotionLine = new X_M_PromotionLine(order.getCtx(), M_PromotionLine_ID, order.get_TrxName());
|
||||
MPromotionLine promotionLine = new MPromotionLine(order.getCtx(), M_PromotionLine_ID, order.get_TrxName());
|
||||
promotionLines.add(promotionLine);
|
||||
}
|
||||
while (true) {
|
||||
|
@ -116,8 +113,8 @@ public class PromotionRule {
|
|||
Set<Integer>mandatoryLineSet = new HashSet<Integer>();
|
||||
boolean mandatoryLineNotFound = false;
|
||||
List<Integer> validPromotionLineIDs = new ArrayList<Integer>();
|
||||
for (X_M_PromotionLine promotionLine : promotionLines) {
|
||||
if (promotionLine.getM_PromotionGroup_ID() == 0 && promotionLine.getMinimumAmt() != null && promotionLine.getMinimumAmt().signum() > 0) {
|
||||
for (MPromotionLine promotionLine : promotionLines) {
|
||||
if (promotionLine.getM_PromotionGroup_ID() == 0 && promotionLine.getMinimumAmt() != null && promotionLine.getMinimumAmt().signum() >= 0) {
|
||||
if (orderAmount.compareTo(promotionLine.getMinimumAmt()) >= 0) {
|
||||
orderAmount = orderAmount.subtract(promotionLine.getMinimumAmt());
|
||||
validPromotionLineIDs.add(promotionLine.getM_PromotionLine_ID());
|
||||
|
@ -130,14 +127,14 @@ public class PromotionRule {
|
|||
if (mandatoryLineNotFound) {
|
||||
break;
|
||||
}
|
||||
for (X_M_PromotionDistribution pd : list) {
|
||||
for (MPromotionDistribution pd : list) {
|
||||
if (entry.getValue().contains(pd.getM_PromotionLine_ID())) {
|
||||
//sort available orderline base on distribution sorting type
|
||||
List<Integer> orderLineIdList = new ArrayList<Integer>();
|
||||
orderLineIdList.addAll(orderLineQty.keySet());
|
||||
if (pd.getDistributionSorting() != null) {
|
||||
Comparator<Integer> cmp = olComparator;
|
||||
if (pd.getDistributionSorting().equals(X_M_PromotionDistribution.DISTRIBUTIONSORTING_Descending))
|
||||
if (pd.getDistributionSorting().equals(MPromotionDistribution.DISTRIBUTIONSORTING_Descending))
|
||||
cmp = Collections.reverseOrder(cmp);
|
||||
Collections.sort(orderLineIdList, cmp);
|
||||
}
|
||||
|
@ -171,7 +168,7 @@ public class PromotionRule {
|
|||
}
|
||||
}
|
||||
|
||||
for (X_M_PromotionReward pr : rewardList) {
|
||||
for (MPromotionReward pr : rewardList) {
|
||||
if (pr.isForAllDistribution()) {
|
||||
Collection<DistributionSet> all = distributions.values();
|
||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||
|
@ -189,13 +186,13 @@ public class PromotionRule {
|
|||
}
|
||||
}
|
||||
BigDecimal discount = BigDecimal.ZERO;
|
||||
if (pr.getRewardType().equals(X_M_PromotionReward.REWARDTYPE_AbsoluteAmount)) {
|
||||
if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_AbsoluteAmount)) {
|
||||
if (pr.getAmount().compareTo(totalPrice) < 0) {
|
||||
discount = totalPrice.subtract(pr.getAmount());
|
||||
}
|
||||
} else if (pr.getRewardType().equals(X_M_PromotionReward.REWARDTYPE_FlatDiscount)) {
|
||||
} else if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_FlatDiscount)) {
|
||||
discount = pr.getAmount();
|
||||
} else if (pr.getRewardType().equals(X_M_PromotionReward.REWARDTYPE_Percentage)) {
|
||||
} else if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_Percentage)) {
|
||||
discount = pr.getAmount().divide(BigDecimal.valueOf(100.00)).multiply(totalPrice);
|
||||
}
|
||||
if (discount.signum() > 0) {
|
||||
|
@ -216,7 +213,7 @@ public class PromotionRule {
|
|||
//sort by reward distribution sorting
|
||||
if (pr.getDistributionSorting() != null ) {
|
||||
Comparator<Integer> cmp = new OrderLineComparator(orderLineIndex);
|
||||
if (pr.getDistributionSorting().equals(X_M_PromotionReward.DISTRIBUTIONSORTING_Descending))
|
||||
if (pr.getDistributionSorting().equals(MPromotionReward.DISTRIBUTIONSORTING_Descending))
|
||||
cmp = Collections.reverseOrder(cmp);
|
||||
Set<Integer> keySet = distributionSet.orderLines.keySet();
|
||||
List<Integer> keyList = new ArrayList<Integer>();
|
||||
|
@ -261,13 +258,13 @@ public class PromotionRule {
|
|||
}
|
||||
for (MOrderLine ol : lines) {
|
||||
if (ol.getC_OrderLine_ID() == C_OrderLine_ID) {
|
||||
if (pr.getRewardType().equals(X_M_PromotionReward.REWARDTYPE_Percentage)) {
|
||||
if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_Percentage)) {
|
||||
BigDecimal priceActual = ol.getPriceActual();
|
||||
BigDecimal discount = priceActual.multiply(pr.getAmount().divide(BigDecimal.valueOf(100.00)));
|
||||
addDiscountLine(order, ol, discount, qty, pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
} else if (pr.getRewardType().equals(X_M_PromotionReward.REWARDTYPE_FlatDiscount)) {
|
||||
} else if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_FlatDiscount)) {
|
||||
addDiscountLine(order, ol, pr.getAmount(), BigDecimal.valueOf(1.00), pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
} else if (pr.getRewardType().equals(X_M_PromotionReward.REWARDTYPE_AbsoluteAmount)) {
|
||||
} else if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_AbsoluteAmount)) {
|
||||
BigDecimal priceActual = ol.getPriceActual();
|
||||
totalPrice = totalPrice.add(priceActual.multiply(qty));
|
||||
}
|
||||
|
@ -279,7 +276,7 @@ public class PromotionRule {
|
|||
if (setBalance.signum() == 0)
|
||||
break;
|
||||
}
|
||||
if (pr.getRewardType().equals(X_M_PromotionReward.REWARDTYPE_AbsoluteAmount)) {
|
||||
if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_AbsoluteAmount)) {
|
||||
if (pr.getAmount().compareTo(totalPrice) < 0) {
|
||||
addDiscountLine(order, null, totalPrice.subtract(pr.getAmount()), BigDecimal.valueOf(1.00), pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
}
|
||||
|
@ -414,7 +411,7 @@ public class PromotionRule {
|
|||
* @return Distribution Qty
|
||||
* @throws Exception
|
||||
*/
|
||||
private static DistributionSet calculateDistributionQty(X_M_PromotionDistribution distribution,
|
||||
private static DistributionSet calculateDistributionQty(MPromotionDistribution distribution,
|
||||
DistributionSet prevSet, List<Integer> validPromotionLineIDs, Map<Integer, BigDecimal> orderLineQty, List<Integer> orderLineIdList, String trxName) throws Exception {
|
||||
|
||||
String sql = "SELECT C_OrderLine.C_OrderLine_ID FROM M_PromotionLine"
|
||||
|
@ -474,9 +471,9 @@ public class PromotionRule {
|
|||
match = true;
|
||||
}
|
||||
if (match) {
|
||||
if (X_M_PromotionDistribution.DISTRIBUTIONTYPE_Max.equals(distribution.getDistributionType())) {
|
||||
if (MPromotionDistribution.DISTRIBUTIONTYPE_Max.equals(distribution.getDistributionType())) {
|
||||
setQty = compare > 0 ? totalOrderLineQty : distribution.getQty();
|
||||
} else if (X_M_PromotionDistribution.DISTRIBUTIONTYPE_Min.equals(distribution.getDistributionType())) {
|
||||
} else if (MPromotionDistribution.DISTRIBUTIONTYPE_Min.equals(distribution.getDistributionType())) {
|
||||
setQty = compare < 0 ? totalOrderLineQty : distribution.getQty();
|
||||
} else {
|
||||
setQty = compare > 0 ? totalOrderLineQty.subtract(distribution.getQty())
|
||||
|
@ -543,11 +540,11 @@ public class PromotionRule {
|
|||
private static List<Integer> findPromotionLine(int promotion_ID, MOrder order) throws SQLException {
|
||||
Query query = new Query(Env.getCtx(), MTable.get(order.getCtx(), I_M_PromotionLine.Table_ID), " M_PromotionLine.M_Promotion_ID = ? AND M_PromotionLine.IsActive = 'Y'", order.get_TrxName());
|
||||
query.setParameters(new Object[]{promotion_ID});
|
||||
List<X_M_PromotionLine>plist = query.<X_M_PromotionLine>list();
|
||||
List<MPromotionLine>plist = query.<MPromotionLine>list();
|
||||
//List<M_PromotionLine_ID>
|
||||
List<Integer>applicable = new ArrayList<Integer>();
|
||||
MOrderLine[] lines = order.getLines();
|
||||
for (X_M_PromotionLine pl : plist) {
|
||||
for (MPromotionLine pl : plist) {
|
||||
boolean match = false;
|
||||
if (pl.getM_PromotionGroup_ID() > 0) {
|
||||
String sql = "SELECT DISTINCT C_OrderLine.C_OrderLine_ID FROM M_PromotionGroup INNER JOIN M_PromotionGroupLine"
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
package org.adempiere.model;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.model.I_C_Order;
|
||||
import org.compiere.model.I_C_OrderLine;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.ModelValidationEngine;
|
||||
import org.compiere.model.ModelValidator;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.X_C_Order;
|
||||
import org.compiere.model.X_C_OrderLine;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
/**
|
||||
|
@ -140,10 +140,11 @@ public class PromotionValidator implements ModelValidator {
|
|||
}
|
||||
|
||||
public void initialize(ModelValidationEngine engine, MClient client) {
|
||||
engine.addDocValidate(X_C_Order.Table_Name, this);
|
||||
engine.addModelChange(X_C_OrderLine.Table_Name, this);
|
||||
if (client != null)
|
||||
m_AD_Client_ID = client.getAD_Client_ID();
|
||||
engine.addDocValidate(I_C_Order.Table_Name, this);
|
||||
engine.addModelChange(I_C_OrderLine.Table_Name, this);
|
||||
|
||||
}
|
||||
|
||||
public String login(int AD_Org_ID, int AD_Role_ID, int AD_User_ID) {
|
||||
|
|
|
@ -29,8 +29,13 @@
|
|||
|
||||
package org.adempiere.process;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.acct.Doc;
|
||||
|
@ -41,6 +46,7 @@ import org.compiere.process.ProcessInfoParameter;
|
|||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.AdempiereUserError;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
|
||||
|
@ -115,32 +121,101 @@ public class ClientAcctProcessor extends SvrProcess
|
|||
*/
|
||||
private void postSession()
|
||||
{
|
||||
for (int i = 0; i < Doc.getDocumentsTableID().length; i++)
|
||||
List<BigDecimal> listProcessedOn = new ArrayList<BigDecimal>();
|
||||
listProcessedOn.add(Env.ZERO); // to include potential null values
|
||||
|
||||
//get current time from db
|
||||
Timestamp ts = DB.getSQLValueTS(get_TrxName(), "SELECT CURRENT_TIMESTAMP FROM DUAL");
|
||||
|
||||
//go back 2 second to be safe (to avoid posting documents being completed at this precise moment)
|
||||
long ms = ts.getTime()- (2 * 1000);
|
||||
ts = new Timestamp(ms);
|
||||
long mili = ts.getTime();
|
||||
BigDecimal value = new BigDecimal(Long.toString(mili));
|
||||
|
||||
//first pass, collect all ts (FR 2962094 - required for weighted average costing)
|
||||
int[] documentsTableID = Doc.getDocumentsTableID();
|
||||
String[] documentsTableName = Doc.getDocumentsTableName();
|
||||
for (int i = 0; i < documentsTableID.length; i++)
|
||||
{
|
||||
int AD_Table_ID = Doc.getDocumentsTableID()[i];
|
||||
String TableName = Doc.getDocumentsTableName()[i];
|
||||
int AD_Table_ID = documentsTableID[i];
|
||||
String TableName = documentsTableName[i];
|
||||
// Post only special documents
|
||||
if (p_AD_Table_ID != 0
|
||||
&& p_AD_Table_ID != AD_Table_ID)
|
||||
continue;
|
||||
// SELECT * FROM table
|
||||
StringBuffer sql = new StringBuffer ("SELECT * FROM ").append(TableName)
|
||||
.append(" WHERE AD_Client_ID=?")
|
||||
.append(" AND Processed='Y' AND Posted='N' AND IsActive='Y'")
|
||||
.append(" ORDER BY Created");
|
||||
//
|
||||
int count = 0;
|
||||
int countError = 0;
|
||||
|
||||
StringBuffer sql = new StringBuffer ("SELECT DISTINCT ProcessedOn FROM ").append(TableName)
|
||||
.append(" WHERE AD_Client_ID=? AND ProcessedOn<?")
|
||||
.append(" AND Processed='Y' AND Posted='N' AND IsActive='Y'");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt.setInt(1, getAD_Client_ID());
|
||||
pstmt.setBigDecimal(2, value);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
count++;
|
||||
BigDecimal processedOn = rs.getBigDecimal(1);
|
||||
if (!listProcessedOn.contains(processedOn))
|
||||
listProcessedOn.add(processedOn);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
}
|
||||
|
||||
// initialize counters per table
|
||||
int[] count = new int[documentsTableID.length];
|
||||
int[] countError = new int[documentsTableID.length];
|
||||
for (int i = 0; i < count.length; i++) {
|
||||
count[i] = 0;
|
||||
countError[i] = 0;
|
||||
}
|
||||
|
||||
//sort and post in the processed date order
|
||||
Collections.sort(listProcessedOn);
|
||||
for (BigDecimal processedOn : listProcessedOn)
|
||||
{
|
||||
|
||||
for (int i = 0; i < documentsTableID.length; i++)
|
||||
{
|
||||
int AD_Table_ID = documentsTableID[i];
|
||||
String TableName = documentsTableName[i];
|
||||
// Post only special documents
|
||||
if (p_AD_Table_ID != 0
|
||||
&& p_AD_Table_ID != AD_Table_ID)
|
||||
continue;
|
||||
// SELECT * FROM table
|
||||
StringBuffer sql = new StringBuffer ("SELECT * FROM ").append(TableName)
|
||||
.append(" WHERE AD_Client_ID=? AND (ProcessedOn");
|
||||
if (processedOn.compareTo(Env.ZERO) != 0)
|
||||
sql.append("=?");
|
||||
else
|
||||
sql.append(" IS NULL OR ProcessedOn=0");
|
||||
sql.append(") AND Processed='Y' AND Posted='N' AND IsActive='Y'")
|
||||
.append(" ORDER BY Created");
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt.setInt(1, getAD_Client_ID());
|
||||
if (processedOn.compareTo(Env.ZERO) != 0)
|
||||
pstmt.setBigDecimal(2, processedOn);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
count[i]++;
|
||||
boolean ok = true;
|
||||
// Run every posting document in own transaction
|
||||
String innerTrxName = Trx.createTrxName("CAP");
|
||||
|
@ -174,7 +249,7 @@ public class ClientAcctProcessor extends SvrProcess
|
|||
innerTrx = null;
|
||||
}
|
||||
if (!ok)
|
||||
countError++;
|
||||
countError[i]++;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -186,18 +261,25 @@ public class ClientAcctProcessor extends SvrProcess
|
|||
DB.close(rs, pstmt);
|
||||
}
|
||||
|
||||
//
|
||||
if (count > 0)
|
||||
} // for tableID
|
||||
|
||||
} // for processedOn
|
||||
|
||||
for (int i = 0; i < documentsTableID.length; i++)
|
||||
{
|
||||
String TableName = documentsTableName[i];
|
||||
if (count[i] > 0)
|
||||
{
|
||||
m_summary.append(TableName).append("=").append(count);
|
||||
if (countError > 0)
|
||||
m_summary.append("(Errors=").append(countError).append(")");
|
||||
m_summary.append(TableName).append("=").append(count[i]);
|
||||
if (countError[i] > 0)
|
||||
m_summary.append("(Errors=").append(countError[i]).append(")");
|
||||
m_summary.append(" - ");
|
||||
log.finer(getName() + ": " + m_summary.toString());
|
||||
}
|
||||
else
|
||||
log.finer(getName() + ": " + TableName + " - no work");
|
||||
}
|
||||
|
||||
} // postSession
|
||||
|
||||
} // ClientAcctProcessor
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* This file is part of Adempiere ERP Bazaar *
|
||||
* http://www.adempiere.org *
|
||||
* *
|
||||
|
@ -23,16 +23,32 @@
|
|||
* Sponsors: *
|
||||
* - Company (http://www.notima.se) *
|
||||
* - Company (http://www.cyberphoto.se) *
|
||||
***********************************************************************/
|
||||
**********************************************************************/
|
||||
|
||||
package org.adempiere.process;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.process.*;
|
||||
import org.compiere.util.*;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.I_C_ElementValue;
|
||||
import org.compiere.model.I_C_ValidCombination;
|
||||
import org.compiere.model.I_M_Product;
|
||||
import org.compiere.model.I_M_Product_Acct;
|
||||
import org.compiere.model.MAccount;
|
||||
import org.compiere.model.MElementValue;
|
||||
import org.compiere.model.MPriceList;
|
||||
import org.compiere.model.MPriceListVersion;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.model.X_M_Product_Acct;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Creates expense type products from a given range of expense account
|
||||
|
@ -107,8 +123,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 +137,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 +152,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 +211,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());
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.sql.Timestamp;
|
|||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.I_C_InvoiceLine;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInOutLine;
|
||||
import org.compiere.model.MInvoiceLine;
|
||||
|
@ -204,10 +205,10 @@ public class InOutGenerateRMA extends SvrProcess
|
|||
//
|
||||
// Link to corresponding Invoice Line (if any) - teo_sarca [ 2818523 ]
|
||||
// The MMatchInv records will be automatically generated on MInOut.completeIt()
|
||||
final MInvoiceLine invoiceLine = new Query(shipment.getCtx(), MInvoiceLine.Table_Name,
|
||||
MInvoiceLine.COLUMNNAME_M_RMALine_ID+"=?",
|
||||
MInvoiceLine invoiceLine = new Query(shipment.getCtx(), I_C_InvoiceLine.Table_Name,
|
||||
I_C_InvoiceLine.COLUMNNAME_M_RMALine_ID+"=?",
|
||||
shipment.get_TrxName())
|
||||
.setParameters(new Object[]{rmaLine.getM_RMALine_ID()})
|
||||
.setParameters(rmaLine.getM_RMALine_ID())
|
||||
.firstOnly();
|
||||
if (invoiceLine != null)
|
||||
{
|
||||
|
|
|
@ -26,11 +26,9 @@
|
|||
* *
|
||||
* Sponsors: *
|
||||
* - E-evolution (http://www.e-evolution.com/) *
|
||||
**********************************************************************/
|
||||
*********************************************************************/
|
||||
package org.adempiere.process.rpl.exp;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -45,22 +43,19 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||
import org.adempiere.process.rpl.IExportProcessor;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MEXPFormat;
|
||||
import org.compiere.model.MEXPFormatLine;
|
||||
import org.compiere.model.MEXPProcessor;
|
||||
import org.compiere.model.MEXPProcessorType;
|
||||
import org.compiere.model.MReplicationStrategy;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.model.X_EXP_FormatLine;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.model.MEXPFormat;
|
||||
import org.compiere.model.MEXPFormatLine;
|
||||
import org.compiere.model.MEXPProcessor;
|
||||
import org.compiere.model.MEXPProcessorType;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Text;
|
||||
|
@ -74,6 +69,8 @@ import org.w3c.dom.Text;
|
|||
* @author victor.perez@e-evolution.com, e-Evolution
|
||||
* <li>[ 2195090 ] Stabilization of replication
|
||||
* <li>https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2936561&group_id=176962
|
||||
* <li>BF [2947622] The replication ID (Primary Key) is not working
|
||||
* <li>https://sourceforge.net/tracker/?func=detail&aid=2947622&group_id=176962&atid=879332
|
||||
*
|
||||
*/
|
||||
public class ExportHelper {
|
||||
|
@ -84,12 +81,6 @@ public class ExportHelper {
|
|||
/** XML Document */
|
||||
private Document outDocument = null;
|
||||
|
||||
/** Date Time Format */
|
||||
private SimpleDateFormat m_dateTimeFormat = null;
|
||||
|
||||
/** Date Format */
|
||||
private SimpleDateFormat m_dateFormat = null;
|
||||
|
||||
/** Custom Date Format */
|
||||
private SimpleDateFormat m_customDateFormat = null;
|
||||
|
||||
|
@ -103,15 +94,10 @@ public class ExportHelper {
|
|||
public ExportHelper(MClient client, MReplicationStrategy rplStrategy) {
|
||||
m_AD_Client_ID = client.getAD_Client_ID();
|
||||
m_rplStrategy = rplStrategy;
|
||||
|
||||
m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Language.getLanguage(Env.getAD_Language(client.getCtx())));
|
||||
m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Language.getLanguage(Env.getAD_Language(client.getCtx())));
|
||||
}
|
||||
|
||||
public ExportHelper(Properties ctx , int AD_Client_ID) {
|
||||
m_AD_Client_ID = AD_Client_ID;
|
||||
m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Language.getLanguage(Env.getAD_Language(ctx)));
|
||||
m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Language.getLanguage(Env.getAD_Language(ctx)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,48 +143,20 @@ public class ExportHelper {
|
|||
|
||||
outDocument = createNewDocument();
|
||||
|
||||
StringBuffer sql = new StringBuffer("SELECT * ")
|
||||
.append("FROM ").append(po.get_TableName()).append(" ")
|
||||
.append("WHERE ").append(po.get_KeyColumns()[0]).append("=?")
|
||||
;
|
||||
HashMap<String, Integer> variableMap = new HashMap<String, Integer>();
|
||||
|
||||
if (exportFormat.getWhereClause() != null & !"".equals(exportFormat.getWhereClause())) {
|
||||
sql.append(" AND ").append(exportFormat.getWhereClause());
|
||||
}
|
||||
|
||||
ResultSet rs = null;
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
Element rootElement = outDocument.createElement(exportFormat.getValue());
|
||||
if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription()))
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), po.get_TrxName());
|
||||
pstmt.setInt(1, po.get_ID());
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
HashMap<String, Integer> variableMap = new HashMap<String, Integer>();
|
||||
//variableMap.put(TOTAL_SEGMENTS, new Integer(1));
|
||||
|
||||
Element rootElement = outDocument.createElement(exportFormat.getValue());
|
||||
if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription())) {
|
||||
rootElement.appendChild(outDocument.createComment(exportFormat.getDescription()));
|
||||
}
|
||||
rootElement.setAttribute("AD_Client_Value", client.getValue());
|
||||
rootElement.setAttribute("Version", exportFormat.getVersion());
|
||||
rootElement.setAttribute("ReplicationMode", ReplicationMode.toString());
|
||||
rootElement.setAttribute("ReplicationType", ReplicationType);
|
||||
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
|
||||
outDocument.appendChild(rootElement);
|
||||
generateExportFormat(rootElement, exportFormat, rs, po, po.get_ID(), variableMap);
|
||||
}
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (rs != null) rs.close();
|
||||
if (pstmt != null) pstmt.close();
|
||||
} catch (SQLException ex) {/*ignored*/}
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
rootElement.appendChild(outDocument.createComment(exportFormat.getDescription()));
|
||||
}
|
||||
rootElement.setAttribute("AD_Client_Value", client.getValue());
|
||||
rootElement.setAttribute("Version", exportFormat.getVersion());
|
||||
rootElement.setAttribute("ReplicationMode", ReplicationMode.toString());
|
||||
rootElement.setAttribute("ReplicationType", ReplicationType);
|
||||
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
|
||||
outDocument.appendChild(rootElement);
|
||||
generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap);
|
||||
|
||||
MEXPProcessor mExportProcessor = null;
|
||||
mExportProcessor = new MEXPProcessor (po.getCtx(), m_rplStrategy.getEXP_Processor_ID(), po.get_TrxName() );
|
||||
|
@ -236,11 +194,11 @@ public class ExportHelper {
|
|||
MTable table = MTable.get(exportFormat.getCtx(), exportFormat.getAD_Table_ID());
|
||||
log.info("Table = " + table);
|
||||
|
||||
Collection<PO> datas = new Query(exportFormat.getCtx(),table.getTableName(), exportFormat.getWhereClause(), exportFormat.get_TrxName())
|
||||
Collection<PO> records = new Query(exportFormat.getCtx(),table.getTableName(), exportFormat.getWhereClause(), exportFormat.get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
|
||||
for (PO po : datas)
|
||||
for (PO po : records)
|
||||
{
|
||||
log.info("Client = " + client.toString());
|
||||
log.finest("po.getAD_Org_ID() = " + po.getAD_Org_ID());
|
||||
|
@ -253,52 +211,22 @@ public class ExportHelper {
|
|||
throw new Exception(Msg.getMsg (po.getCtx(), "ExportNoneColumnKeyNotSupported"));//TODO: Create Mesagge.
|
||||
}
|
||||
|
||||
// TODO - get proper Export Format!
|
||||
String version = "3.2.0";
|
||||
outDocument = createNewDocument();
|
||||
|
||||
StringBuffer sql = new StringBuffer("SELECT * ")
|
||||
.append("FROM ").append(table.getTableName()).append(" ")
|
||||
.append("WHERE ").append(po.get_KeyColumns()[0]).append("=?")
|
||||
;
|
||||
|
||||
if (exportFormat.getWhereClause() != null & !"".equals(exportFormat.getWhereClause())) {
|
||||
sql.append(" AND ").append(exportFormat.getWhereClause());
|
||||
}
|
||||
|
||||
ResultSet rs = null;
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
HashMap<String, Integer> variableMap = new HashMap<String, Integer>();
|
||||
Element rootElement = outDocument.createElement(exportFormat.getValue());
|
||||
if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription()))
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), po.get_TrxName());
|
||||
pstmt.setInt(1, po.get_ID());
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
HashMap<String, Integer> variableMap = new HashMap<String, Integer>();
|
||||
//variableMap.put(TOTAL_SEGMENTS, new Integer(1));
|
||||
|
||||
Element rootElement = outDocument.createElement(exportFormat.getValue());
|
||||
if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription())) {
|
||||
rootElement.appendChild(outDocument.createComment(exportFormat.getDescription()));
|
||||
}
|
||||
rootElement.setAttribute("AD_Client_Value", client.getValue());
|
||||
rootElement.setAttribute("Version", exportFormat.getVersion());
|
||||
rootElement.setAttribute("ReplicationMode", ReplicationMode.toString());
|
||||
rootElement.setAttribute("ReplicationType", ReplicationType);
|
||||
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
|
||||
outDocument.appendChild(rootElement);
|
||||
generateExportFormat(rootElement, exportFormat, rs, po, po.get_ID(), variableMap);
|
||||
}
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (rs != null) rs.close();
|
||||
if (pstmt != null) pstmt.close();
|
||||
} catch (SQLException ex) {/*ignored*/}
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
rootElement.appendChild(outDocument.createComment(exportFormat.getDescription()));
|
||||
}
|
||||
rootElement.setAttribute("AD_Client_Value", client.getValue());
|
||||
rootElement.setAttribute("Version", exportFormat.getVersion());
|
||||
rootElement.setAttribute("ReplicationMode", ReplicationMode.toString());
|
||||
rootElement.setAttribute("ReplicationType", ReplicationType);
|
||||
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
|
||||
outDocument.appendChild(rootElement);
|
||||
generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap);
|
||||
}// finish record read
|
||||
return outDocument;
|
||||
}
|
||||
|
@ -310,7 +238,7 @@ public class ExportHelper {
|
|||
* <DocumentNo>101</DocumentNo>
|
||||
* </C_Invoice>
|
||||
*/
|
||||
private void generateExportFormat(Element rootElement, MEXPFormat exportFormat, ResultSet rs, PO masterPO, int masterID, HashMap<String, Integer> variableMap) throws SQLException, Exception
|
||||
private void generateExportFormat(Element rootElement, MEXPFormat exportFormat, PO masterPO, int masterID, HashMap<String, Integer> variableMap) throws SQLException, Exception
|
||||
{
|
||||
Collection<MEXPFormatLine> formatLines = exportFormat.getFormatLines();
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -323,7 +251,7 @@ public class ExportHelper {
|
|||
// process single XML Attribute
|
||||
// Create new element
|
||||
Element newElement = outDocument.createElement(formatLine.getValue());
|
||||
|
||||
log.info("Format Line Seach key"+ formatLine.getValue());
|
||||
if (formatLine.getAD_Column_ID() == 0) {
|
||||
throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory"));
|
||||
}
|
||||
|
@ -336,7 +264,7 @@ public class ExportHelper {
|
|||
} else { }
|
||||
//log.info("["+column.getColumnName()+"]");
|
||||
|
||||
Object value = rs.getObject(column.getColumnName());
|
||||
Object value = masterPO.get_Value(column.getColumnName());
|
||||
String valueString = null;
|
||||
if (value != null) {
|
||||
valueString = value.toString();
|
||||
|
@ -350,14 +278,12 @@ public class ExportHelper {
|
|||
if (valueString != null) {
|
||||
if (formatLine.getDateFormat() != null && !"".equals(formatLine.getDateFormat())) {
|
||||
m_customDateFormat = new SimpleDateFormat( formatLine.getDateFormat() ); // "MM/dd/yyyy"
|
||||
//Date date = m_customDateFormat.parse ( valueString );
|
||||
|
||||
valueString = m_customDateFormat.format(Timestamp.valueOf (valueString));
|
||||
newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute"
|
||||
} else {
|
||||
//valueString = m_dateFormat.format (Timestamp.valueOf (valueString));
|
||||
//newElement.setAttribute("DateFormat", m_dateTimeFormat.toPattern()); // Add "DateForamt attribute
|
||||
//Standard Japanese Format (default) works better (yyyy-mm-dd)
|
||||
newElement.setAttribute("DateFormat", valueString);
|
||||
} else
|
||||
{
|
||||
newElement.setAttribute("DateFormat", valueString);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -365,13 +291,9 @@ public class ExportHelper {
|
|||
if (valueString != null) {
|
||||
if (formatLine.getDateFormat() != null && !"".equals(formatLine.getDateFormat())) {
|
||||
m_customDateFormat = new SimpleDateFormat( formatLine.getDateFormat() ); // "MM/dd/yyyy"
|
||||
//Date date = m_customDateFormat.parse ( valueString );
|
||||
valueString = m_customDateFormat.format(Timestamp.valueOf (valueString));
|
||||
newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute"
|
||||
} else {
|
||||
//valueString = m_dateTimeFormat.format (Timestamp.valueOf (valueString));
|
||||
//newElement.setAttribute("DateFormat", m_dateTimeFormat.toPattern()); // Add "DateForamt attribute
|
||||
//Standard Japanese Format (default) works better (yyyy-mm-dd hh:mm:ss m.mm)
|
||||
newElement.setAttribute("DateFormat", valueString);
|
||||
}
|
||||
}
|
||||
|
@ -382,8 +304,6 @@ public class ExportHelper {
|
|||
newElement.appendChild(newText);
|
||||
rootElement.appendChild(newElement);
|
||||
elementHasValue = true;
|
||||
//increaseVariable(variableMap, formatLines[i].getVariableName()); // Increase value of Variable if any Variable
|
||||
//increaseVariable(variableMap, TOTAL_SEGMENTS);
|
||||
} else {
|
||||
// Empty field.
|
||||
if (formatLine.isMandatory()) {
|
||||
|
@ -407,7 +327,7 @@ public class ExportHelper {
|
|||
} else { }
|
||||
//log.info("["+column.getColumnName()+"]");
|
||||
|
||||
Object value = rs.getObject(column.getColumnName());
|
||||
Object value = masterPO.get_Value(column.getColumnName());
|
||||
String valueString = null;
|
||||
if (value != null) {
|
||||
valueString = value.toString();
|
||||
|
@ -442,8 +362,7 @@ public class ExportHelper {
|
|||
if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) {
|
||||
rootElement.setAttribute(formatLine.getValue(), valueString);
|
||||
elementHasValue = true;
|
||||
//increaseVariable(variableMap, formatLines[i].getVariableName()); // Increase value of Variable if any Variable
|
||||
//increaseVariable(variableMap, TOTAL_SEGMENTS);
|
||||
|
||||
} else {
|
||||
// Empty field.
|
||||
}
|
||||
|
@ -458,44 +377,30 @@ public class ExportHelper {
|
|||
|
||||
MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID());
|
||||
log.info("Table Embedded = " + tableEmbedded);
|
||||
StringBuffer sql = new StringBuffer("SELECT * ")
|
||||
.append("FROM ").append(tableEmbedded.getTableName()).append(" ")
|
||||
.append("WHERE ").append(masterPO.get_KeyColumns()[0]).append("=?")
|
||||
//+ "WHERE " + po.get_WhereClause(false)
|
||||
;
|
||||
if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause())) {
|
||||
sql.append(" AND ").append(embeddedFormat.getWhereClause());
|
||||
}
|
||||
log.info(sql.toString());
|
||||
ResultSet rsEmbedded = null;
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
|
||||
final StringBuffer whereClause = new StringBuffer(masterPO.get_KeyColumns()[0] +"=?");
|
||||
|
||||
if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause()))
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), masterPO.get_TrxName());
|
||||
pstmt.setInt(1, masterID);
|
||||
rsEmbedded = pstmt.executeQuery();
|
||||
while (rsEmbedded.next())
|
||||
{
|
||||
//System.out.println("Trifon - tableEmbedded.getTableName()_ID = "+ tableEmbedded.getTableName() + "_ID");
|
||||
int embeddedID = rsEmbedded.getInt(tableEmbedded.getTableName() + "_ID");
|
||||
PO poEmbedded = tableEmbedded.getPO (embeddedID, masterPO.get_TrxName());
|
||||
|
||||
Element embeddedElement = outDocument.createElement(formatLine.getValue());
|
||||
if (formatLine.getDescription() != null && !"".equals(formatLine.getDescription())) {
|
||||
embeddedElement.appendChild(outDocument.createComment(formatLine.getDescription()));
|
||||
}
|
||||
generateExportFormat(embeddedElement, embeddedFormat, rsEmbedded, poEmbedded, embeddedID, variableMap);
|
||||
rootElement.appendChild(embeddedElement);
|
||||
}
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (rsEmbedded != null) rsEmbedded.close();
|
||||
if (pstmt != null) pstmt.close();
|
||||
} catch (SQLException ex) { }
|
||||
rsEmbedded = null;
|
||||
pstmt = null;
|
||||
whereClause.append(" AND ").append(embeddedFormat.getWhereClause());
|
||||
}
|
||||
Collection<PO> instances = new Query(masterPO.getCtx(),
|
||||
tableEmbedded.getTableName(), whereClause.toString(),
|
||||
masterPO.get_TrxName()).setClient_ID().setParameters(
|
||||
new Object[] { masterID }).list();
|
||||
|
||||
for (PO instance : instances)
|
||||
{
|
||||
Element embeddedElement = outDocument.createElement(formatLine.getValue());
|
||||
if (formatLine.getDescription() != null && !"".equals(formatLine.getDescription()))
|
||||
{
|
||||
embeddedElement.appendChild(outDocument.createComment(formatLine.getDescription()));
|
||||
}
|
||||
|
||||
generateExportFormat(embeddedElement, embeddedFormat, instance, instance.get_ID(), variableMap);
|
||||
rootElement.appendChild(embeddedElement);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if ( formatLine.getType().equals(X_EXP_FormatLine.TYPE_ReferencedEXPFormat) )
|
||||
|
@ -508,63 +413,34 @@ public class ExportHelper {
|
|||
|
||||
MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID());
|
||||
log.info("Table Embedded = " + tableEmbedded);
|
||||
StringBuffer sql = new StringBuffer("SELECT * ")
|
||||
.append("FROM ").append(tableEmbedded.getTableName()).append(" ")
|
||||
.append("WHERE ").append(tableEmbedded.getTableName() + "_ID").append("=?")
|
||||
//+ "WHERE " + po.get_WhereClause(false)
|
||||
;
|
||||
if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause())) {
|
||||
sql.append(" AND ").append(embeddedFormat.getWhereClause());
|
||||
}
|
||||
log.info(sql.toString());
|
||||
if (formatLine.getAD_Column_ID() == 0) {
|
||||
throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory"));
|
||||
}
|
||||
MColumn column = MColumn.get(masterPO.getCtx(), formatLine.getAD_Column_ID());
|
||||
if (column == null) {
|
||||
throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory"));
|
||||
}
|
||||
if ( column.isVirtualColumn() ) {
|
||||
log.info("This is Virtual Column!");
|
||||
} else { }
|
||||
//log.info("["+column.getColumnName()+"]");
|
||||
Object value = rs.getObject(column.getColumnName());
|
||||
/* String valueString = null;
|
||||
if (value != null) {
|
||||
valueString = value.toString();
|
||||
} else {
|
||||
throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPFieldMandatory"));
|
||||
}
|
||||
*/
|
||||
log.info(sql.toString());
|
||||
ResultSet rsEmbedded = null;
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
|
||||
final StringBuffer whereClause = new StringBuffer(tableEmbedded.getTableName() + "_ID =?");
|
||||
if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause()))
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), masterPO.get_TrxName());
|
||||
pstmt.setObject(1, value);
|
||||
rsEmbedded = pstmt.executeQuery();
|
||||
while (rsEmbedded.next())
|
||||
{
|
||||
//System.out.println("Trifon - tableEmbedded.getTableName()_ID = "+ tableEmbedded.getTableName() + "_ID");
|
||||
int embeddedID = rsEmbedded.getInt(tableEmbedded.getTableName() + "_ID");
|
||||
PO poEmbedded = tableEmbedded.getPO (embeddedID, masterPO.get_TrxName());
|
||||
whereClause.append(" AND ").append(embeddedFormat.getWhereClause());
|
||||
}
|
||||
|
||||
Element embeddedElement = outDocument.createElement(formatLine.getValue());
|
||||
if (formatLine.getDescription() != null && !"".equals(formatLine.getDescription())) {
|
||||
embeddedElement.appendChild(outDocument.createComment(formatLine.getDescription()));
|
||||
}
|
||||
generateExportFormat(embeddedElement, embeddedFormat, rsEmbedded, poEmbedded, embeddedID, variableMap);
|
||||
rootElement.appendChild(embeddedElement);
|
||||
}
|
||||
Object value = masterPO.get_Value(tableEmbedded.getTableName() + "_ID");
|
||||
if (value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (rsEmbedded != null) rsEmbedded.close();
|
||||
if (pstmt != null) pstmt.close();
|
||||
} catch (SQLException ex) { }
|
||||
rsEmbedded = null;
|
||||
pstmt = null;
|
||||
Collection<PO> instances = new Query(masterPO.getCtx(),tableEmbedded.getTableName(), whereClause.toString(),masterPO.get_TrxName())
|
||||
.setClient_ID()
|
||||
.setParameters(value)
|
||||
.list();
|
||||
|
||||
for (PO instance : instances)
|
||||
{
|
||||
Element embeddedElement = outDocument.createElement(formatLine.getValue());
|
||||
if (formatLine.getDescription() != null && !"".equals(formatLine.getDescription()))
|
||||
{
|
||||
embeddedElement.appendChild(outDocument.createComment(formatLine.getDescription()));
|
||||
}
|
||||
|
||||
generateExportFormat(embeddedElement, embeddedFormat, instance, instance.get_ID(), variableMap);
|
||||
rootElement.appendChild(embeddedElement);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* *
|
||||
* Sponsors: *
|
||||
* - E-evolution (http://www.e-evolution.com/) *
|
||||
**********************************************************************/
|
||||
*********************************************************************/
|
||||
package org.adempiere.process.rpl.imp;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -40,8 +40,8 @@ import java.util.Properties;
|
|||
import javax.xml.xpath.XPathExpressionException;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.process.rpl.exp.ExportHelper;
|
||||
import org.adempiere.process.rpl.XMLHelper;
|
||||
import org.adempiere.process.rpl.exp.ExportHelper;
|
||||
import org.compiere.model.I_AD_Client;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MColumn;
|
||||
|
@ -52,7 +52,9 @@ import org.compiere.model.MTable;
|
|||
import org.compiere.model.ModelValidator;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.model.X_AD_ReplicationDocument;
|
||||
import org.compiere.model.X_AD_ReplicationTable;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -69,6 +71,8 @@ import org.w3c.dom.NodeList;
|
|||
* @author victor.perez@e-evolution.com, e-Evolution
|
||||
* <li>[ 2195090 ] Stabilization of replication
|
||||
* <li>https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2936561&group_id=176962
|
||||
* <li>BF [2947622] The replication ID (Primary Key) is not working
|
||||
* <li>https://sourceforge.net/tracker/?func=detail&aid=2947622&group_id=176962&atid=879332
|
||||
*
|
||||
*/
|
||||
public class ImportHelper {
|
||||
|
@ -79,12 +83,6 @@ public class ImportHelper {
|
|||
/** Static Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger(ImportHelper.class);
|
||||
|
||||
/** Date Time Format */
|
||||
private SimpleDateFormat m_dateTimeFormat = null;
|
||||
|
||||
/** Date Format */
|
||||
private SimpleDateFormat m_dateFormat = null;
|
||||
|
||||
/** Custom Date Format */
|
||||
private SimpleDateFormat m_customDateFormat = null;
|
||||
|
||||
|
@ -94,9 +92,6 @@ public class ImportHelper {
|
|||
public ImportHelper(Properties ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
// Construct DateFromat and DateTimeFormat
|
||||
m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Env.getLanguage(ctx));
|
||||
m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Env.getLanguage(ctx));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,65 +166,62 @@ public class ImportHelper {
|
|||
|
||||
if(po != null)
|
||||
{
|
||||
// Here must invoke other method else we get cycle...
|
||||
if (ModelValidator.TYPE_BEFORE_DELETE == ReplicationEvent
|
||||
|| ModelValidator.TYPE_BEFORE_DELETE_REPLICATION == ReplicationEvent
|
||||
|| ModelValidator.TYPE_DELETE == ReplicationEvent)
|
||||
{
|
||||
po.deleteEx(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(X_AD_ReplicationTable.REPLICATIONTYPE_Broadcast.equals(ReplicationType))
|
||||
{
|
||||
po.saveReplica(true);
|
||||
MReplicationStrategy rplStrategy = new MReplicationStrategy(client.getCtx(), client.getAD_ReplicationStrategy_ID(), null);
|
||||
ExportHelper expHelper = new ExportHelper(client, rplStrategy);
|
||||
expHelper.exportRecord( po,
|
||||
MReplicationStrategy.REPLICATION_TABLE,
|
||||
X_AD_ReplicationTable.REPLICATIONTYPE_Merge,
|
||||
ModelValidator.TYPE_AFTER_CHANGE);
|
||||
}
|
||||
else if(X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(ReplicationType)
|
||||
|| X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType))
|
||||
{
|
||||
po.saveReplica(true);
|
||||
}
|
||||
/*else if (X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType))
|
||||
{
|
||||
//Do nothing??
|
||||
}*/
|
||||
else if(X_AD_ReplicationTable.REPLICATIONTYPE_Local.equals(ReplicationType))
|
||||
{
|
||||
//Do nothing??
|
||||
}
|
||||
else
|
||||
{
|
||||
// Replication Type is not one of the possible values...ERROR
|
||||
throw new Exception(Msg.getMsg(ctx, "EXPReplicationTypeNonValidType"));
|
||||
}
|
||||
if(MReplicationStrategy.REPLICATION_TABLE==ReplicationMode)
|
||||
{
|
||||
// Here must invoke other method else we get cycle...
|
||||
if ( ModelValidator.TYPE_BEFORE_DELETE == ReplicationEvent
|
||||
|| ModelValidator.TYPE_BEFORE_DELETE_REPLICATION == ReplicationEvent
|
||||
|| ModelValidator.TYPE_DELETE == ReplicationEvent)
|
||||
{
|
||||
po.deleteEx(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(X_AD_ReplicationTable.REPLICATIONTYPE_Broadcast.equals(ReplicationType))
|
||||
{
|
||||
po.saveReplica(true);
|
||||
MReplicationStrategy rplStrategy = new MReplicationStrategy(client.getCtx(), client.getAD_ReplicationStrategy_ID(), null);
|
||||
ExportHelper expHelper = new ExportHelper(client, rplStrategy);
|
||||
expHelper.exportRecord( po,
|
||||
MReplicationStrategy.REPLICATION_TABLE,
|
||||
X_AD_ReplicationTable.REPLICATIONTYPE_Merge,
|
||||
ModelValidator.TYPE_AFTER_CHANGE);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else if(X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(ReplicationType)
|
||||
|| X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType))
|
||||
{
|
||||
if(po.is_Changed())
|
||||
{
|
||||
po.saveReplica(true);
|
||||
}
|
||||
}
|
||||
/*else if (X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType))
|
||||
{
|
||||
//Do nothing??
|
||||
}*/
|
||||
else if(X_AD_ReplicationTable.REPLICATIONTYPE_Local.equals(ReplicationType))
|
||||
{
|
||||
//Do nothing??
|
||||
}
|
||||
else
|
||||
{
|
||||
// Replication Type is not one of the possible values...ERROR
|
||||
throw new Exception(Msg.getMsg(ctx, "EXPReplicationTypeNonValidType"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(MReplicationStrategy.REPLICATION_DOCUMENT == ReplicationMode
|
||||
&& X_AD_ReplicationDocument.REPLICATIONTYPE_Merge.equals(ReplicationType)
|
||||
&& po instanceof DocAction)
|
||||
{
|
||||
Env.setContext(po.getCtx(), "#AD_Client_ID", po.getAD_Client_ID());
|
||||
DocAction document = (DocAction)po;
|
||||
document.processIt(document.getDocAction());
|
||||
po.saveEx();
|
||||
}
|
||||
}
|
||||
result.append("Save Successful ;");
|
||||
/*if (resultSave)
|
||||
{
|
||||
if(ReplicationMode == MReplicationStrategy.REPLICATION_DOCUMENT &&
|
||||
ReplicationType == X_AD_ReplicationDocument.REPLICATIONTYPE_Merge)
|
||||
{
|
||||
String status = po.get_ValueAsString("DocStatus");
|
||||
String action = po.get_ValueAsString("DocAction");
|
||||
DocAction m_document;
|
||||
m_document=(DocAction) po;
|
||||
DocumentEngine engine = new DocumentEngine (m_document, status);
|
||||
engine.processIt (action);
|
||||
}
|
||||
// Success in save
|
||||
} else {
|
||||
// Failed in save
|
||||
throw new Exception(Msg.getMsg(ctx, "EXPFormatFailedSave"));
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,7 +231,6 @@ public class ImportHelper {
|
|||
* @throws Exception
|
||||
* @throws XPathExpressionException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private PO importElement(Properties ctx, StringBuffer result, Element rootElement,
|
||||
MEXPFormat expFormat, String ReplicationType, String trxName) throws Exception, XPathExpressionException
|
||||
{
|
||||
|
@ -279,7 +270,7 @@ public class ImportHelper {
|
|||
log.info("=================== Beginnig of Format Line ===============================");
|
||||
log.info("formatLine: [" + formatLine.toString() + "]");
|
||||
//Get the value
|
||||
Object value = getValueFromFormat(formatLine,po,rootElement,result,ReplicationType,trxName);
|
||||
Object value = getValueFromFormat(formatLine,po,rootElement,result,ReplicationType);
|
||||
if (value == null || value.toString().equals(""))
|
||||
continue;
|
||||
//Set the value
|
||||
|
@ -300,7 +291,7 @@ public class ImportHelper {
|
|||
* @throws Exception
|
||||
*/
|
||||
private Object getValueFromFormat(MEXPFormatLine line,PO po,Element rootElement,
|
||||
StringBuffer result, String ReplicationType, String trxName) throws Exception
|
||||
StringBuffer result, String ReplicationType) throws Exception
|
||||
{
|
||||
Object value = null;
|
||||
|
||||
|
@ -315,7 +306,7 @@ public class ImportHelper {
|
|||
{
|
||||
// Referenced Export Format
|
||||
//get from cache
|
||||
MEXPFormat referencedExpFormat = MEXPFormat.get(ctx, line.getEXP_EmbeddedFormat_ID(), trxName);
|
||||
MEXPFormat referencedExpFormat = MEXPFormat.get(ctx, line.getEXP_EmbeddedFormat_ID(), po.get_TrxName());
|
||||
log.info("referencedExpFormat = " + referencedExpFormat);
|
||||
|
||||
int refRecord_ID = 0;
|
||||
|
@ -329,7 +320,7 @@ public class ImportHelper {
|
|||
log.info("referencedNode = " + referencedNode);
|
||||
if(referencedNode!=null)
|
||||
{
|
||||
refRecord_ID = getID(ctx, referencedExpFormat, referencedNode, line.getValue(), trxName);
|
||||
refRecord_ID = getID(ctx, referencedExpFormat, referencedNode, line.getValue(), po.get_TrxName());
|
||||
log.info("refRecord_ID = " + refRecord_ID);
|
||||
value = new Integer(refRecord_ID);
|
||||
}
|
||||
|
@ -349,7 +340,7 @@ public class ImportHelper {
|
|||
|
||||
// Embedded Export Format It is used for Parent-Son records like Order&OrderLine
|
||||
//get from cache
|
||||
MEXPFormat referencedExpFormat = MEXPFormat.get(ctx, line.getEXP_EmbeddedFormat_ID(), trxName);
|
||||
MEXPFormat referencedExpFormat = MEXPFormat.get(ctx, line.getEXP_EmbeddedFormat_ID(), po.get_TrxName());
|
||||
log.info("embeddedExpFormat = " + referencedExpFormat);
|
||||
|
||||
NodeList nodeList = XMLHelper.getNodeList("/"+rootElement.getNodeName() + "/" + line.getValue(), rootElement);
|
||||
|
@ -361,7 +352,7 @@ public class ImportHelper {
|
|||
PO embeddedPo = null;
|
||||
// Import embedded PO
|
||||
log.info("=== BEGIN RECURSION CALL ===");
|
||||
embeddedPo = importElement(ctx, result, referencedElement, referencedExpFormat,ReplicationType, trxName);
|
||||
embeddedPo = importElement(ctx, result, referencedElement, referencedExpFormat,ReplicationType, po.get_TrxName());
|
||||
log.info("embeddedPo = " + embeddedPo);
|
||||
embeddedPo.saveReplica(true);
|
||||
result.append(" Embedded Save Successful ; ");
|
||||
|
@ -394,15 +385,16 @@ public class ImportHelper {
|
|||
*/
|
||||
private void setReplicaValues(Object value,MEXPFormatLine line,PO po,StringBuffer result)throws Exception
|
||||
{
|
||||
MColumn column = MColumn.get(ctx, line.getAD_Column_ID());
|
||||
log.info("column=[" + column + "]");
|
||||
|
||||
if (value !=null)
|
||||
{
|
||||
if (!MEXPFormatLine.TYPE_EmbeddedEXPFormat.equals(line.getType()) )
|
||||
{
|
||||
MColumn column = MColumn.get(ctx, line.getAD_Column_ID());
|
||||
log.info("column=[" + column + "]");
|
||||
|
||||
// Clazz
|
||||
Class clazz = DisplayType.getClass(column.getAD_Reference_ID(), true);
|
||||
Class<?> clazz = DisplayType.getClass(column.getAD_Reference_ID(), true);
|
||||
|
||||
// Handle Posted
|
||||
if (column.getColumnName().equalsIgnoreCase("Posted")
|
||||
|
@ -481,7 +473,11 @@ public class ImportHelper {
|
|||
}
|
||||
else if(DisplayType.YesNo == column.getAD_Reference_ID())
|
||||
{
|
||||
po.set_ValueOfColumn(line.getAD_Column_ID(), value);
|
||||
if(clazz == Boolean.class)
|
||||
{
|
||||
String v = value.toString().equals("true") ? "Y" : "N";
|
||||
po.set_ValueOfColumn(line.getAD_Column_ID(), v);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -491,7 +487,8 @@ public class ImportHelper {
|
|||
|
||||
if(clazz == Boolean.class)
|
||||
{
|
||||
po.set_ValueOfColumn(line.getAD_Column_ID(), value);
|
||||
String v = value.toString().equals("true") ? "Y" : "N";
|
||||
po.set_ValueOfColumn(line.getAD_Column_ID(), v);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -519,7 +516,7 @@ public class ImportHelper {
|
|||
{
|
||||
final String whereClause = I_AD_Client.COLUMNNAME_Value + "= ? ";
|
||||
MClient result = new Query(ctx,I_AD_Client.Table_Name,whereClause,trxName)
|
||||
.setParameters(new Object[]{value})
|
||||
.setParameters(value)
|
||||
.firstOnly();
|
||||
|
||||
s_log.info("Client_Value =[" + value + "]");
|
||||
|
@ -565,6 +562,7 @@ public class ImportHelper {
|
|||
throw new AdempiereException(Msg.getMsg(ctx, "EXPFormatLineNoUniqueColumns"));
|
||||
}
|
||||
|
||||
int replication_id = 0;
|
||||
Object[] cols = new Object[uniqueFormatLines.size()];
|
||||
Object[] params = new Object[uniqueFormatLines.size()];
|
||||
StringBuffer whereClause= new StringBuffer("");
|
||||
|
@ -634,6 +632,10 @@ public class ImportHelper {
|
|||
{
|
||||
//double doubleValue = Double.parseDouble(value.toString());
|
||||
value = new Integer(value.toString());
|
||||
if (DisplayType.ID == column.getAD_Reference_ID())
|
||||
{
|
||||
replication_id = (Integer) value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -671,7 +673,14 @@ public class ImportHelper {
|
|||
|
||||
if(values.size()<=0)//Means that is a new record
|
||||
{
|
||||
return MTable.get(ctx, expFormat.getAD_Table_ID()).getPO(0,trxName);
|
||||
PO po = po = MTable.get(ctx, expFormat.getAD_Table_ID()).getPO(0,trxName);
|
||||
|
||||
if (replication_id > 0 )
|
||||
{
|
||||
po.set_CustomColumn(po.get_KeyColumns()[0], replication_id);
|
||||
}
|
||||
|
||||
return po;
|
||||
}
|
||||
|
||||
return values.get(0);//Return the first (unique) record.
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.logging.Level;
|
|||
import org.adempiere.exceptions.DBException;
|
||||
import org.compiere.model.MAccount;
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MConversionRate;
|
||||
import org.compiere.model.MDocType;
|
||||
import org.compiere.model.MNote;
|
||||
|
@ -358,6 +357,9 @@ public abstract class Doc
|
|||
/** Log per Document */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
/* If the transaction must be managed locally (false if it's managed externally by the caller) */
|
||||
private boolean m_manageLocalTrx;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Constructor
|
||||
|
@ -396,8 +398,11 @@ public abstract class Doc
|
|||
// Document Type
|
||||
setDocumentType (defaultDocumentType);
|
||||
m_trxName = trxName;
|
||||
if (m_trxName == null)
|
||||
m_manageLocalTrx = false;
|
||||
if (m_trxName == null) {
|
||||
m_trxName = "Post" + m_DocumentType + p_po.get_ID();
|
||||
m_manageLocalTrx = true;
|
||||
}
|
||||
p_po.set_TrxName(m_trxName);
|
||||
|
||||
// Amounts
|
||||
|
@ -551,7 +556,7 @@ public abstract class Doc
|
|||
|
||||
// Lock Record ----
|
||||
String trxName = null; // outside trx if on server
|
||||
if (MClient.isClientAccounting())
|
||||
if (! m_manageLocalTrx)
|
||||
trxName = getTrxName(); // on trx if it's in client
|
||||
StringBuffer sql = new StringBuffer ("UPDATE ");
|
||||
sql.append(get_TableName()).append( " SET Processing='Y' WHERE ")
|
||||
|
@ -830,8 +835,10 @@ public abstract class Doc
|
|||
else
|
||||
{
|
||||
log.log(Level.SEVERE, "(fact not saved) ... rolling back");
|
||||
trx.rollback();
|
||||
trx.close();
|
||||
if (m_manageLocalTrx) {
|
||||
trx.rollback();
|
||||
trx.close();
|
||||
}
|
||||
unlock();
|
||||
return STATUS_Error;
|
||||
}
|
||||
|
@ -841,30 +848,36 @@ public abstract class Doc
|
|||
if (!save(getTrxName())) // contains unlock & document status update
|
||||
{
|
||||
log.log(Level.SEVERE, "(doc not saved) ... rolling back");
|
||||
trx.rollback();
|
||||
trx.close();
|
||||
if (m_manageLocalTrx) {
|
||||
trx.rollback();
|
||||
trx.close();
|
||||
}
|
||||
unlock();
|
||||
return STATUS_Error;
|
||||
}
|
||||
// Success
|
||||
trx.commit(true);
|
||||
trx.close();
|
||||
trx = null;
|
||||
if (m_manageLocalTrx) {
|
||||
trx.commit(true);
|
||||
trx.close();
|
||||
trx = null;
|
||||
}
|
||||
// *** Transaction End ***
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "... rolling back", e);
|
||||
status = STATUS_Error;
|
||||
try {
|
||||
if (trx != null)
|
||||
trx.rollback();
|
||||
} catch (Exception e2) {}
|
||||
try {
|
||||
if (trx != null)
|
||||
trx.close();
|
||||
trx = null;
|
||||
} catch (Exception e3) {}
|
||||
if (m_manageLocalTrx) {
|
||||
try {
|
||||
if (trx != null)
|
||||
trx.rollback();
|
||||
} catch (Exception e2) {}
|
||||
try {
|
||||
if (trx != null)
|
||||
trx.close();
|
||||
trx = null;
|
||||
} catch (Exception e3) {}
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
p_Status = status;
|
||||
|
@ -886,7 +899,7 @@ public abstract class Doc
|
|||
private void unlock()
|
||||
{
|
||||
String trxName = null; // outside trx if on server
|
||||
if (MClient.isClientAccounting())
|
||||
if (! m_manageLocalTrx)
|
||||
trxName = getTrxName(); // on trx if it's in client
|
||||
StringBuffer sql = new StringBuffer ("UPDATE ");
|
||||
sql.append(get_TableName()).append( " SET Processing='N' WHERE ")
|
||||
|
@ -2013,6 +2026,38 @@ public abstract class Doc
|
|||
return 0;
|
||||
} // getC_Project_ID
|
||||
|
||||
/**
|
||||
* Get C_ProjectPhase_ID
|
||||
* @return Project Phase
|
||||
*/
|
||||
public int getC_ProjectPhase_ID()
|
||||
{
|
||||
int index = p_po.get_ColumnIndex("C_ProjectPhase_ID");
|
||||
if (index != -1)
|
||||
{
|
||||
Integer ii = (Integer)p_po.get_Value(index);
|
||||
if (ii != null)
|
||||
return ii.intValue();
|
||||
}
|
||||
return 0;
|
||||
} // getC_ProjectPhase_ID
|
||||
|
||||
/**
|
||||
* Get C_ProjectTask_ID
|
||||
* @return Project Task
|
||||
*/
|
||||
public int getC_ProjectTask_ID()
|
||||
{
|
||||
int index = p_po.get_ColumnIndex("C_ProjectTask_ID");
|
||||
if (index != -1)
|
||||
{
|
||||
Integer ii = (Integer)p_po.get_Value(index);
|
||||
if (ii != null)
|
||||
return ii.intValue();
|
||||
}
|
||||
return 0;
|
||||
} // getC_ProjectTask_ID
|
||||
|
||||
/**
|
||||
* Get C_SalesRegion_ID
|
||||
* @return Sales Region
|
||||
|
|
|
@ -983,6 +983,38 @@ public class DocLine
|
|||
return 0;
|
||||
} // getC_Project_ID
|
||||
|
||||
/**
|
||||
* Get Project Phase
|
||||
* @return C_ProjectPhase_ID
|
||||
*/
|
||||
public int getC_ProjectPhase_ID()
|
||||
{
|
||||
int index = p_po.get_ColumnIndex("C_ProjectPhase_ID");
|
||||
if (index != -1)
|
||||
{
|
||||
Integer ii = (Integer)p_po.get_Value(index);
|
||||
if (ii != null)
|
||||
return ii.intValue();
|
||||
}
|
||||
return 0;
|
||||
} // getC_ProjectPhase_ID
|
||||
|
||||
/**
|
||||
* Get Project Task
|
||||
* @return C_ProjectTask_ID
|
||||
*/
|
||||
public int getC_ProjectTask_ID()
|
||||
{
|
||||
int index = p_po.get_ColumnIndex("C_ProjectTask_ID");
|
||||
if (index != -1)
|
||||
{
|
||||
Integer ii = (Integer)p_po.get_Value(index);
|
||||
if (ii != null)
|
||||
return ii.intValue();
|
||||
}
|
||||
return 0;
|
||||
} // getC_ProjectTask_ID
|
||||
|
||||
/**
|
||||
* Get Campaign
|
||||
* @return C_Campaign_ID
|
||||
|
|
|
@ -216,6 +216,8 @@ public class Doc_MatchInv extends Doc
|
|||
pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
|
||||
pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
|
||||
pv.setC_Project_ID(m_invoiceLine.getC_Project_ID());
|
||||
pv.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID());
|
||||
pv.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID());
|
||||
pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
|
||||
pv.setUser1_ID(m_invoiceLine.getUser1_ID());
|
||||
pv.setUser2_ID(m_invoiceLine.getUser2_ID());
|
||||
|
@ -251,6 +253,8 @@ public class Doc_MatchInv extends Doc
|
|||
cr.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
|
||||
cr.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
|
||||
cr.setC_Project_ID(m_invoiceLine.getC_Project_ID());
|
||||
cr.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID());
|
||||
cr.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID());
|
||||
cr.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
|
||||
cr.setUser1_ID(m_invoiceLine.getUser1_ID());
|
||||
cr.setUser2_ID(m_invoiceLine.getUser2_ID());
|
||||
|
@ -293,6 +297,8 @@ public class Doc_MatchInv extends Doc
|
|||
pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
|
||||
pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
|
||||
pv.setC_Project_ID(m_invoiceLine.getC_Project_ID());
|
||||
pv.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID());
|
||||
pv.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID());
|
||||
pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
|
||||
pv.setUser1_ID(m_invoiceLine.getUser1_ID());
|
||||
pv.setUser2_ID(m_invoiceLine.getUser2_ID());
|
||||
|
|
|
@ -204,6 +204,8 @@ public class Doc_MatchPO extends Doc
|
|||
cr.setC_Activity_ID(m_oLine.getC_Activity_ID());
|
||||
cr.setC_Campaign_ID(m_oLine.getC_Campaign_ID());
|
||||
cr.setC_Project_ID(m_oLine.getC_Project_ID());
|
||||
cr.setC_ProjectPhase_ID(m_oLine.getC_ProjectPhase_ID());
|
||||
cr.setC_ProjectTask_ID(m_oLine.getC_ProjectTask_ID());
|
||||
cr.setC_UOM_ID(m_oLine.getC_UOM_ID());
|
||||
cr.setUser1_ID(m_oLine.getUser1_ID());
|
||||
cr.setUser2_ID(m_oLine.getUser2_ID());
|
||||
|
@ -220,6 +222,8 @@ public class Doc_MatchPO extends Doc
|
|||
dr.setC_Activity_ID(m_oLine.getC_Activity_ID());
|
||||
dr.setC_Campaign_ID(m_oLine.getC_Campaign_ID());
|
||||
dr.setC_Project_ID(m_oLine.getC_Project_ID());
|
||||
dr.setC_ProjectPhase_ID(m_oLine.getC_ProjectPhase_ID());
|
||||
dr.setC_ProjectTask_ID(m_oLine.getC_ProjectTask_ID());
|
||||
dr.setC_UOM_ID(m_oLine.getC_UOM_ID());
|
||||
dr.setUser1_ID(m_oLine.getUser1_ID());
|
||||
dr.setUser2_ID(m_oLine.getUser2_ID());
|
||||
|
|
|
@ -394,6 +394,14 @@ public final class FactLine extends X_Fact_Acct
|
|||
setC_Project_ID (m_docLine.getC_Project_ID());
|
||||
if (getC_Project_ID() == 0)
|
||||
setC_Project_ID (m_doc.getC_Project_ID());
|
||||
if (m_docLine != null)
|
||||
setC_ProjectPhase_ID(m_docLine.getC_ProjectPhase_ID());
|
||||
if (getC_ProjectPhase_ID() == 0)
|
||||
setC_ProjectPhase_ID (m_doc.getC_ProjectPhase_ID());
|
||||
if (m_docLine != null)
|
||||
setC_ProjectTask_ID(m_docLine.getC_ProjectTask_ID());
|
||||
if (getC_ProjectTask_ID() == 0)
|
||||
setC_ProjectTask_ID (m_doc.getC_ProjectTask_ID());
|
||||
// Campaign
|
||||
if (m_docLine != null)
|
||||
setC_Campaign_ID (m_docLine.getC_Campaign_ID());
|
||||
|
@ -1092,6 +1100,8 @@ public final class FactLine extends X_Fact_Acct
|
|||
// Dimensions
|
||||
setAD_OrgTrx_ID(fact.getAD_OrgTrx_ID());
|
||||
setC_Project_ID (fact.getC_Project_ID());
|
||||
setC_ProjectPhase_ID(fact.getC_ProjectPhase_ID());
|
||||
setC_ProjectTask_ID(fact.getC_ProjectTask_ID());
|
||||
setC_Activity_ID(fact.getC_Activity_ID());
|
||||
setC_Campaign_ID(fact.getC_Campaign_ID());
|
||||
setC_SalesRegion_ID(fact.getC_SalesRegion_ID());
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2010 Low Heng Sin *
|
||||
* Copyright (C) 2010 Idalica Corporation *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface AdempiereProcessor2 {
|
||||
/**
|
||||
* @return true if previous DateNextRun should be use as base to calculate the new
|
||||
* DateNextRun value. False to follow the legacy behaviour where current
|
||||
* server time is use as the base to the new DateNextRun value.
|
||||
*/
|
||||
public boolean isIgnoreProcessingTime();
|
||||
}
|
|
@ -633,12 +633,16 @@ public class CalloutOrder extends CalloutEngine
|
|||
+ "WHERE pl.C_Currency_ID=c.C_Currency_ID"
|
||||
+ " AND pl.M_PriceList_ID=plv.M_PriceList_ID"
|
||||
+ " AND pl.M_PriceList_ID=? " // 1
|
||||
+ " AND plv.ValidFrom <= ? "
|
||||
+ "ORDER BY plv.ValidFrom DESC";
|
||||
// Use newest price list - may not be future
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, M_PriceList_ID.intValue());
|
||||
Timestamp date = Env.getContextAsDate(ctx, WindowNo, "DateOrdered");
|
||||
pstmt.setTimestamp(2, date);
|
||||
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
|
@ -706,10 +710,25 @@ public class CalloutOrder extends CalloutEngine
|
|||
//
|
||||
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||
Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
|
||||
/** PLV is only accurate if PL selected in header */
|
||||
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
||||
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
|
||||
{
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
String sql = "SELECT plv.M_PriceList_Version_ID "
|
||||
+ "FROM M_PriceList_Version plv "
|
||||
+ "WHERE plv.M_PriceList_ID=? " // 1
|
||||
+ " AND plv.ValidFrom <= ? "
|
||||
+ "ORDER BY plv.ValidFrom DESC";
|
||||
// Use newest price list - may not be future
|
||||
|
||||
M_PriceList_Version_ID = DB.getSQLValueEx(null, sql, M_PriceList_ID, orderDate);
|
||||
if ( M_PriceList_Version_ID > 0 )
|
||||
Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID );
|
||||
}
|
||||
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
||||
Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
|
||||
pp.setPriceDate(orderDate);
|
||||
//
|
||||
mTab.setValue("PriceList", pp.getPriceList());
|
||||
|
|
|
@ -323,21 +323,16 @@ public class GridField
|
|||
return false;
|
||||
|
||||
// Numeric Keys and Created/Updated as well as
|
||||
// DocumentNo/Value/ASI are not mandatory (persistence layer manages them)
|
||||
if (m_vo.ColumnName.equals("DocumentNo") && m_vo.AD_Column_ID == 53251){
|
||||
// TODO - Find why Report Parameter marked as Mandatory is not displayed as Mandatory?
|
||||
// Find better solution?
|
||||
// https://sourceforge.net/tracker/?func=detail&aid=2902292&group_id=176962&atid=879334
|
||||
// https://sourceforge.net/tracker/?func=detail&aid=2897730&group_id=176962&atid=879332
|
||||
return true;
|
||||
} else if ((m_vo.IsKey && m_vo.ColumnName.endsWith("_ID"))
|
||||
// DocumentNo/Value/ASI ars not mandatory (persistency layer manages them)
|
||||
if (m_gridTab != null && // if gridtab doesn't exist then it's not a window field (probably a process parameter field)
|
||||
( (m_vo.IsKey && m_vo.ColumnName.endsWith("_ID"))
|
||||
|| m_vo.ColumnName.startsWith("Created") || m_vo.ColumnName.startsWith("Updated")
|
||||
|| m_vo.ColumnName.equals("Value")
|
||||
|| m_vo.ColumnName.equals("DocumentNo")
|
||||
|| m_vo.ColumnName.equals("M_AttributeSetInstance_ID")) // 0 is valid
|
||||
{
|
||||
|| m_vo.ColumnName.equals("M_AttributeSetInstance_ID") // 0 is valid
|
||||
)
|
||||
)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mandatory if displayed
|
||||
return isDisplayed (checkContext);
|
||||
|
@ -1286,6 +1281,19 @@ public class GridField
|
|||
m_inserting = inserting;
|
||||
m_error = false; // reset error
|
||||
|
||||
updateContext();
|
||||
|
||||
// Does not fire, if same value
|
||||
Object oldValue = m_oldValue;
|
||||
if (inserting)
|
||||
oldValue = INSERTING;
|
||||
m_propertyChangeListeners.firePropertyChange(PROPERTY, oldValue, m_value);
|
||||
} // setValue
|
||||
|
||||
/**
|
||||
* Update env. context with current value
|
||||
*/
|
||||
public void updateContext() {
|
||||
// Set Context
|
||||
if (m_vo.displayType == DisplayType.Text
|
||||
|| m_vo.displayType == DisplayType.Memo
|
||||
|
@ -1294,15 +1302,15 @@ public class GridField
|
|||
|| m_vo.displayType == DisplayType.RowID
|
||||
|| isEncrypted())
|
||||
; // ignore
|
||||
else if (newValue instanceof Boolean)
|
||||
else if (m_value instanceof Boolean)
|
||||
{
|
||||
backupValue(); // teo_sarca [ 1699826 ]
|
||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
||||
((Boolean)newValue).booleanValue());
|
||||
((Boolean)m_value).booleanValue());
|
||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName,
|
||||
m_value==null ? null : (((Boolean)m_value) ? "Y" : "N"));
|
||||
}
|
||||
else if (newValue instanceof Timestamp)
|
||||
else if (m_value instanceof Timestamp)
|
||||
{
|
||||
backupValue(); // teo_sarca [ 1699826 ]
|
||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, (Timestamp)m_value);
|
||||
|
@ -1317,13 +1325,7 @@ public class GridField
|
|||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName,
|
||||
m_value==null ? null : m_value.toString());
|
||||
}
|
||||
|
||||
// Does not fire, if same value
|
||||
Object oldValue = m_oldValue;
|
||||
if (inserting)
|
||||
oldValue = INSERTING;
|
||||
m_propertyChangeListeners.firePropertyChange(PROPERTY, oldValue, m_value);
|
||||
} // setValue
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Value and Validate
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.MSort;
|
||||
import org.compiere.util.SecureEngine;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
|
||||
/**
|
||||
|
@ -3201,6 +3202,7 @@ private Object[] getDataAtRow(int row)
|
|||
|
||||
private PreparedStatement m_pstmt = null;
|
||||
private ResultSet m_rs = null;
|
||||
private Trx trx = null;
|
||||
|
||||
/**
|
||||
* Open ResultSet
|
||||
|
@ -3240,17 +3242,22 @@ private Object[] getDataAtRow(int row)
|
|||
if (rows == 0)
|
||||
info.append(" - ").append(m_SQL_Count);
|
||||
|
||||
//postgresql need trx to use cursor based resultset
|
||||
String trxName = m_virtual ? Trx.createTrxName("Loader") : null;
|
||||
trx = trxName != null ? Trx.get(trxName, true) : null;
|
||||
// open Statement (closed by Loader.close)
|
||||
try
|
||||
{
|
||||
m_pstmt = DB.prepareStatement(m_SQL, null);
|
||||
m_pstmt = DB.prepareStatement(m_SQL, trxName);
|
||||
if (maxRows > 0 && rows > maxRows)
|
||||
{
|
||||
m_pstmt.setMaxRows(maxRows);
|
||||
info.append(" - MaxRows=").append(maxRows);
|
||||
rows = maxRows;
|
||||
}
|
||||
// m_pstmt.setFetchSize(20);
|
||||
//ensure not all row is fectch into memory for virtual table
|
||||
if (m_virtual)
|
||||
m_pstmt.setFetchSize(100);
|
||||
setParameter (m_pstmt, false);
|
||||
m_rs = m_pstmt.executeQuery();
|
||||
}
|
||||
|
@ -3272,6 +3279,8 @@ private Object[] getDataAtRow(int row)
|
|||
DB.close(m_rs, m_pstmt);
|
||||
m_rs = null;
|
||||
m_pstmt = null;
|
||||
if (trx != null)
|
||||
trx.close();
|
||||
} // close
|
||||
|
||||
/**
|
||||
|
@ -3335,7 +3344,10 @@ private Object[] getDataAtRow(int row)
|
|||
{
|
||||
log.log(Level.SEVERE, "run", e);
|
||||
}
|
||||
close();
|
||||
finally
|
||||
{
|
||||
close();
|
||||
}
|
||||
fireDataStatusIEvent("", "");
|
||||
} // run
|
||||
|
||||
|
|
|
@ -106,6 +106,19 @@ public interface I_AD_Scheduler
|
|||
*/
|
||||
public int getCreatedBy();
|
||||
|
||||
/** Column name CronPattern */
|
||||
public static final String COLUMNNAME_CronPattern = "CronPattern";
|
||||
|
||||
/** Set Cron Scheduling Pattern.
|
||||
* Cron pattern to define when the process should be invoked.
|
||||
*/
|
||||
public void setCronPattern (String CronPattern);
|
||||
|
||||
/** Get Cron Scheduling Pattern.
|
||||
* Cron pattern to define when the process should be invoked.
|
||||
*/
|
||||
public String getCronPattern();
|
||||
|
||||
/** Column name DateLastRun */
|
||||
public static final String COLUMNNAME_DateLastRun = "DateLastRun";
|
||||
|
||||
|
@ -184,6 +197,19 @@ public interface I_AD_Scheduler
|
|||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name IsIgnoreProcessingTime */
|
||||
public static final String COLUMNNAME_IsIgnoreProcessingTime = "IsIgnoreProcessingTime";
|
||||
|
||||
/** Set Ignore Processing Time.
|
||||
* Do not include processing time for the DateNextRun calculation
|
||||
*/
|
||||
public void setIsIgnoreProcessingTime (boolean IsIgnoreProcessingTime);
|
||||
|
||||
/** Get Ignore Processing Time.
|
||||
* Do not include processing time for the DateNextRun calculation
|
||||
*/
|
||||
public boolean isIgnoreProcessingTime();
|
||||
|
||||
/** Column name KeepLogDays */
|
||||
public static final String COLUMNNAME_KeepLogDays = "KeepLogDays";
|
||||
|
||||
|
|
|
@ -526,6 +526,21 @@ public interface I_C_AcctSchema_Default
|
|||
|
||||
public I_C_ValidCombination getP_Asset_A() throws RuntimeException;
|
||||
|
||||
/** Column name P_AverageCostVariance_Acct */
|
||||
public static final String COLUMNNAME_P_AverageCostVariance_Acct = "P_AverageCostVariance_Acct";
|
||||
|
||||
/** Set Average Cost Variance.
|
||||
* Average Cost Variance
|
||||
*/
|
||||
public void setP_AverageCostVariance_Acct (int P_AverageCostVariance_Acct);
|
||||
|
||||
/** Get Average Cost Variance.
|
||||
* Average Cost Variance
|
||||
*/
|
||||
public int getP_AverageCostVariance_Acct();
|
||||
|
||||
public I_C_ValidCombination getP_AverageCostVariance_A() throws RuntimeException;
|
||||
|
||||
/** Column name PayDiscount_Exp_Acct */
|
||||
public static final String COLUMNNAME_PayDiscount_Exp_Acct = "PayDiscount_Exp_Acct";
|
||||
|
||||
|
@ -1095,12 +1110,12 @@ public interface I_C_AcctSchema_Default
|
|||
public static final String COLUMNNAME_V_Liability_Services_Acct = "V_Liability_Services_Acct";
|
||||
|
||||
/** Set Vendor Service Liability.
|
||||
* Account for Vender Service Liability
|
||||
* Account for Vendor Service Liability
|
||||
*/
|
||||
public void setV_Liability_Services_Acct (int V_Liability_Services_Acct);
|
||||
|
||||
/** Get Vendor Service Liability.
|
||||
* Account for Vender Service Liability
|
||||
* Account for Vendor Service Liability
|
||||
*/
|
||||
public int getV_Liability_Services_Acct();
|
||||
|
||||
|
|
|
@ -262,6 +262,19 @@ public interface I_C_AllocationHdr
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -297,6 +297,19 @@ public interface I_C_BankStatement
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -307,6 +307,19 @@ public interface I_C_Cash
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -486,10 +486,10 @@ public interface I_C_Invoice
|
|||
/** Column name DunningGrace */
|
||||
public static final String COLUMNNAME_DunningGrace = "DunningGrace";
|
||||
|
||||
/** Set Dunning Grace */
|
||||
/** Set Dunning Grace Date */
|
||||
public void setDunningGrace (Timestamp DunningGrace);
|
||||
|
||||
/** Get Dunning Grace */
|
||||
/** Get Dunning Grace Date */
|
||||
public Timestamp getDunningGrace();
|
||||
|
||||
/** Column name GenerateTo */
|
||||
|
@ -756,6 +756,19 @@ public interface I_C_Invoice
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -895,10 +895,14 @@ public interface I_C_Order
|
|||
/** Column name OrderType */
|
||||
public static final String COLUMNNAME_OrderType = "OrderType";
|
||||
|
||||
/** Set OrderType */
|
||||
/** Set Order Type.
|
||||
* Type of Order: MRP records grouped by source (Sales Order, Purchase Order, Distribution Order, Requisition)
|
||||
*/
|
||||
public void setOrderType (String OrderType);
|
||||
|
||||
/** Get OrderType */
|
||||
/** Get Order Type.
|
||||
* Type of Order: MRP records grouped by source (Sales Order, Purchase Order, Distribution Order, Requisition)
|
||||
*/
|
||||
public String getOrderType();
|
||||
|
||||
/** Column name Pay_BPartner_ID */
|
||||
|
@ -992,6 +996,19 @@ public interface I_C_Order
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -860,6 +860,19 @@ public interface I_C_Payment
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -257,6 +257,19 @@ public interface I_C_ProjectIssue
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -393,6 +393,19 @@ public interface I_GL_Journal
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -62,19 +62,6 @@ public interface I_I_ReportLine
|
|||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name AmountType */
|
||||
public static final String COLUMNNAME_AmountType = "AmountType";
|
||||
|
||||
/** Set Amount Type.
|
||||
* Type of amount to report
|
||||
*/
|
||||
public void setAmountType (String AmountType);
|
||||
|
||||
/** Get Amount Type.
|
||||
* Type of amount to report
|
||||
*/
|
||||
public String getAmountType();
|
||||
|
||||
/** Column name CalculationType */
|
||||
public static final String COLUMNNAME_CalculationType = "CalculationType";
|
||||
|
||||
|
@ -241,6 +228,32 @@ public interface I_I_ReportLine
|
|||
*/
|
||||
public String getName();
|
||||
|
||||
/** Column name PAAmountType */
|
||||
public static final String COLUMNNAME_PAAmountType = "PAAmountType";
|
||||
|
||||
/** Set Amount Type.
|
||||
* PA Amount Type for reporting
|
||||
*/
|
||||
public void setPAAmountType (String PAAmountType);
|
||||
|
||||
/** Get Amount Type.
|
||||
* PA Amount Type for reporting
|
||||
*/
|
||||
public String getPAAmountType();
|
||||
|
||||
/** Column name PAPeriodType */
|
||||
public static final String COLUMNNAME_PAPeriodType = "PAPeriodType";
|
||||
|
||||
/** Set Period Type.
|
||||
* PA Period Type
|
||||
*/
|
||||
public void setPAPeriodType (String PAPeriodType);
|
||||
|
||||
/** Get Period Type.
|
||||
* PA Period Type
|
||||
*/
|
||||
public String getPAPeriodType();
|
||||
|
||||
/** Column name PA_ReportLine_ID */
|
||||
public static final String COLUMNNAME_PA_ReportLine_ID = "PA_ReportLine_ID";
|
||||
|
||||
|
|
|
@ -752,6 +752,19 @@ public interface I_M_InOut
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -337,6 +337,19 @@ public interface I_M_Inventory
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -242,6 +242,19 @@ public interface I_M_MatchInv
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -283,6 +283,19 @@ public interface I_M_MatchPO
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -510,6 +510,19 @@ public interface I_M_Movement
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -136,6 +136,21 @@ public interface I_M_Product_Acct
|
|||
|
||||
public I_C_ValidCombination getP_Asset_A() throws RuntimeException;
|
||||
|
||||
/** Column name P_AverageCostVariance_Acct */
|
||||
public static final String COLUMNNAME_P_AverageCostVariance_Acct = "P_AverageCostVariance_Acct";
|
||||
|
||||
/** Set Average Cost Variance.
|
||||
* Average Cost Variance
|
||||
*/
|
||||
public void setP_AverageCostVariance_Acct (int P_AverageCostVariance_Acct);
|
||||
|
||||
/** Get Average Cost Variance.
|
||||
* Average Cost Variance
|
||||
*/
|
||||
public int getP_AverageCostVariance_Acct();
|
||||
|
||||
public I_C_ValidCombination getP_AverageCostVariance_A() throws RuntimeException;
|
||||
|
||||
/** Column name P_Burden_Acct */
|
||||
public static final String COLUMNNAME_P_Burden_Acct = "P_Burden_Acct";
|
||||
|
||||
|
|
|
@ -162,6 +162,21 @@ public interface I_M_Product_Category_Acct
|
|||
|
||||
public I_C_ValidCombination getP_Asset_A() throws RuntimeException;
|
||||
|
||||
/** Column name P_AverageCostVariance_Acct */
|
||||
public static final String COLUMNNAME_P_AverageCostVariance_Acct = "P_AverageCostVariance_Acct";
|
||||
|
||||
/** Set Average Cost Variance.
|
||||
* Average Cost Variance
|
||||
*/
|
||||
public void setP_AverageCostVariance_Acct (int P_AverageCostVariance_Acct);
|
||||
|
||||
/** Get Average Cost Variance.
|
||||
* Average Cost Variance
|
||||
*/
|
||||
public int getP_AverageCostVariance_Acct();
|
||||
|
||||
public I_C_ValidCombination getP_AverageCostVariance_A() throws RuntimeException;
|
||||
|
||||
/** Column name P_Burden_Acct */
|
||||
public static final String COLUMNNAME_P_Burden_Acct = "P_Burden_Acct";
|
||||
|
||||
|
|
|
@ -236,6 +236,19 @@ public interface I_M_Production
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -307,6 +307,19 @@ public interface I_M_Requisition
|
|||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name ProcessedOn */
|
||||
public static final String COLUMNNAME_ProcessedOn = "ProcessedOn";
|
||||
|
||||
/** Set Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public void setProcessedOn (BigDecimal ProcessedOn);
|
||||
|
||||
/** Get Processed On.
|
||||
* The date+time (expressed in decimal format) when the document has been processed
|
||||
*/
|
||||
public BigDecimal getProcessedOn();
|
||||
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
|
|
|
@ -75,19 +75,6 @@ public interface I_PA_ReportColumn
|
|||
*/
|
||||
public int getAD_OrgTrx_ID();
|
||||
|
||||
/** Column name AmountType */
|
||||
public static final String COLUMNNAME_AmountType = "AmountType";
|
||||
|
||||
/** Set Amount Type.
|
||||
* Type of amount to report
|
||||
*/
|
||||
public void setAmountType (String AmountType);
|
||||
|
||||
/** Get Amount Type.
|
||||
* Type of amount to report
|
||||
*/
|
||||
public String getAmountType();
|
||||
|
||||
/** Column name C_Activity_ID */
|
||||
public static final String COLUMNNAME_C_Activity_ID = "C_Activity_ID";
|
||||
|
||||
|
@ -584,6 +571,32 @@ public interface I_PA_ReportColumn
|
|||
*/
|
||||
public int getOrg_ID();
|
||||
|
||||
/** Column name PAAmountType */
|
||||
public static final String COLUMNNAME_PAAmountType = "PAAmountType";
|
||||
|
||||
/** Set Amount Type.
|
||||
* PA Amount Type for reporting
|
||||
*/
|
||||
public void setPAAmountType (String PAAmountType);
|
||||
|
||||
/** Get Amount Type.
|
||||
* PA Amount Type for reporting
|
||||
*/
|
||||
public String getPAAmountType();
|
||||
|
||||
/** Column name PAPeriodType */
|
||||
public static final String COLUMNNAME_PAPeriodType = "PAPeriodType";
|
||||
|
||||
/** Set Period Type.
|
||||
* PA Period Type
|
||||
*/
|
||||
public void setPAPeriodType (String PAPeriodType);
|
||||
|
||||
/** Get Period Type.
|
||||
* PA Period Type
|
||||
*/
|
||||
public String getPAPeriodType();
|
||||
|
||||
/** Column name PA_ReportColumn_ID */
|
||||
public static final String COLUMNNAME_PA_ReportColumn_ID = "PA_ReportColumn_ID";
|
||||
|
||||
|
|
|
@ -62,19 +62,6 @@ public interface I_PA_ReportLine
|
|||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name AmountType */
|
||||
public static final String COLUMNNAME_AmountType = "AmountType";
|
||||
|
||||
/** Set Amount Type.
|
||||
* Type of amount to report
|
||||
*/
|
||||
public void setAmountType (String AmountType);
|
||||
|
||||
/** Get Amount Type.
|
||||
* Type of amount to report
|
||||
*/
|
||||
public String getAmountType();
|
||||
|
||||
/** Column name CalculationType */
|
||||
public static final String COLUMNNAME_CalculationType = "CalculationType";
|
||||
|
||||
|
@ -206,6 +193,32 @@ public interface I_PA_ReportLine
|
|||
|
||||
public I_PA_ReportLine getOper_2() throws RuntimeException;
|
||||
|
||||
/** Column name PAAmountType */
|
||||
public static final String COLUMNNAME_PAAmountType = "PAAmountType";
|
||||
|
||||
/** Set Amount Type.
|
||||
* PA Amount Type for reporting
|
||||
*/
|
||||
public void setPAAmountType (String PAAmountType);
|
||||
|
||||
/** Get Amount Type.
|
||||
* PA Amount Type for reporting
|
||||
*/
|
||||
public String getPAAmountType();
|
||||
|
||||
/** Column name PAPeriodType */
|
||||
public static final String COLUMNNAME_PAPeriodType = "PAPeriodType";
|
||||
|
||||
/** Set Period Type.
|
||||
* PA Period Type
|
||||
*/
|
||||
public void setPAPeriodType (String PAPeriodType);
|
||||
|
||||
/** Get Period Type.
|
||||
* PA Period Type
|
||||
*/
|
||||
public String getPAPeriodType();
|
||||
|
||||
/** Column name PA_ReportLine_ID */
|
||||
public static final String COLUMNNAME_PA_ReportLine_ID = "PA_ReportLine_ID";
|
||||
|
||||
|
|
|
@ -41,9 +41,7 @@ public class MAccount extends X_C_ValidCombination
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8887316767838767993L;
|
||||
|
||||
|
||||
private static final long serialVersionUID = -1936396369349550834L;
|
||||
|
||||
/**
|
||||
* Get existing Account or create it
|
||||
|
@ -242,9 +240,9 @@ public class MAccount extends X_C_ValidCombination
|
|||
*/
|
||||
public static MAccount get (Properties ctx, int C_AcctSchema_ID, String alias)
|
||||
{
|
||||
String whereClause = "C_AcctSchema_ID=? AND Alias=?";
|
||||
MAccount retValue = new Query(ctx,MAccount.Table_Name,whereClause.toString(),null)
|
||||
.setParameters(new Object[]{C_AcctSchema_ID,alias})
|
||||
final String whereClause = "C_AcctSchema_ID=? AND Alias=?";
|
||||
MAccount retValue = new Query(ctx,I_C_ValidCombination.Table_Name,whereClause,null)
|
||||
.setParameters(C_AcctSchema_ID,alias)
|
||||
.firstOnly();
|
||||
return retValue;
|
||||
} // get
|
||||
|
@ -358,7 +356,7 @@ public class MAccount extends X_C_ValidCombination
|
|||
* @param where where clause
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public static void updateValueDescription (Properties ctx, String where, String trxName)
|
||||
public static void updateValueDescription (Properties ctx, final String where, String trxName)
|
||||
{
|
||||
List<MAccount> accounts= new Query(ctx,MAccount.Table_Name,where,trxName)
|
||||
.setOrderBy(MAccount.COLUMNNAME_C_ValidCombination_ID).list();
|
||||
|
|
|
@ -138,9 +138,9 @@ public final class MAccountLookup extends Lookup implements Serializable
|
|||
if (ID == C_ValidCombination_ID) // already loaded
|
||||
return true;
|
||||
|
||||
String whereClause = "C_ValidCombination_ID=?";
|
||||
MAccount account = new Query(Env.getCtx(),MAccount.Table_Name,whereClause,null)
|
||||
.setParameters(new Object[]{ID})
|
||||
final String whereClause = "C_ValidCombination_ID=?";
|
||||
MAccount account = new Query(Env.getCtx(),I_C_ValidCombination.Table_Name,whereClause,null)
|
||||
.setParameters(ID)
|
||||
.firstOnly();
|
||||
|
||||
if(account == null)
|
||||
|
@ -178,12 +178,12 @@ public final class MAccountLookup extends Lookup implements Serializable
|
|||
list.add(new KeyNamePair (-1, ""));
|
||||
//
|
||||
ArrayList<Object> params = new ArrayList<Object>();
|
||||
String whereClause = "AD_Client_ID=?";
|
||||
final String whereClause = "AD_Client_ID=?";
|
||||
params.add(Env.getAD_Client_ID(m_ctx));
|
||||
|
||||
List<MAccount> accounts = new Query(Env.getCtx(),MAccount.Table_Name,whereClause,null)
|
||||
List<MAccount> accounts = new Query(Env.getCtx(),I_C_ValidCombination.Table_Name,whereClause,null)
|
||||
.setParameters(params)
|
||||
.setOrderBy(MAccount.COLUMNNAME_Combination)
|
||||
.setOrderBy(I_C_ValidCombination.COLUMNNAME_Combination)
|
||||
.setOnlyActiveRecords(onlyActive)
|
||||
.list();
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MAcctProcessor extends X_C_AcctProcessor
|
|||
*/
|
||||
public static MAcctProcessor[] getActive (Properties ctx)
|
||||
{
|
||||
List<MAcctProcessor> list = new Query(ctx, MAcctProcessor.Table_Name, null, null)
|
||||
List<MAcctProcessor> list = new Query(ctx, I_C_AcctProcessor.Table_Name, null, null)
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
return list.toArray(new MAcctProcessor[list.size()]);
|
||||
|
@ -129,8 +129,8 @@ public class MAcctProcessor extends X_C_AcctProcessor
|
|||
public AdempiereProcessorLog[] getLogs ()
|
||||
{
|
||||
String whereClause = "C_AcctProcessor_ID=? ";
|
||||
List<MAcctProcessor> list = new Query(getCtx(), MAcctProcessorLog.Table_Name,whereClause,get_TrxName())
|
||||
.setParameters(new Object[]{getC_AcctProcessor_ID()})
|
||||
List<MAcctProcessor> list = new Query(getCtx(), I_C_AcctProcessorLog.Table_Name,whereClause,get_TrxName())
|
||||
.setParameters(getC_AcctProcessor_ID())
|
||||
.setOrderBy("Created DESC")
|
||||
.list();
|
||||
return list.toArray(new MAcctProcessorLog[list.size()]);
|
||||
|
|
|
@ -115,7 +115,7 @@ public class MAcctSchema extends X_C_AcctSchema
|
|||
params.add(AD_Client_ID);
|
||||
}
|
||||
|
||||
List <MAcctSchema> ass = new Query(ctx, MAcctSchema.Table_Name,whereClause,trxName)
|
||||
List <MAcctSchema> ass = new Query(ctx, I_C_AcctSchema.Table_Name,whereClause,trxName)
|
||||
.setParameters(params)
|
||||
.setOrderBy(MAcctSchema.COLUMNNAME_C_AcctSchema_ID)
|
||||
.list();
|
||||
|
|
|
@ -33,10 +33,12 @@ import org.compiere.util.KeyNamePair;
|
|||
*/
|
||||
public class MAcctSchemaDefault extends X_C_AcctSchema_Default
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 199959007595802866L;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 199959007595802866L;
|
||||
|
||||
/**
|
||||
* Get Accounting Schema Default Info
|
||||
|
@ -46,9 +48,9 @@ public class MAcctSchemaDefault extends X_C_AcctSchema_Default
|
|||
*/
|
||||
public static MAcctSchemaDefault get (Properties ctx, int C_AcctSchema_ID)
|
||||
{
|
||||
String whereClause = "C_AcctSchema_ID=?";
|
||||
return new Query(ctx,MAcctSchemaDefault.Table_Name,whereClause,null)
|
||||
.setParameters(new Object[]{C_AcctSchema_ID})
|
||||
final String whereClause = "C_AcctSchema_ID=?";
|
||||
return new Query(ctx,I_C_AcctSchema_Default.Table_Name,whereClause,null)
|
||||
.setParameters(C_AcctSchema_ID)
|
||||
.firstOnly();
|
||||
} // get
|
||||
|
||||
|
|
|
@ -40,10 +40,12 @@ import org.compiere.util.Msg;
|
|||
*/
|
||||
public final class MAcctSchemaElement extends X_C_AcctSchema_Element
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4215184252533527719L;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4215184252533527719L;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -61,9 +63,10 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element
|
|||
s_log.fine("C_AcctSchema_ID=" + as.getC_AcctSchema_ID());
|
||||
ArrayList<MAcctSchemaElement> list = new ArrayList<MAcctSchemaElement>();
|
||||
|
||||
String whereClause = "C_AcctSchema_ID=? AND IsActive=?";
|
||||
List<MAcctSchemaElement> elements= new Query(as.getCtx(), MAcctSchemaElement.Table_Name,whereClause,as.get_TrxName())
|
||||
.setParameters(new Object[]{as.getC_AcctSchema_ID(),"Y"}).setOrderBy("SeqNo")
|
||||
final String whereClause = "C_AcctSchema_ID=? AND IsActive=?";
|
||||
List<MAcctSchemaElement> elements= new Query(as.getCtx(), I_C_AcctSchema_Element.Table_Name,whereClause,as.get_TrxName())
|
||||
.setParameters(as.getC_AcctSchema_ID(),"Y")
|
||||
.setOrderBy("SeqNo")
|
||||
.list();
|
||||
|
||||
for(MAcctSchemaElement ase : elements)
|
||||
|
|
|
@ -35,10 +35,12 @@ import org.compiere.util.KeyNamePair;
|
|||
*/
|
||||
public class MAcctSchemaGL extends X_C_AcctSchema_GL
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5303102649110271896L;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5303102649110271896L;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -49,9 +51,9 @@ public class MAcctSchemaGL extends X_C_AcctSchema_GL
|
|||
*/
|
||||
public static MAcctSchemaGL get (Properties ctx, int C_AcctSchema_ID)
|
||||
{
|
||||
String whereClause = "C_AcctSchema_ID=?";
|
||||
return new Query(ctx,MAcctSchemaGL.Table_Name,whereClause,null)
|
||||
.setParameters(new Object[]{C_AcctSchema_ID})
|
||||
final String whereClause = "C_AcctSchema_ID=?";
|
||||
return new Query(ctx,I_C_AcctSchema_GL.Table_Name,whereClause,null)
|
||||
.setParameters(C_AcctSchema_ID)
|
||||
.firstOnly();
|
||||
} // get
|
||||
|
||||
|
|
|
@ -33,9 +33,7 @@ import org.compiere.util.Env;
|
|||
*/
|
||||
public class MAchievement extends X_PA_Achievement
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = -1438593600498523664L;
|
||||
|
||||
/**
|
||||
|
@ -56,9 +54,11 @@ public class MAchievement extends X_PA_Achievement
|
|||
*/
|
||||
public static MAchievement[] getOfMeasure (Properties ctx, int PA_Measure_ID)
|
||||
{
|
||||
String whereClause ="PA_Measure_ID=? AND IsAchieved='Y'";
|
||||
List <MAchievement> list = new Query(ctx,MAchievement.Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{PA_Measure_ID}).setOrderBy("SeqNo, DateDoc").list();
|
||||
final String whereClause ="PA_Measure_ID=? AND IsAchieved='Y'";
|
||||
List <MAchievement> list = new Query(ctx,I_PA_Achievement.Table_Name, whereClause, null)
|
||||
.setParameters(PA_Measure_ID)
|
||||
.setOrderBy("SeqNo, DateDoc")
|
||||
.list();
|
||||
|
||||
MAchievement[] retValue = new MAchievement[list.size ()];
|
||||
retValue = list.toArray (retValue);
|
||||
|
|
|
@ -88,9 +88,9 @@ public class MAlert extends X_AD_Alert
|
|||
if (m_rules != null && !reload)
|
||||
return m_rules;
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "AD_Alert_ID=?";
|
||||
List <MAlertRule> list = new Query(getCtx(), MAlertRule.Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{getAD_Alert_ID()})
|
||||
final String whereClause = "AD_Alert_ID=?";
|
||||
List <MAlertRule> list = new Query(getCtx(), I_AD_AlertRule.Table_Name, whereClause, null)
|
||||
.setParameters(getAD_Alert_ID())
|
||||
.setOrderBy("Name, AD_AlertRule_ID")
|
||||
.setOnlyActiveRecords(true)
|
||||
.list()
|
||||
|
@ -115,9 +115,9 @@ public class MAlert extends X_AD_Alert
|
|||
if (m_recipients != null && !reload)
|
||||
return m_recipients;
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "AD_Alert_ID=?";
|
||||
List <MAlertRecipient> list = new Query(getCtx(), MAlertRecipient.Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{getAD_Alert_ID()})
|
||||
final String whereClause = "AD_Alert_ID=?";
|
||||
List <MAlertRecipient> list = new Query(getCtx(), I_AD_AlertRecipient.Table_Name, whereClause, null)
|
||||
.setParameters(getAD_Alert_ID())
|
||||
.setOnlyActiveRecords(true)
|
||||
.list()
|
||||
;
|
||||
|
|
|
@ -16,12 +16,10 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -50,26 +48,9 @@ public class MAlertProcessor extends X_AD_AlertProcessor
|
|||
*/
|
||||
public static MAlertProcessor[] getActive (Properties ctx)
|
||||
{
|
||||
ArrayList<MAlertProcessor> list = new ArrayList<MAlertProcessor>();
|
||||
String sql = "SELECT * FROM AD_AlertProcessor WHERE IsActive='Y'";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MAlertProcessor (ctx, rs, null));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
List <MAlertProcessor> list = new Query(ctx,I_AD_AlertProcessor.Table_Name, null, null)
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
MAlertProcessor[] retValue = new MAlertProcessor[list.size ()];
|
||||
list.toArray (retValue);
|
||||
return retValue;
|
||||
|
@ -131,30 +112,11 @@ public class MAlertProcessor extends X_AD_AlertProcessor
|
|||
*/
|
||||
public AdempiereProcessorLog[] getLogs ()
|
||||
{
|
||||
ArrayList<MAlertProcessorLog> list = new ArrayList<MAlertProcessorLog>();
|
||||
String sql = "SELECT * "
|
||||
+ "FROM AD_AlertProcessorLog "
|
||||
+ "WHERE AD_AlertProcessor_ID=? "
|
||||
+ "ORDER BY Created DESC";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, getAD_AlertProcessor_ID());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MAlertProcessorLog (getCtx(), rs, null));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
final String whereClause ="AD_AlertProcessor_ID=?";
|
||||
List <MAlertProcessorLog> list = new Query(getCtx(), I_AD_AlertProcessorLog.Table_Name, whereClause, null)
|
||||
.setParameters(getAD_AlertProcessor_ID())
|
||||
.setOrderBy("Created DESC")
|
||||
.list();
|
||||
MAlertProcessorLog[] retValue = new MAlertProcessorLog[list.size ()];
|
||||
list.toArray (retValue);
|
||||
return retValue;
|
||||
|
@ -186,28 +148,13 @@ public class MAlertProcessor extends X_AD_AlertProcessor
|
|||
MAlert[] alerts = s_cacheAlerts.get(get_ID());
|
||||
if (alerts != null && !reload)
|
||||
return alerts;
|
||||
String sql = "SELECT * FROM AD_Alert "
|
||||
+ "WHERE AD_AlertProcessor_ID=? AND IsActive='Y' ";
|
||||
ArrayList<MAlert> list = new ArrayList<MAlert>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, getAD_AlertProcessor_ID());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MAlert (getCtx(), rs, null));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
final String whereClause ="AD_AlertProcessor_ID=?";
|
||||
List <MAlert> list = new Query(getCtx(), I_AD_Alert.Table_Name, whereClause, null)
|
||||
.setParameters(getAD_AlertProcessor_ID())
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
|
||||
//
|
||||
alerts = new MAlert[list.size ()];
|
||||
list.toArray (alerts);
|
||||
|
|
|
@ -144,13 +144,13 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
|||
*/
|
||||
public static MAllocationHdr[] getOfCash (Properties ctx, int C_Cash_ID, String trxName)
|
||||
{
|
||||
String whereClause = "IsActive='Y'"
|
||||
final String whereClause = "IsActive='Y'"
|
||||
+ " AND EXISTS (SELECT 1 FROM C_CashLine cl, C_AllocationLine al "
|
||||
+ "where cl.C_Cash_ID=? and al.C_CashLine_ID=cl.C_CashLine_ID "
|
||||
+ "and C_AllocationHdr.C_AllocationHdr_ID=al.C_AllocationHdr_ID)";
|
||||
Query query = MTable.get(ctx, MAllocationHdr.Table_ID)
|
||||
Query query = MTable.get(ctx, I_C_AllocationHdr.Table_ID)
|
||||
.createQuery(whereClause, trxName);
|
||||
query.setParameters(new Object[]{C_Cash_ID});
|
||||
query.setParameters(C_Cash_ID);
|
||||
List<MAllocationHdr> list = query.list();
|
||||
MAllocationHdr[] retValue = new MAllocationHdr[list.size()];
|
||||
list.toArray(retValue);
|
||||
|
@ -416,7 +416,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
|||
+ I_C_Invoice.COLUMNNAME_DocStatus + " NOT IN (?,?)";
|
||||
boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, whereClause, get_TrxName())
|
||||
.setClient_ID()
|
||||
.setParameters(new Object[]{line.getC_Invoice_ID(), "Y", MInvoice.DOCSTATUS_Voided, MInvoice.DOCSTATUS_Reversed})
|
||||
.setParameters(line.getC_Invoice_ID(), "Y", X_C_Invoice.DOCSTATUS_Voided, X_C_Invoice.DOCSTATUS_Reversed)
|
||||
.match();
|
||||
if(InvoiceIsPaid)
|
||||
throw new AdempiereException("@ValidationError@ @C_Invoice_ID@ @IsPaid@");
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
|
@ -45,7 +44,6 @@ import javax.xml.transform.dom.DOMSource;
|
|||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.MimeType;
|
||||
import org.w3c.dom.Document;
|
||||
|
@ -72,7 +70,7 @@ public class MAttachment extends X_AD_Attachment
|
|||
|
||||
|
||||
/**
|
||||
* Get Attachment
|
||||
* Get Attachment (if there are more than one attachment it gets the first in no specific order)
|
||||
* @param ctx context
|
||||
* @param AD_Table_ID table
|
||||
* @param Record_ID record
|
||||
|
@ -80,35 +78,10 @@ public class MAttachment extends X_AD_Attachment
|
|||
*/
|
||||
public static MAttachment get (Properties ctx, int AD_Table_ID, int Record_ID)
|
||||
{
|
||||
MAttachment retValue = null;
|
||||
PreparedStatement pstmt = null;
|
||||
String sql = "SELECT * FROM AD_Attachment WHERE AD_Table_ID=? AND Record_ID=?";
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, AD_Table_ID);
|
||||
pstmt.setInt (2, Record_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MAttachment (ctx, rs, null);
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
final String whereClause = I_AD_Attachment.COLUMNNAME_AD_Table_ID+"=? AND "+I_AD_Attachment.COLUMNNAME_Record_ID+"=?";
|
||||
MAttachment retValue = new Query(ctx,I_AD_Attachment.Table_Name,whereClause, null)
|
||||
.setParameters(AD_Table_ID, Record_ID)
|
||||
.first();
|
||||
return retValue;
|
||||
} // get
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ public class MAttributeSet extends X_M_AttributeSet
|
|||
{
|
||||
final String whereClause = X_M_AttributeSetExclude.COLUMNNAME_M_AttributeSet_ID+"=?";
|
||||
List<X_M_AttributeSetExclude> list = new Query(getCtx(), X_M_AttributeSetExclude.Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
.setParameters(get_ID())
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
m_excludes = new X_M_AttributeSetExclude[list.size ()];
|
||||
|
@ -253,9 +253,9 @@ public class MAttributeSet extends X_M_AttributeSet
|
|||
return true;
|
||||
if (m_excludeLots == null)
|
||||
{
|
||||
String whereClause = X_M_LotCtlExclude.COLUMNNAME_M_LotCtl_ID+"=?";
|
||||
final String whereClause = X_M_LotCtlExclude.COLUMNNAME_M_LotCtl_ID+"=?";
|
||||
List<X_M_LotCtlExclude> list = new Query(getCtx(), X_M_LotCtlExclude.Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{getM_LotCtl_ID()})
|
||||
.setParameters(getM_LotCtl_ID())
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
m_excludeLots = new X_M_LotCtlExclude[list.size ()];
|
||||
|
@ -287,9 +287,9 @@ public class MAttributeSet extends X_M_AttributeSet
|
|||
return true;
|
||||
if (m_excludeSerNos == null)
|
||||
{
|
||||
String whereClause = X_M_SerNoCtlExclude.COLUMNNAME_M_SerNoCtl_ID+"=?";
|
||||
final String whereClause = X_M_SerNoCtlExclude.COLUMNNAME_M_SerNoCtl_ID+"=?";
|
||||
List<X_M_SerNoCtlExclude> list = new Query(getCtx(), X_M_SerNoCtlExclude.Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{getM_SerNoCtl_ID()})
|
||||
.setParameters(getM_SerNoCtl_ID())
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
m_excludeSerNos = new X_M_SerNoCtlExclude[list.size ()];
|
||||
|
|
|
@ -16,15 +16,12 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
|
@ -69,36 +66,13 @@ public class MBOM extends X_M_BOM
|
|||
public static MBOM[] getOfProduct (Properties ctx, int M_Product_ID,
|
||||
String trxName, String whereClause)
|
||||
{
|
||||
ArrayList<MBOM> list = new ArrayList<MBOM>();
|
||||
String sql = "SELECT * FROM M_BOM WHERE M_Product_ID=?";
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String where = "M_Product_ID=?";
|
||||
if (whereClause != null && whereClause.length() > 0)
|
||||
sql += " AND " + whereClause;
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, M_Product_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MBOM (ctx, rs, trxName));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
where += " AND " + whereClause;
|
||||
List <MBOM> list = new Query(ctx, I_M_BOM.Table_Name, where, trxName)
|
||||
.setParameters(M_Product_ID)
|
||||
.list();
|
||||
|
||||
MBOM[] retValue = new MBOM[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -47,34 +45,12 @@ public class MBOMProduct extends X_M_BOMProduct
|
|||
*/
|
||||
public static MBOMProduct[] getOfBOM (MBOM bom)
|
||||
{
|
||||
ArrayList<MBOMProduct> list = new ArrayList<MBOMProduct>();
|
||||
String sql = "SELECT * FROM M_BOMProduct WHERE M_BOM_ID=? ORDER BY SeqNo";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, bom.get_TrxName());
|
||||
pstmt.setInt (1, bom.getM_BOM_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MBOMProduct (bom.getCtx(), rs, bom.get_TrxName()));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "M_BOM_ID=?";
|
||||
List <MBOMProduct> list = new Query(bom.getCtx(), I_M_BOMProduct.Table_Name, whereClause, bom.get_TrxName())
|
||||
.setParameters(bom.getM_BOM_ID())
|
||||
.setOrderBy("SeqNo")
|
||||
.list();
|
||||
|
||||
MBOMProduct[] retValue = new MBOMProduct[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
|
|
@ -16,14 +16,11 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
/**
|
||||
* BP Bank Account Model
|
||||
|
@ -33,48 +30,24 @@ import org.compiere.util.DB;
|
|||
*/
|
||||
public class MBPBankAccount extends X_C_BP_BankAccount
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2580706419593695062L;
|
||||
|
||||
/**
|
||||
* Get Accounst Of BPartner
|
||||
* Get Accounts Of BPartner
|
||||
* @param ctx context
|
||||
* @param C_BPartner_ID bpartner
|
||||
* @return
|
||||
*/
|
||||
public static MBPBankAccount[] getOfBPartner (Properties ctx, int C_BPartner_ID)
|
||||
{
|
||||
String sql = "SELECT * FROM C_BP_BankAccount WHERE C_BPartner_ID=? AND IsActive='Y'";
|
||||
ArrayList<MBPBankAccount> list = new ArrayList<MBPBankAccount>();
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
list.add(new MBPBankAccount(ctx, rs, null));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try {
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
} catch (Exception e) {
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
final String whereClause = MBPBankAccount.COLUMNNAME_C_BPartner_ID+"=?";
|
||||
List<MBPBankAccount>list = new Query(ctx,I_C_BP_BankAccount.Table_Name,whereClause,null)
|
||||
.setParameters(C_BPartner_ID)
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
|
||||
MBPBankAccount[] retValue = new MBPBankAccount[list.size()];
|
||||
list.toArray(retValue);
|
||||
|
|
|
@ -49,7 +49,6 @@ public class MBPartner extends X_C_BPartner
|
|||
*/
|
||||
private static final long serialVersionUID = -3669895599574182217L;
|
||||
|
||||
|
||||
/**
|
||||
* Get Empty Template Business Partner
|
||||
* @param ctx context
|
||||
|
@ -97,38 +96,10 @@ public class MBPartner extends X_C_BPartner
|
|||
*/
|
||||
public static MBPartner getBPartnerCashTrx (Properties ctx, int AD_Client_ID)
|
||||
{
|
||||
MBPartner retValue = null;
|
||||
String sql = "SELECT * FROM C_BPartner "
|
||||
+ "WHERE C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, AD_Client_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
retValue = new MBPartner (ctx, rs, null);
|
||||
else
|
||||
s_log.log(Level.SEVERE, "Not found for AD_Client_ID=" + AD_Client_ID);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
pstmt = null;
|
||||
}
|
||||
MBPartner retValue = (MBPartner) MClientInfo.get(ctx, AD_Client_ID).getC_BPartnerCashTrx();
|
||||
if (retValue == null)
|
||||
s_log.log(Level.SEVERE, "Not found for AD_Client_ID=" + AD_Client_ID);
|
||||
|
||||
return retValue;
|
||||
} // getBPartnerCashTrx
|
||||
|
||||
|
@ -142,9 +113,9 @@ public class MBPartner extends X_C_BPartner
|
|||
{
|
||||
if (Value == null || Value.length() == 0)
|
||||
return null;
|
||||
String whereClause = "Value=? AND AD_Client_ID=?";
|
||||
MBPartner retValue = new Query(ctx,MBPartner.Table_Name,whereClause.toString(),null)
|
||||
.setParameters(new Object[]{Value,Env.getAD_Client_ID(ctx)})
|
||||
final String whereClause = "Value=? AND AD_Client_ID=?";
|
||||
MBPartner retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause, null)
|
||||
.setParameters(Value,Env.getAD_Client_ID(ctx))
|
||||
.firstOnly();
|
||||
return retValue;
|
||||
} // get
|
||||
|
@ -157,9 +128,9 @@ public class MBPartner extends X_C_BPartner
|
|||
*/
|
||||
public static MBPartner get (Properties ctx, int C_BPartner_ID)
|
||||
{
|
||||
String whereClause = "C_BPartner_ID=? AND AD_Client_ID=?";
|
||||
MBPartner retValue = new Query(ctx,MBPartner.Table_Name,whereClause.toString(),null)
|
||||
.setParameters(new Object[]{C_BPartner_ID,Env.getAD_Client_ID(ctx)})
|
||||
final String whereClause = "C_BPartner_ID=? AND AD_Client_ID=?";
|
||||
MBPartner retValue = new Query(ctx,I_C_BPartner.Table_Name,whereClause,null)
|
||||
.setParameters(C_BPartner_ID,Env.getAD_Client_ID(ctx))
|
||||
.firstOnly();
|
||||
return retValue;
|
||||
} // get
|
||||
|
|
|
@ -59,7 +59,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location
|
|||
public static MBPartnerLocation[] getForBPartner (Properties ctx, int C_BPartner_ID, String trxName)
|
||||
{
|
||||
List<MBPartnerLocation> list = new Query(ctx, Table_Name, "C_BPartner_ID=?", trxName)
|
||||
.setParameters(new Object[]{C_BPartner_ID})
|
||||
.setParameters(C_BPartner_ID)
|
||||
.list();
|
||||
MBPartnerLocation[] retValue = new MBPartnerLocation[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
|
|
@ -18,12 +18,10 @@ package org.compiere.model;
|
|||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
|
@ -131,37 +129,11 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
|
|||
return m_lines;
|
||||
}
|
||||
//
|
||||
ArrayList<MBankStatementLine> list = new ArrayList<MBankStatementLine>();
|
||||
String sql = "SELECT * FROM C_BankStatementLine "
|
||||
+ "WHERE C_BankStatement_ID=?"
|
||||
+ "ORDER BY Line";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getC_BankStatement_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add (new MBankStatementLine(getCtx(), rs, get_TrxName()));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "getLines", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
final String whereClause = I_C_BankStatementLine.COLUMNNAME_C_BankStatement_ID+"=?";
|
||||
List<MBankStatementLine> list = new Query(getCtx(),I_C_BankStatementLine.Table_Name,whereClause,get_TrxName())
|
||||
.setParameters(getC_BankStatement_ID())
|
||||
.setOrderBy("Line")
|
||||
.list();
|
||||
MBankStatementLine[] retValue = new MBankStatementLine[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
|
|
|
@ -69,14 +69,14 @@ public class MCash extends X_C_Cash implements DocAction
|
|||
Timestamp dateAcct, int C_Currency_ID, String trxName)
|
||||
{
|
||||
// Existing Journal
|
||||
String whereClause = "C_Cash.AD_Org_ID=?" // #1
|
||||
final String whereClause = "C_Cash.AD_Org_ID=?" // #1
|
||||
+ " AND TRUNC(C_Cash.StatementDate)=?" // #2
|
||||
+ " AND C_Cash.Processed='N'"
|
||||
+ " AND EXISTS (SELECT * FROM C_CashBook cb "
|
||||
+ "WHERE C_Cash.C_CashBook_ID=cb.C_CashBook_ID AND cb.AD_Org_ID=C_Cash.AD_Org_ID"
|
||||
+ " AND cb.C_Currency_ID=?)"; // #3
|
||||
MCash retValue = new Query(ctx, MCash.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{AD_Org_ID,TimeUtil.getDay(dateAcct),C_Currency_ID})
|
||||
MCash retValue = new Query(ctx, I_C_Cash.Table_Name, whereClause, trxName)
|
||||
.setParameters(AD_Org_ID,TimeUtil.getDay(dateAcct),C_Currency_ID)
|
||||
.first()
|
||||
;
|
||||
|
||||
|
@ -108,12 +108,12 @@ public class MCash extends X_C_Cash implements DocAction
|
|||
public static MCash get (Properties ctx, int C_CashBook_ID,
|
||||
Timestamp dateAcct, String trxName)
|
||||
{
|
||||
String whereClause ="C_CashBook_ID=?" // #1
|
||||
final String whereClause ="C_CashBook_ID=?" // #1
|
||||
+ " AND TRUNC(StatementDate)=?" // #2
|
||||
+ " AND Processed='N'";
|
||||
|
||||
MCash retValue = new Query(ctx, MCash.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{C_CashBook_ID, TimeUtil.getDay(dateAcct)})
|
||||
.setParameters(C_CashBook_ID, TimeUtil.getDay(dateAcct))
|
||||
.first()
|
||||
;
|
||||
|
||||
|
@ -217,10 +217,10 @@ public class MCash extends X_C_Cash implements DocAction
|
|||
return m_lines;
|
||||
}
|
||||
|
||||
String whereClause =MCashLine.COLUMNNAME_C_Cash_ID+"=?";
|
||||
List<MCashLine> list = new Query(getCtx(),MCashLine.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{getC_Cash_ID()})
|
||||
.setOrderBy(MCashLine.COLUMNNAME_Line)
|
||||
final String whereClause =MCashLine.COLUMNNAME_C_Cash_ID+"=?";
|
||||
List<MCashLine> list = new Query(getCtx(),I_C_CashLine.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(getC_Cash_ID())
|
||||
.setOrderBy(I_C_CashLine.COLUMNNAME_Line)
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
|
||||
|
|
|
@ -80,9 +80,9 @@ public class MCommission extends X_C_Commission
|
|||
{
|
||||
//[ 1867477 ]
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "IsActive='Y' AND C_Commission_ID=?";
|
||||
List<MCommissionLine> list = new Query(getCtx(), MCommissionLine.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{getC_Commission_ID()})
|
||||
final String whereClause = "IsActive='Y' AND C_Commission_ID=?";
|
||||
List<MCommissionLine> list = new Query(getCtx(), I_C_CommissionLine.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(getC_Commission_ID())
|
||||
.setOrderBy("Line")
|
||||
.list();
|
||||
// Convert
|
||||
|
|
|
@ -17,13 +17,10 @@
|
|||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
|
@ -88,35 +85,10 @@ public class MCommissionAmt extends X_C_CommissionAmt
|
|||
*/
|
||||
public MCommissionDetail[] getDetails()
|
||||
{
|
||||
String sql = "SELECT * FROM C_CommissionDetail WHERE C_CommissionAmt_ID=?";
|
||||
ArrayList<MCommissionDetail> list = new ArrayList<MCommissionDetail>();
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getC_CommissionAmt_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new MCommissionDetail(getCtx(), rs, get_TrxName()));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
final String whereClause = I_C_CommissionDetail.COLUMNNAME_C_CommissionAmt_ID+"=?";
|
||||
List<MCommissionDetail> list = new Query(getCtx(),I_C_CommissionDetail.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(getC_CommissionAmt_ID())
|
||||
.list();
|
||||
// Convert
|
||||
MCommissionDetail[] retValue = new MCommissionDetail[list.size()];
|
||||
list.toArray(retValue);
|
||||
|
|
|
@ -17,13 +17,10 @@
|
|||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
|
@ -34,10 +31,12 @@ import org.compiere.util.Env;
|
|||
*/
|
||||
public class MCommissionRun extends X_C_CommissionRun
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3103035295526318283L;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3103035295526318283L;
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
|
@ -86,35 +85,10 @@ public class MCommissionRun extends X_C_CommissionRun
|
|||
*/
|
||||
public MCommissionAmt[] getAmts()
|
||||
{
|
||||
String sql = "SELECT * FROM C_CommissionAmt WHERE C_CommissionRun_ID=?";
|
||||
ArrayList<MCommissionAmt> list = new ArrayList<MCommissionAmt>();
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getC_CommissionRun_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new MCommissionAmt(getCtx(), rs, get_TrxName()));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
final String whereClause = I_C_CommissionAmt.COLUMNNAME_C_CommissionRun_ID+"=?";
|
||||
List<MCommissionAmt> list = new Query(getCtx(),I_C_CommissionAmt.Table_Name,whereClause,get_TrxName())
|
||||
.setParameters(getC_CommissionRun_ID())
|
||||
.list();
|
||||
// Convert
|
||||
MCommissionAmt[] retValue = new MCommissionAmt[list.size()];
|
||||
list.toArray(retValue);
|
||||
|
|
|
@ -32,8 +32,10 @@ import org.compiere.util.DB;
|
|||
*/
|
||||
public class MContainer extends X_CM_Container
|
||||
{
|
||||
/** serialVersionUID */
|
||||
private static final long serialVersionUID = 395679572291279730L;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3999588662066631303L;
|
||||
|
||||
/**
|
||||
* get Container by Relative URL
|
||||
|
@ -46,9 +48,9 @@ public class MContainer extends X_CM_Container
|
|||
public static MContainer get(Properties ctx, String relURL, int CM_WebProject_Id, String trxName) {
|
||||
MContainer thisContainer = null;
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1/trifon
|
||||
String whereClause = "(RelativeURL LIKE ? OR RelativeURL LIKE ?) AND CM_WebProject_ID=?";
|
||||
thisContainer = new Query(ctx, MContainer.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{relURL, relURL+"/",CM_WebProject_Id})
|
||||
final String whereClause = "(RelativeURL LIKE ? OR RelativeURL LIKE ?) AND CM_WebProject_ID=?";
|
||||
thisContainer = new Query(ctx, I_CM_Container.Table_Name, whereClause, trxName)
|
||||
.setParameters(relURL, relURL+"/",CM_WebProject_Id)
|
||||
.first();
|
||||
|
||||
return thisContainer;
|
||||
|
@ -66,9 +68,9 @@ public class MContainer extends X_CM_Container
|
|||
public static MContainer get(Properties ctx, int CM_Container_ID, int CM_WebProject_Id, String trxName) {
|
||||
MContainer thisContainer = null;
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1/trifon
|
||||
String whereClause = "CM_Container_ID=? AND CM_WebProject_ID=?";
|
||||
thisContainer = new Query(ctx, MContainer.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{CM_Container_ID, CM_WebProject_Id})
|
||||
final String whereClause = "CM_Container_ID=? AND CM_WebProject_ID=?";
|
||||
thisContainer = new Query(ctx, I_CM_Container.Table_Name, whereClause, trxName)
|
||||
.setParameters(CM_Container_ID, CM_WebProject_Id)
|
||||
.first();
|
||||
//
|
||||
return thisContainer;
|
||||
|
@ -112,9 +114,9 @@ public class MContainer extends X_CM_Container
|
|||
{
|
||||
MContainer cc = null;
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1/trifon
|
||||
String whereClause = "CM_Container_ID=?";
|
||||
cc = new Query(ctx, MContainer.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{CM_Container_ID})
|
||||
final String whereClause = "CM_Container_ID=?";
|
||||
cc = new Query(ctx, I_CM_Container.Table_Name, whereClause, trxName)
|
||||
.setParameters(CM_Container_ID)
|
||||
.first();
|
||||
//
|
||||
return cc;
|
||||
|
@ -130,9 +132,9 @@ public class MContainer extends X_CM_Container
|
|||
public static MContainer[] getContainers (MWebProject project)
|
||||
{
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1/trifon
|
||||
String whereClause = "CM_WebProject_ID=?";
|
||||
List<MContainer> list = new Query(project.getCtx(), MContainer.Table_Name, whereClause, project.get_TrxName())
|
||||
.setParameters(new Object[]{project.getCM_WebProject_ID ()})
|
||||
final String whereClause = "CM_WebProject_ID=?";
|
||||
List<MContainer> list = new Query(project.getCtx(), I_CM_Container.Table_Name, whereClause, project.get_TrxName())
|
||||
.setParameters(project.getCM_WebProject_ID ())
|
||||
.setOrderBy("CM_Container_ID")
|
||||
.list();
|
||||
//
|
||||
|
|
|
@ -16,13 +16,10 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
/**
|
||||
* CStage Element
|
||||
|
@ -32,11 +29,13 @@ import org.compiere.util.DB;
|
|||
*/
|
||||
public class MContainerElement extends X_CM_Container_Element
|
||||
{
|
||||
/** serialVersionUID */
|
||||
private static final long serialVersionUID = 7230036377422361941L;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8487403111353473486L;
|
||||
|
||||
/** Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MContainer.class);
|
||||
private static CLogger s_log = CLogger.getCLogger (MContainerElement.class);
|
||||
|
||||
/**
|
||||
* get Container Element by ID
|
||||
|
@ -46,35 +45,7 @@ public class MContainerElement extends X_CM_Container_Element
|
|||
* @return ContainerElement
|
||||
*/
|
||||
public static MContainerElement get(Properties ctx, int CM_ContainerElement_ID, String trxName) {
|
||||
MContainerElement thisContainerElement = null;
|
||||
String sql = "SELECT * FROM CM_Container_Element WHERE CM_Container_Element_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, CM_ContainerElement_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
thisContainerElement = (new MContainerElement(ctx, rs, trxName));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
return thisContainerElement;
|
||||
return new MContainerElement(ctx, CM_ContainerElement_ID, trxName);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.sql.Timestamp;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -45,7 +46,8 @@ public class MConversionRate extends X_C_Conversion_Rate
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2753651400799848008L;
|
||||
private static final long serialVersionUID = -8171829790483133141L;
|
||||
|
||||
/** Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MConversionRate.class);
|
||||
|
||||
|
@ -156,12 +158,10 @@ public class MConversionRate extends X_C_Conversion_Rate
|
|||
spotCal.set(Calendar.SECOND, 0);
|
||||
spotCal.set(Calendar.MILLISECOND, 0);
|
||||
startTs = new java.sql.Timestamp(spotCal.getTimeInMillis());
|
||||
|
||||
final String whereClause = "C_Currency_ID=? and C_Currency_ID_To=? and ValidFrom>=? and ValidTo<=? and C_ConversionType_ID=?";
|
||||
MConversionRate rate, updateRate = null;
|
||||
java.util.List<MConversionRate> rates = new Query(ctx, MConversionRate.Table_Name,
|
||||
"C_Currency_ID=? and C_Currency_ID_To=? and ValidFrom>=? and ValidTo<=? and C_ConversionType_ID=?",
|
||||
trxName)
|
||||
.setParameters(new Object[]{curFrom.get_ID(), curTo.get_ID(), startTs, startTs, MConversionType.TYPE_SPOT})
|
||||
List<MConversionRate> rates = new Query(ctx, I_C_Conversion_Rate.Table_Name, whereClause,trxName)
|
||||
.setParameters(curFrom.get_ID(), curTo.get_ID(), startTs, startTs, MConversionType.TYPE_SPOT)
|
||||
.list();
|
||||
|
||||
if (rates.size()>0) {
|
||||
|
|
|
@ -1289,20 +1289,19 @@ public class MCost extends X_M_Cost
|
|||
{
|
||||
MCost cost = null;
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "AD_Client_ID=? AND AD_Org_ID=?"
|
||||
final String whereClause = "AD_Client_ID=? AND AD_Org_ID=?"
|
||||
+ " AND M_Product_ID=?"
|
||||
+ " AND M_AttributeSetInstance_ID=?"
|
||||
+ " AND M_CostType_ID=? AND C_AcctSchema_ID=?"
|
||||
+ " AND M_CostElement_ID=?";
|
||||
cost = new Query(product.getCtx(), MCost.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{
|
||||
product.getAD_Client_ID(),
|
||||
cost = new Query(product.getCtx(), I_M_Cost.Table_Name, whereClause, trxName)
|
||||
.setParameters( product.getAD_Client_ID(),
|
||||
AD_Org_ID,
|
||||
product.getM_Product_ID(),
|
||||
M_AttributeSetInstance_ID,
|
||||
as.getM_CostType_ID(),
|
||||
as.getC_AcctSchema_ID(),
|
||||
M_CostElement_ID})
|
||||
M_CostElement_ID)
|
||||
.firstOnly();
|
||||
//FR: [ 2214883 ] - end -
|
||||
// New
|
||||
|
|
|
@ -16,13 +16,10 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -38,6 +35,8 @@ import org.compiere.util.Msg;
|
|||
* @author Teo Sarca, www.arhipac.ro
|
||||
* <li>BF [ 2664529 ] More then one Labor/Burden//Overhead is not allowed
|
||||
* <li>BF [ 2667470 ] MCostElement.getMaterialCostElement should check only material
|
||||
* @author red1
|
||||
* <li>FR: [ 2214883 ] Remove SQL code and Replace for Query -- JUnit tested
|
||||
*/
|
||||
public class MCostElement extends X_M_CostElement
|
||||
{
|
||||
|
@ -61,9 +60,10 @@ public class MCostElement extends X_M_CostElement
|
|||
return null;
|
||||
}
|
||||
//
|
||||
final String whereClause = "AD_Client_ID=? AND CostingMethod=? AND CostElementType=?";
|
||||
final String whereClause = "CostingMethod=? AND CostElementType=?";
|
||||
MCostElement retValue = new Query(po.getCtx(), Table_Name, whereClause, po.get_TrxName())
|
||||
.setParameters(new Object[]{po.getAD_Client_ID(), CostingMethod, COSTELEMENTTYPE_Material})
|
||||
.setParameters(CostingMethod, COSTELEMENTTYPE_Material)
|
||||
.setClient_ID()
|
||||
.setOrderBy("AD_Org_ID")
|
||||
.firstOnly();
|
||||
if (retValue != null)
|
||||
|
@ -92,37 +92,17 @@ public class MCostElement extends X_M_CostElement
|
|||
*/
|
||||
public static MCostElement getMaterialCostElement(Properties ctx, String CostingMethod)
|
||||
{
|
||||
final String whereClause = "CostingMethod=?";
|
||||
List<MCostElement> list = new Query(ctx, I_M_CostElement.Table_Name, whereClause, null)
|
||||
.setParameters(CostingMethod)
|
||||
.setClient_ID()
|
||||
.setOrderBy(I_M_CostElement.COLUMNNAME_AD_Org_ID)
|
||||
.list();
|
||||
MCostElement retValue = null;
|
||||
String sql = "SELECT * FROM M_CostElement WHERE AD_Client_ID=? AND CostingMethod=? ORDER BY AD_Org_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
|
||||
pstmt.setString(2, CostingMethod);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MCostElement (ctx, rs, null);
|
||||
if (rs.next())
|
||||
s_log.info("More then one Material Cost Element for CostingMethod=" + CostingMethod);
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
if (list.size() > 0)
|
||||
retValue = list.get(0);
|
||||
if (list.size() > 1)
|
||||
s_log.info("More then one Material Cost Element for CostingMethod=" + CostingMethod);
|
||||
return retValue;
|
||||
} // getMaterialCostElement
|
||||
|
||||
|
@ -147,36 +127,12 @@ public class MCostElement extends X_M_CostElement
|
|||
*/
|
||||
public static MCostElement[] getCostingMethods (PO po)
|
||||
{
|
||||
ArrayList<MCostElement> list = new ArrayList<MCostElement>();
|
||||
String sql = "SELECT * FROM M_CostElement "
|
||||
+ "WHERE AD_Client_ID=?"
|
||||
+ " AND IsActive='Y' AND CostElementType='M' AND CostingMethod IS NOT NULL";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, po.get_TrxName());
|
||||
pstmt.setInt (1, po.getAD_Client_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add(new MCostElement (po.getCtx(), rs, po.get_TrxName()));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
final String whereClause ="CostElementType=? AND CostingMethod IS NOT NULL";
|
||||
List<MCostElement> list = new Query(po.getCtx(), I_M_CostElement.Table_Name, whereClause, po.get_TrxName())
|
||||
.setParameters(COSTELEMENTTYPE_Material)
|
||||
.setClient_ID()
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
//
|
||||
MCostElement[] retValue = new MCostElement[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
@ -191,36 +147,11 @@ public class MCostElement extends X_M_CostElement
|
|||
*/
|
||||
public static MCostElement[] getNonCostingMethods (PO po)
|
||||
{
|
||||
ArrayList<MCostElement> list = new ArrayList<MCostElement>();
|
||||
String sql = "SELECT * FROM M_CostElement "
|
||||
+ "WHERE AD_Client_ID=?"
|
||||
+ " AND IsActive='Y' AND CostingMethod IS NULL";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, po.get_TrxName());
|
||||
pstmt.setInt (1, po.getAD_Client_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add(new MCostElement (po.getCtx(), rs, po.get_TrxName()));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
final String whereClause = "CostingMethod IS NULL";
|
||||
List<MCostElement>list = new Query(po.getCtx(),I_M_CostElement.Table_Name, whereClause, po.get_TrxName())
|
||||
.setClient_ID()
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
//
|
||||
MCostElement[] retValue = new MCostElement[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
@ -255,12 +186,12 @@ public class MCostElement extends X_M_CostElement
|
|||
*/
|
||||
public static MCostElement[] getElements (Properties ctx, String trxName)
|
||||
{
|
||||
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
||||
int AD_Org_ID = 0; // Org is always ZERO - see beforeSave
|
||||
|
||||
String whereClause = "AD_Client_ID = ? AND AD_Org_ID = ?";
|
||||
final String whereClause = "AD_Org_ID=?";
|
||||
List<MCostElement> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{AD_Client_ID, AD_Org_ID})
|
||||
.setParameters(AD_Org_ID)
|
||||
.setClient_ID()
|
||||
.list();
|
||||
MCostElement[] retValue = new MCostElement[list.size()];
|
||||
list.toArray(retValue);
|
||||
|
@ -279,7 +210,7 @@ public class MCostElement extends X_M_CostElement
|
|||
return new Query(ctx, Table_Name, whereClause, null)
|
||||
.setClient_ID()
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{CostingMethod})
|
||||
.setParameters(CostingMethod)
|
||||
.list();
|
||||
}
|
||||
|
||||
|
@ -345,7 +276,7 @@ public class MCostElement extends X_M_CostElement
|
|||
}
|
||||
}
|
||||
|
||||
// Maintain Calclated
|
||||
// Maintain Calculated
|
||||
/*
|
||||
if (COSTELEMENTTYPE_Material.equals(getCostElementType()))
|
||||
{
|
||||
|
@ -393,37 +324,14 @@ public class MCostElement extends X_M_CostElement
|
|||
}
|
||||
|
||||
// Costing Methods on PC level
|
||||
String sql = "SELECT M_Product_Category_ID FROM M_Product_Category_Acct WHERE AD_Client_ID=? AND CostingMethod=?";
|
||||
int M_Product_Category_ID = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, getAD_Client_ID());
|
||||
pstmt.setString (2, getCostingMethod());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
{
|
||||
M_Product_Category_ID = rs.getInt(1);
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
final String whereClause ="CostingMethod=?";
|
||||
MProductCategoryAcct retValue = new Query(getCtx(), I_M_Product_Category_Acct.Table_Name, whereClause, null)
|
||||
.setParameters(getCostingMethod())
|
||||
.setClient_ID()
|
||||
.first();
|
||||
if (retValue != null)
|
||||
M_Product_Category_ID = retValue.getM_Product_Category_ID();
|
||||
if (M_Product_Category_ID != 0)
|
||||
{
|
||||
log.saveError("CannotDeleteUsed", Msg.getElement(getCtx(), "M_Product_Category_ID")
|
||||
|
|
|
@ -105,8 +105,8 @@ public class MCurrency extends X_C_Currency
|
|||
return retValue;
|
||||
|
||||
// Try database
|
||||
Query query = new Query(ctx, MCurrency.Table_Name, "iso_code=?", null);
|
||||
query.setParameters(new Object[]{ISOcode});
|
||||
Query query = new Query(ctx, I_C_Currency.Table_Name, "ISO_Code=?", null);
|
||||
query.setParameters(ISOcode);
|
||||
retValue = (MCurrency)query.firstOnly();
|
||||
|
||||
// Save
|
||||
|
|
|
@ -61,9 +61,9 @@ public class MDocType extends X_C_DocType
|
|||
*/
|
||||
static public MDocType[] getOfDocBaseType (Properties ctx, String DocBaseType)
|
||||
{
|
||||
String whereClause = "AD_Client_ID=? AND DocBaseType=?";
|
||||
final String whereClause = "AD_Client_ID=? AND DocBaseType=?";
|
||||
List<MDocType> list = new Query(ctx, Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{Env.getAD_Client_ID(ctx), DocBaseType})
|
||||
.setParameters(Env.getAD_Client_ID(ctx), DocBaseType)
|
||||
.setOnlyActiveRecords(true)
|
||||
.setOrderBy("IsDefault DESC, C_DocType_ID")
|
||||
.list();
|
||||
|
@ -77,9 +77,8 @@ public class MDocType extends X_C_DocType
|
|||
*/
|
||||
static public MDocType[] getOfClient (Properties ctx)
|
||||
{
|
||||
String whereClause = "AD_Client_ID=?";
|
||||
List<MDocType> list = new Query(ctx, Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{Env.getAD_Client_ID(ctx)})
|
||||
List<MDocType> list = new Query(ctx, Table_Name, null, null)
|
||||
.setClient_ID()
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
return list.toArray(new MDocType[list.size()]);
|
||||
|
|
|
@ -85,11 +85,11 @@ public class MDunningRun extends X_C_DunningRun
|
|||
// just one level
|
||||
levels = new Query(
|
||||
getCtx(),
|
||||
MDunningLevel.Table_Name,
|
||||
I_C_DunningLevel.Table_Name,
|
||||
"C_Dunning_ID=? AND C_DunningLevel_ID=?",
|
||||
get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{getC_Dunning_ID(), getC_DunningLevel_ID()})
|
||||
.setParameters(getC_Dunning_ID(), getC_DunningLevel_ID())
|
||||
.setOrderBy("DaysAfterDue DESC, C_DunningLevel_ID")
|
||||
.list();
|
||||
} else {
|
||||
|
@ -100,7 +100,7 @@ public class MDunningRun extends X_C_DunningRun
|
|||
"C_Dunning_ID=?",
|
||||
get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{getC_Dunning_ID()})
|
||||
.setParameters(getC_Dunning_ID())
|
||||
.setOrderBy("DaysAfterDue DESC, C_DunningLevel_ID")
|
||||
.list();
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MEXPFormat extends X_EXP_Format {
|
|||
final String clauseWhere = X_EXP_FormatLine.COLUMNNAME_EXP_Format_ID + "=?";
|
||||
m_lines = new Query(getCtx() , I_EXP_FormatLine.Table_Name, clauseWhere , get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{getEXP_Format_ID()})
|
||||
.setParameters(getEXP_Format_ID())
|
||||
.setOrderBy(orderBy)
|
||||
.list();
|
||||
return m_lines;
|
||||
|
@ -102,7 +102,7 @@ public class MEXPFormat extends X_EXP_Format {
|
|||
+ " AND " + X_EXP_FormatLine.COLUMNNAME_IsPartUniqueIndex +"= ?";
|
||||
m_lines_unique = new Query(getCtx(), I_EXP_FormatLine.Table_Name, clauseWhere, get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{getEXP_Format_ID(), "Y"})
|
||||
.setParameters(getEXP_Format_ID(), "Y")
|
||||
.setOrderBy(X_EXP_FormatLine.COLUMNNAME_Position)
|
||||
.list();
|
||||
return m_lines_unique;
|
||||
|
@ -130,18 +130,18 @@ public class MEXPFormat extends X_EXP_Format {
|
|||
if(retValue!=null)
|
||||
return retValue;
|
||||
|
||||
StringBuffer whereCluse = new StringBuffer(X_EXP_Format.COLUMNNAME_Value).append("=?")
|
||||
StringBuffer whereClause = new StringBuffer(X_EXP_Format.COLUMNNAME_Value).append("=?")
|
||||
.append(" AND AD_Client_ID = ?")
|
||||
.append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?");
|
||||
|
||||
retValue = (MEXPFormat) new Query(ctx,X_EXP_Format.Table_Name,whereCluse.toString(),trxName)
|
||||
.setParameters(new Object[] {value,AD_Client_ID,version}).first();
|
||||
retValue = (MEXPFormat) new Query(ctx,X_EXP_Format.Table_Name,whereClause.toString(),trxName)
|
||||
.setParameters(value,AD_Client_ID,version).first();
|
||||
|
||||
if(retValue != null)
|
||||
{
|
||||
retValue.getFormatLines();
|
||||
s_cache.put (key, retValue);
|
||||
exp_format_by_id_cache.put(retValue.getEXP_Format_ID(), retValue);
|
||||
retValue.getFormatLines();
|
||||
s_cache.put (key, retValue);
|
||||
exp_format_by_id_cache.put(retValue.getEXP_Format_ID(), retValue);
|
||||
}
|
||||
|
||||
return retValue;
|
||||
|
@ -161,13 +161,13 @@ public class MEXPFormat extends X_EXP_Format {
|
|||
.append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?");
|
||||
|
||||
retValue = (MEXPFormat) new Query(ctx,X_EXP_Format.Table_Name,whereClause.toString(),trxName)
|
||||
.setParameters(new Object[] {AD_Client_ID,AD_Table_ID,version})
|
||||
.setParameters(AD_Client_ID,AD_Table_ID,version)
|
||||
.first();
|
||||
if(retValue!=null)
|
||||
{
|
||||
retValue.getFormatLines();
|
||||
s_cache.put (key, retValue);
|
||||
exp_format_by_id_cache.put(retValue.getEXP_Format_ID(), retValue);
|
||||
retValue.getFormatLines();
|
||||
s_cache.put (key, retValue);
|
||||
exp_format_by_id_cache.put(retValue.getEXP_Format_ID(), retValue);
|
||||
}
|
||||
|
||||
return retValue;
|
||||
|
|
|
@ -213,8 +213,8 @@ public class MElementValue extends X_C_ElementValue
|
|||
{
|
||||
//
|
||||
// Check if we have accounting facts
|
||||
boolean match = new Query(getCtx(), MFactAcct.Table_Name, MFactAcct.COLUMNNAME_Account_ID+"=?", get_TrxName())
|
||||
.setParameters(new Object[]{getC_ElementValue_ID()})
|
||||
boolean match = new Query(getCtx(), I_Fact_Acct.Table_Name, I_Fact_Acct.COLUMNNAME_Account_ID+"=?", get_TrxName())
|
||||
.setParameters(getC_ElementValue_ID())
|
||||
.match();
|
||||
if (match)
|
||||
{
|
||||
|
@ -223,8 +223,8 @@ public class MElementValue extends X_C_ElementValue
|
|||
//
|
||||
// Check Valid Combinations - teo_sarca FR [ 1883533 ]
|
||||
String whereClause = MAccount.COLUMNNAME_Account_ID+"=?";
|
||||
POResultSet<MAccount> rs = new Query(getCtx(), MAccount.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
POResultSet<MAccount> rs = new Query(getCtx(), I_C_ValidCombination.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.scroll();
|
||||
try {
|
||||
while(rs.hasNext()) {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class MFactAcct extends X_Fact_Acct
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 756203818233903671L;
|
||||
private static final long serialVersionUID = 5251847162314796574L;
|
||||
|
||||
/**
|
||||
* Delete Accounting
|
||||
|
@ -135,19 +135,4 @@ public class MFactAcct extends X_Fact_Acct
|
|||
return acct;
|
||||
} // getMAccount
|
||||
|
||||
/**
|
||||
* Check if a document is already posted
|
||||
* @param AD_Table_ID table
|
||||
* @param Record_ID record
|
||||
* @param trxName transaction
|
||||
* @return boolean indicating if the document has already accounting facts
|
||||
* @throws DBException on database exception
|
||||
*/
|
||||
public static boolean alreadyPosted(int AD_Table_ID, int Record_ID, String trxName) throws DBException
|
||||
{
|
||||
final String sql = "SELECT 1 FROM Fact_Acct WHERE AD_Table_ID=? AND Record_ID=?";
|
||||
int one = DB.getSQLValue(trxName, sql, new Object[]{AD_Table_ID, Record_ID});
|
||||
return (one == 1);
|
||||
}
|
||||
|
||||
} // MFactAcct
|
||||
|
|
|
@ -32,8 +32,6 @@ package org.compiere.model;
|
|||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.util.Env;
|
||||
/**
|
||||
*
|
||||
* @author Daniel Tamm
|
||||
|
@ -80,8 +78,8 @@ public class MFreightCategory extends X_M_FreightCategory {
|
|||
*/
|
||||
public static MFreightCategory getByValue(Properties ctx, String value, String trxName) {
|
||||
|
||||
Query q = new Query(ctx, MFreightCategory.Table_Name, "Value=? AND AD_Client_ID=?", trxName);
|
||||
q.setParameters(new Object[]{value, Env.getAD_Client_ID(ctx)});
|
||||
Query q = new Query(ctx, I_M_FreightCategory.Table_Name, "Value=?", trxName);
|
||||
q.setParameters(value).setClient_ID();
|
||||
return q.first();
|
||||
}
|
||||
|
||||
|
|
|
@ -623,8 +623,8 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
set_TrxName(m_lines, get_TrxName());
|
||||
return m_lines;
|
||||
}
|
||||
List<MInOutLine> list = new Query(getCtx(), MInOutLine.Table_Name, "M_InOut_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{getM_InOut_ID()})
|
||||
List<MInOutLine> list = new Query(getCtx(), I_M_InOutLine.Table_Name, "M_InOut_ID=?", get_TrxName())
|
||||
.setParameters(getM_InOut_ID())
|
||||
.setOrderBy(MInOutLine.COLUMNNAME_Line)
|
||||
.list();
|
||||
//
|
||||
|
@ -655,8 +655,8 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
set_TrxName(m_confirms, get_TrxName());
|
||||
return m_confirms;
|
||||
}
|
||||
List<MInOutConfirm> list = new Query(getCtx(), MInOutConfirm.Table_Name, "M_InOut_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{getM_InOut_ID()})
|
||||
List<MInOutConfirm> list = new Query(getCtx(), I_M_InOutConfirm.Table_Name, "M_InOut_ID=?", get_TrxName())
|
||||
.setParameters(getM_InOut_ID())
|
||||
.list();
|
||||
m_confirms = new MInOutConfirm[list.size ()];
|
||||
list.toArray (m_confirms);
|
||||
|
@ -1486,6 +1486,9 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching");
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
if (MClient.isClientAccountingImmediate()) {
|
||||
String ignoreError = DocumentEngine.postImmediate(inv.getCtx(), inv.getAD_Client_ID(), inv.get_Table_ID(), inv.get_ID(), true, inv.get_TrxName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1500,6 +1503,9 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
m_processMsg = "Could not create PO Matching";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
if (MClient.isClientAccountingImmediate()) {
|
||||
String ignoreError = DocumentEngine.postImmediate(po.getCtx(), po.getAD_Client_ID(), po.get_Table_ID(), po.get_ID(), true, po.get_TrxName());
|
||||
}
|
||||
// Update PO with ASI
|
||||
if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0
|
||||
&& sLine.getMovementQty().compareTo(oLine.getQtyOrdered()) == 0) // just if full match [ 1876965 ]
|
||||
|
@ -1523,6 +1529,9 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
m_processMsg = "Could not create PO(Inv) Matching";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
if (MClient.isClientAccountingImmediate()) {
|
||||
String ignoreError = DocumentEngine.postImmediate(po.getCtx(), po.getAD_Client_ID(), po.get_Table_ID(), po.get_ID(), true, po.get_TrxName());
|
||||
}
|
||||
// Update PO with ASI
|
||||
oLine = new MOrderLine (getCtx(), po.getC_OrderLine_ID(), get_TrxName());
|
||||
if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0
|
||||
|
|
|
@ -151,9 +151,9 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
|
|||
set_TrxName(m_lines, get_TrxName());
|
||||
return m_lines;
|
||||
}
|
||||
final String whereClause = MInOutLineConfirm.COLUMNNAME_M_InOutConfirm_ID+"=?";
|
||||
List<MInOutLineConfirm> list = new Query(getCtx(), MInOutLineConfirm.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{getM_InOutConfirm_ID()})
|
||||
final String whereClause = I_M_InOutLineConfirm.COLUMNNAME_M_InOutConfirm_ID+"=?";
|
||||
List<MInOutLineConfirm> list = new Query(getCtx(), I_M_InOutLineConfirm.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(getM_InOutConfirm_ID())
|
||||
.list();
|
||||
m_lines = new MInOutLineConfirm[list.size ()];
|
||||
list.toArray (m_lines);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class MInOutLine extends X_M_InOutLine
|
|||
{
|
||||
String whereClause = "C_OrderLine_ID=?" + (!Util.isEmpty(where, true) ? " AND "+where : "");
|
||||
List<MInOutLine> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{C_OrderLine_ID})
|
||||
.setParameters(C_OrderLine_ID)
|
||||
.list();
|
||||
return list.toArray (new MInOutLine[list.size()]);
|
||||
} // getOfOrderLine
|
||||
|
@ -78,7 +78,7 @@ public class MInOutLine extends X_M_InOutLine
|
|||
{
|
||||
String whereClause = "M_RMALine_ID=? " + (!Util.isEmpty(where, true) ? " AND "+where : "");
|
||||
List<MRMALine> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{M_RMALine_ID})
|
||||
.setParameters(M_RMALine_ID)
|
||||
.list();
|
||||
return list.toArray (new MInOutLine[list.size()]);
|
||||
} // getOfRMALine
|
||||
|
|
|
@ -46,8 +46,8 @@ public class MInOutLineMA extends X_M_InOutLineMA
|
|||
public static MInOutLineMA[] get (Properties ctx, int M_InOutLine_ID, String trxName)
|
||||
{
|
||||
Query query = MTable.get(ctx, MInOutLineMA.Table_Name)
|
||||
.createQuery(MInOutLineMA.COLUMNNAME_M_InOutLine_ID+"=?", trxName);
|
||||
query.setParameters(new Object[]{M_InOutLine_ID});
|
||||
.createQuery(I_M_InOutLineMA.COLUMNNAME_M_InOutLine_ID+"=?", trxName);
|
||||
query.setParameters(M_InOutLine_ID);
|
||||
List<MInOutLineMA> list = query.list();
|
||||
MInOutLineMA[] retValue = new MInOutLineMA[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
|
|
@ -48,8 +48,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 910998472569265447L;
|
||||
|
||||
private static final long serialVersionUID = -7137974064086172763L;
|
||||
|
||||
/**
|
||||
* Get Inventory from Cache
|
||||
|
@ -145,8 +144,8 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
return m_lines;
|
||||
}
|
||||
//
|
||||
List<MInventoryLine> list = new Query(getCtx(), MInventoryLine.Table_Name, "M_Inventory_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
List<MInventoryLine> list = new Query(getCtx(), I_M_InventoryLine.Table_Name, "M_Inventory_ID=?", get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.setOrderBy(MInventoryLine.COLUMNNAME_Line)
|
||||
.list();
|
||||
m_lines = list.toArray(new MInventoryLine[list.size()]);
|
||||
|
|
|
@ -39,8 +39,7 @@ public class MInventoryLine extends X_M_InventoryLine
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1336000922103246463L;
|
||||
|
||||
private static final long serialVersionUID = 5649152656460089476L;
|
||||
|
||||
/**
|
||||
* Get Inventory Line with parameters
|
||||
|
@ -55,8 +54,8 @@ public class MInventoryLine extends X_M_InventoryLine
|
|||
{
|
||||
final String whereClause = "M_Inventory_ID=? AND M_Locator_ID=?"
|
||||
+" AND M_Product_ID=? AND M_AttributeSetInstance_ID=?";
|
||||
return new Query(inventory.getCtx(), MInventoryLine.Table_Name, whereClause, inventory.get_TrxName())
|
||||
.setParameters(new Object[]{inventory.get_ID(), M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID})
|
||||
return new Query(inventory.getCtx(), I_M_InventoryLine.Table_Name, whereClause, inventory.get_TrxName())
|
||||
.setParameters(inventory.get_ID(), M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID)
|
||||
.firstOnly();
|
||||
} // get
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
public static MInvoice[] getOfBPartner (Properties ctx, int C_BPartner_ID, String trxName)
|
||||
{
|
||||
List<MInvoice> list = new Query(ctx, Table_Name, COLUMNNAME_C_BPartner_ID+"=?", trxName)
|
||||
.setParameters(new Object[]{C_BPartner_ID})
|
||||
.setParameters(C_BPartner_ID)
|
||||
.list();
|
||||
return list.toArray(new MInvoice[list.size()]);
|
||||
} // getOfBPartner
|
||||
|
@ -630,9 +630,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
String whereClauseFinal = "C_Invoice_ID=? ";
|
||||
if (whereClause != null)
|
||||
whereClauseFinal += whereClause;
|
||||
List<MInvoiceLine> list = new Query(getCtx(), MInvoiceLine.Table_Name, whereClauseFinal, get_TrxName())
|
||||
.setParameters(new Object[]{getC_Invoice_ID()})
|
||||
.setOrderBy(MInvoiceLine.COLUMNNAME_Line)
|
||||
List<MInvoiceLine> list = new Query(getCtx(), I_C_InvoiceLine.Table_Name, whereClauseFinal, get_TrxName())
|
||||
.setParameters(getC_Invoice_ID())
|
||||
.setOrderBy(I_C_InvoiceLine.COLUMNNAME_Line)
|
||||
.list();
|
||||
return list.toArray(new MInvoiceLine[list.size()]);
|
||||
} // getLines
|
||||
|
@ -784,8 +784,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
return m_taxes;
|
||||
|
||||
final String whereClause = MInvoiceTax.COLUMNNAME_C_Invoice_ID+"=?";
|
||||
List<MInvoiceTax> list = new Query(getCtx(), MInvoiceTax.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
List<MInvoiceTax> list = new Query(getCtx(), I_C_InvoiceTax.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.list();
|
||||
m_taxes = list.toArray(new MInvoiceTax[list.size()]);
|
||||
return m_taxes;
|
||||
|
@ -1681,8 +1681,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
m_processMsg = "Could not create PO Matching";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
else
|
||||
else {
|
||||
matchPO++;
|
||||
if (MClient.isClientAccountingImmediate()) {
|
||||
String ignoreError = DocumentEngine.postImmediate(po.getCtx(), po.getAD_Client_ID(), po.get_Table_ID(), po.get_ID(), true, po.get_TrxName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1720,8 +1724,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching");
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
else
|
||||
else {
|
||||
matchInv++;
|
||||
if (MClient.isClientAccountingImmediate()) {
|
||||
String ignoreError = DocumentEngine.postImmediate(inv.getCtx(), inv.getAD_Client_ID(), inv.get_Table_ID(), inv.get_ID(), true, inv.get_TrxName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} // for all lines
|
||||
if (matchInv > 0)
|
||||
|
|
|
@ -74,7 +74,7 @@ public class MInvoiceTax extends X_C_InvoiceTax
|
|||
}
|
||||
|
||||
retValue = new Query(line.getCtx(), Table_Name, "C_Invoice_ID=? AND C_Tax_ID=?", trxName)
|
||||
.setParameters(new Object[]{line.getC_Invoice_ID(), C_Tax_ID})
|
||||
.setParameters(line.getC_Invoice_ID(), C_Tax_ID)
|
||||
.firstOnly();
|
||||
if (retValue != null)
|
||||
{
|
||||
|
|
|
@ -215,9 +215,9 @@ public class MJournal extends X_GL_Journal implements DocAction
|
|||
public MJournalLine[] getLines (boolean requery)
|
||||
{
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "GL_Journal_ID=?";
|
||||
List <MJournalLine> list = new Query(getCtx(), MJournalLine.Table_Name, whereClause.toString(), null)
|
||||
.setParameters(new Object[]{getGL_Journal_ID()})
|
||||
final String whereClause = "GL_Journal_ID=?";
|
||||
List <MJournalLine> list = new Query(getCtx(), I_GL_JournalLine.Table_Name, whereClause, null)
|
||||
.setParameters(getGL_Journal_ID())
|
||||
.setOrderBy("Line")
|
||||
.list();
|
||||
//
|
||||
|
|
|
@ -474,16 +474,13 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
|
|||
;
|
||||
else
|
||||
{
|
||||
String status = journal.completeIt();
|
||||
if (!DocAction.STATUS_Completed.equals(status))
|
||||
journal.processIt(DocAction.ACTION_Complete);
|
||||
journal.saveEx();
|
||||
if (!DocAction.STATUS_Completed.equals(journal.getDocStatus()))
|
||||
{
|
||||
journal.setDocStatus(status);
|
||||
journal.save();
|
||||
m_processMsg = journal.getProcessMsg();
|
||||
return status;
|
||||
return journal.getDocStatus();
|
||||
}
|
||||
journal.setDocStatus(DOCSTATUS_Completed);
|
||||
journal.save();
|
||||
}
|
||||
//
|
||||
TotalDr = TotalDr.add(journal.getTotalDr());
|
||||
|
|
|
@ -70,7 +70,7 @@ public class MLanguage extends X_AD_Language
|
|||
public static MLanguage get (Properties ctx, String AD_Language)
|
||||
{
|
||||
return new Query(ctx, Table_Name, COLUMNNAME_AD_Language+"=?", null)
|
||||
.setParameters(new Object[]{AD_Language})
|
||||
.setParameters(AD_Language)
|
||||
.firstOnly();
|
||||
} // get
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class MLanguage extends X_AD_Language
|
|||
public static MLanguage[] getWithLanguage (Properties ctx, String LanguageISO)
|
||||
{
|
||||
List<MLanguage> list = new Query(ctx, Table_Name, COLUMNNAME_LanguageISO+"=?", null)
|
||||
.setParameters(new Object[]{LanguageISO})
|
||||
.setParameters(LanguageISO)
|
||||
.list();
|
||||
return list.toArray(new MLanguage[list.size()]);
|
||||
} // get
|
||||
|
@ -95,7 +95,7 @@ public class MLanguage extends X_AD_Language
|
|||
public static void maintain (Properties ctx)
|
||||
{
|
||||
List<MLanguage> list = new Query(ctx, Table_Name, "IsSystemLanguage=? AND IsBaseLanguage=?", null)
|
||||
.setParameters(new Object[]{true, false})
|
||||
.setParameters(true, false)
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
for (MLanguage language : list) {
|
||||
|
@ -138,7 +138,6 @@ public class MLanguage extends X_AD_Language
|
|||
* @param LanguageISO language code
|
||||
* @param trxName transaction
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private MLanguage (Properties ctx, String AD_Language, String Name,
|
||||
String CountryCode, String LanguageISO, String trxName)
|
||||
{
|
||||
|
|
|
@ -54,9 +54,9 @@ public class MLot extends X_M_Lot
|
|||
public static MLot[] getProductLots (Properties ctx, int M_Product_ID, String trxName)
|
||||
{
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "M_Product_ID=?";
|
||||
List <MLot> list = new Query(ctx, MLot.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{M_Product_ID})
|
||||
final String whereClause = "M_Product_ID=?";
|
||||
List <MLot> list = new Query(ctx, I_M_Lot.Table_Name, whereClause, trxName)
|
||||
.setParameters(M_Product_ID)
|
||||
.list();
|
||||
//
|
||||
MLot[] retValue = new MLot[list.size()];
|
||||
|
@ -70,32 +70,15 @@ public class MLot extends X_M_Lot
|
|||
* @param M_Product_ID product
|
||||
* @param lot
|
||||
* @param trxName transaction
|
||||
* @return Array of Lots for Product
|
||||
* @return Last Lot for Product
|
||||
*/
|
||||
public static MLot getProductLot (Properties ctx, int M_Product_ID, String lot, String trxName)
|
||||
{
|
||||
String sql = "SELECT * FROM M_Lot WHERE M_Product_ID=? AND Name=?";
|
||||
MLot retValue = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, M_Product_ID);
|
||||
pstmt.setString(2, lot);
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
retValue = new MLot (ctx, rs, trxName);
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
final String whereClause = "M_Product_ID=? AND Name=?";
|
||||
MLot retValue = new Query(ctx, I_M_Lot.Table_Name, whereClause, trxName)
|
||||
.setParameters(M_Product_ID, lot)
|
||||
.setOrderBy(I_M_Lot.COLUMNNAME_M_Lot_ID + " DESC")
|
||||
.first();
|
||||
return retValue;
|
||||
} // getProductLot
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ public class MMatchInv extends X_M_MatchInv
|
|||
return new MMatchInv[]{};
|
||||
//
|
||||
final String whereClause = "M_InOutLine_ID=? AND C_InvoiceLine_ID=?";
|
||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{M_InOutLine_ID, C_InvoiceLine_ID})
|
||||
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(M_InOutLine_ID, C_InvoiceLine_ID)
|
||||
.list();
|
||||
return list.toArray (new MMatchInv[list.size()]);
|
||||
} // get
|
||||
|
@ -86,8 +86,8 @@ public class MMatchInv extends X_M_MatchInv
|
|||
return new MMatchInv[]{};
|
||||
//
|
||||
String whereClause = "C_InvoiceLine_ID=?";
|
||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{C_InvoiceLine_ID})
|
||||
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(C_InvoiceLine_ID)
|
||||
.list();
|
||||
return list.toArray (new MMatchInv[list.size()]);
|
||||
} // getInvoiceLine
|
||||
|
@ -107,8 +107,8 @@ public class MMatchInv extends X_M_MatchInv
|
|||
//
|
||||
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=?)";
|
||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{M_InOut_ID})
|
||||
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(M_InOut_ID)
|
||||
.list();
|
||||
return list.toArray (new MMatchInv[list.size()]);
|
||||
} // getInOut
|
||||
|
@ -128,8 +128,8 @@ public class MMatchInv extends X_M_MatchInv
|
|||
//
|
||||
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=?)";
|
||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{C_Invoice_ID})
|
||||
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(C_Invoice_ID)
|
||||
.list();
|
||||
return list.toArray (new MMatchInv[list.size()]);
|
||||
} // getInvoice
|
||||
|
@ -429,7 +429,11 @@ public class MMatchInv extends X_M_MatchInv
|
|||
if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns))
|
||||
qty = getQty().negate();
|
||||
//
|
||||
BigDecimal price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal price = null;
|
||||
if (cd.getQty().compareTo(Env.ZERO) == 0) // avoid division by zero
|
||||
price = Env.ZERO;
|
||||
else
|
||||
price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
|
||||
cd.setDeltaAmt(price.multiply(qty.negate()));
|
||||
cd.setDeltaQty(qty.negate());
|
||||
cd.setProcessed(false);
|
||||
|
@ -470,8 +474,8 @@ public class MMatchInv extends X_M_MatchInv
|
|||
}
|
||||
//
|
||||
final String whereClause = MMatchInv.COLUMNNAME_M_InOutLine_ID+"=?";
|
||||
List<MMatchInv> list = new Query(ctx, MMatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{M_InOutLine_ID})
|
||||
List<MMatchInv> list = new Query(ctx, I_M_MatchInv.Table_Name, whereClause, trxName)
|
||||
.setParameters(M_InOutLine_ID)
|
||||
.list();
|
||||
return list.toArray (new MMatchInv[list.size()]);
|
||||
} // getInOutLine
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.ArrayList;
|
|||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.report.MReportTree;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
|
|
@ -102,8 +102,8 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
}
|
||||
//
|
||||
final String whereClause = "M_Movement_ID=?";
|
||||
List<MMovement> list = new Query(getCtx(), MMovementLine.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{getM_Movement_ID()})
|
||||
List<MMovementLine> list = new Query(getCtx(), I_M_MovementLine.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(getM_Movement_ID())
|
||||
.setOrderBy(MMovementLine.COLUMNNAME_Line)
|
||||
.list();
|
||||
m_lines = new MMovementLine[list.size ()];
|
||||
|
@ -121,8 +121,8 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
if (m_confirms != null && !requery)
|
||||
return m_confirms;
|
||||
|
||||
List<MMovementConfirm> list = new Query(getCtx(), MMovementConfirm.Table_Name, "M_Movement_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
List<MMovementConfirm> list = new Query(getCtx(), I_M_MovementConfirm.Table_Name, "M_Movement_ID=?", get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.list();
|
||||
m_confirms = list.toArray(new MMovementConfirm[list.size()]);
|
||||
return m_confirms;
|
||||
|
|
|
@ -335,7 +335,7 @@ public class MMovementLine extends X_M_MovementLine
|
|||
whereClause += " AND (" + where + ")";
|
||||
//
|
||||
List<MMovementLine> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{DD_OrderLine_ID})
|
||||
.setParameters(DD_OrderLine_ID)
|
||||
.list();
|
||||
return list.toArray(new MMovementLine[list.size()]);
|
||||
} // getOfOrderLine
|
||||
|
|
|
@ -639,14 +639,14 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
public MOrderLine[] getLines (String whereClause, String orderClause)
|
||||
{
|
||||
//red1 - using new Query class from Teo / Victor's MDDOrder.java implementation
|
||||
StringBuffer whereClauseFinal = new StringBuffer(MOrderLine.COLUMNNAME_C_Order_ID+"=?");
|
||||
StringBuffer whereClauseFinal = new StringBuffer(MOrderLine.COLUMNNAME_C_Order_ID+"=? ");
|
||||
if (!Util.isEmpty(whereClause, true))
|
||||
whereClauseFinal.append(whereClause);
|
||||
if (orderClause.length() == 0)
|
||||
orderClause = MOrderLine.COLUMNNAME_Line;
|
||||
//
|
||||
List<MOrderLine> list = new Query(getCtx(), MOrderLine.Table_Name, whereClauseFinal.toString(), get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
List<MOrderLine> list = new Query(getCtx(), I_C_OrderLine.Table_Name, whereClauseFinal.toString(), get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.setOrderBy(orderClause)
|
||||
.list();
|
||||
for (MOrderLine ol : list) {
|
||||
|
@ -731,8 +731,8 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
if (m_taxes != null && !requery)
|
||||
return m_taxes;
|
||||
//
|
||||
List<MOrderTax> list = new Query(getCtx(), MOrderTax.Table_Name, "C_Order_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
List<MOrderTax> list = new Query(getCtx(), I_C_OrderTax.Table_Name, "C_Order_ID=?", get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.list();
|
||||
m_taxes = list.toArray(new MOrderTax[list.size()]);
|
||||
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"
|
||||
+" AND il.C_OrderLine_ID=ol.C_OrderLine_ID"
|
||||
+" AND ol.C_Order_ID=?)";
|
||||
List<MInvoice> list = new Query(getCtx(), MInvoice.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
List<MInvoice> list = new Query(getCtx(), I_C_Invoice.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.setOrderBy("C_Invoice_ID DESC")
|
||||
.list();
|
||||
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"
|
||||
+" AND iol.C_OrderLine_ID=ol.C_OrderLine_ID"
|
||||
+" AND ol.C_Order_ID=?)";
|
||||
List<MInvoice> list = new Query(getCtx(), MInOut.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
List<MInvoice> list = new Query(getCtx(), I_M_InOut.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.setOrderBy("M_InOut_ID DESC")
|
||||
.list();
|
||||
return list.toArray(new MInOut[list.size()]);
|
||||
|
@ -1790,10 +1790,9 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
}
|
||||
}
|
||||
// Manually Process Shipment
|
||||
String status = shipment.completeIt();
|
||||
shipment.setDocStatus(status);
|
||||
shipment.save(get_TrxName());
|
||||
if (!DOCSTATUS_Completed.equals(status))
|
||||
shipment.processIt(DocAction.ACTION_Complete);
|
||||
shipment.saveEx(get_TrxName());
|
||||
if (!DOCSTATUS_Completed.equals(shipment.getDocStatus()))
|
||||
{
|
||||
m_processMsg = "@M_InOut_ID@: " + shipment.getProcessMsg();
|
||||
return null;
|
||||
|
@ -1877,11 +1876,10 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
}
|
||||
}
|
||||
// Manually Process Invoice
|
||||
String status = invoice.completeIt();
|
||||
invoice.setDocStatus(status);
|
||||
invoice.save(get_TrxName());
|
||||
invoice.processIt(DocAction.ACTION_Complete);
|
||||
invoice.saveEx(get_TrxName());
|
||||
setC_CashLine_ID(invoice.getC_CashLine_ID());
|
||||
if (!DOCSTATUS_Completed.equals(status))
|
||||
if (!DOCSTATUS_Completed.equals(invoice.getDocStatus()))
|
||||
{
|
||||
m_processMsg = "@C_Invoice_ID@: " + invoice.getProcessMsg();
|
||||
return null;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MOrg extends X_AD_Org
|
|||
List<MOrg> list = new Query(po.getCtx(), Table_Name, "AD_Client_ID=?", null)
|
||||
.setOrderBy(COLUMNNAME_Value)
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{po.getAD_Client_ID()})
|
||||
.setParameters(po.getAD_Client_ID())
|
||||
.list();
|
||||
for (MOrg org : list)
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MOrgInfo extends X_AD_OrgInfo
|
|||
return retValue;
|
||||
}
|
||||
retValue = new Query(ctx, Table_Name, "AD_Org_ID=?", null)
|
||||
.setParameters(new Object[]{AD_Org_ID})
|
||||
.setParameters(AD_Org_ID)
|
||||
.firstOnly();
|
||||
if (retValue != null)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -39,10 +40,11 @@ import org.compiere.util.Env;
|
|||
*/
|
||||
public class MPInstance extends X_AD_PInstance
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 209806970824523840L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5848424269552679604L;
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
|
@ -124,38 +126,12 @@ public class MPInstance extends X_AD_PInstance
|
|||
{
|
||||
if (m_parameters != null)
|
||||
return m_parameters;
|
||||
ArrayList<MPInstancePara> list = new ArrayList<MPInstancePara>();
|
||||
//
|
||||
String sql = "SELECT * FROM AD_PInstance_Para WHERE AD_PInstance_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
list.add(new MPInstancePara(getCtx(), rs, null));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
pstmt = null;
|
||||
}
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
final String whereClause = "AD_PInstance_ID=?";
|
||||
List <MPInstancePara> list = new Query(getCtx(), I_AD_PInstance_Para.Table_Name, whereClause, null) // @TODO: Review implications of using transaction
|
||||
.setParameters(getAD_PInstance_ID())
|
||||
.list();
|
||||
|
||||
//
|
||||
m_parameters = new MPInstancePara[list.size()];
|
||||
list.toArray(m_parameters);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class MPOS extends X_C_POS
|
|||
{
|
||||
String whereClause = field+"=?";
|
||||
List<MPOS> list = new Query(ctx, Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{ID})
|
||||
.setParameters(ID)
|
||||
.setOnlyActiveRecords(true)
|
||||
.setOrderBy(COLUMNNAME_Name)
|
||||
.list();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue