- sponsor development, promotion. - fixed license header - fixed compilation warning
This commit is contained in:
parent
d561db337a
commit
3817fb61e2
|
@ -1,10 +1,30 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class MPromotion extends X_M_Promotion {
|
public class MPromotion extends X_M_Promotion {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5437777366112957770L;
|
||||||
|
|
||||||
public MPromotion(Properties ctx, int M_Promotion_ID, String trxName) {
|
public MPromotion(Properties ctx, int M_Promotion_ID, String trxName) {
|
||||||
super(ctx, M_Promotion_ID, trxName);
|
super(ctx, M_Promotion_ID, trxName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class MPromotionDistribution extends X_M_PromotionDistribution {
|
public class MPromotionDistribution extends X_M_PromotionDistribution {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1532619121257280486L;
|
||||||
|
|
||||||
public MPromotionDistribution(Properties ctx,
|
public MPromotionDistribution(Properties ctx,
|
||||||
int M_PromotionDistribution_ID, String trxName) {
|
int M_PromotionDistribution_ID, String trxName) {
|
||||||
super(ctx, M_PromotionDistribution_ID, trxName);
|
super(ctx, M_PromotionDistribution_ID, trxName);
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class MPromotionGroup extends X_M_PromotionGroup {
|
public class MPromotionGroup extends X_M_PromotionGroup {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4203915332775348579L;
|
||||||
|
|
||||||
public MPromotionGroup(Properties ctx, int M_PromotionGroup_ID,
|
public MPromotionGroup(Properties ctx, int M_PromotionGroup_ID,
|
||||||
String trxName) {
|
String trxName) {
|
||||||
super(ctx, M_PromotionGroup_ID, trxName);
|
super(ctx, M_PromotionGroup_ID, trxName);
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class MPromotionGroupLine extends X_M_PromotionGroupLine {
|
public class MPromotionGroupLine extends X_M_PromotionGroupLine {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -3945719908086926013L;
|
||||||
|
|
||||||
public MPromotionGroupLine(Properties ctx, int M_PromotionGroupLine_ID,
|
public MPromotionGroupLine(Properties ctx, int M_PromotionGroupLine_ID,
|
||||||
String trxName) {
|
String trxName) {
|
||||||
super(ctx, M_PromotionGroupLine_ID, trxName);
|
super(ctx, M_PromotionGroupLine_ID, trxName);
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
@ -5,6 +18,8 @@ import java.util.Properties;
|
||||||
|
|
||||||
public class MPromotionLine extends X_M_PromotionLine {
|
public class MPromotionLine extends X_M_PromotionLine {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8284722914757724765L;
|
||||||
|
|
||||||
public MPromotionLine(Properties ctx, int M_PromotionLine_ID, String trxName) {
|
public MPromotionLine(Properties ctx, int M_PromotionLine_ID, String trxName) {
|
||||||
super(ctx, M_PromotionLine_ID, trxName);
|
super(ctx, M_PromotionLine_ID, trxName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class MPromotionPreCondition extends X_M_PromotionPreCondition {
|
public class MPromotionPreCondition extends X_M_PromotionPreCondition {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7344556244799964804L;
|
||||||
|
|
||||||
public MPromotionPreCondition(Properties ctx,
|
public MPromotionPreCondition(Properties ctx,
|
||||||
int M_PromotionPreCondition_ID, String trxName) {
|
int M_PromotionPreCondition_ID, String trxName) {
|
||||||
super(ctx, M_PromotionPreCondition_ID, trxName);
|
super(ctx, M_PromotionPreCondition_ID, trxName);
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class MPromotionReward extends X_M_PromotionReward {
|
public class MPromotionReward extends X_M_PromotionReward {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1466367082383341103L;
|
||||||
|
|
||||||
public MPromotionReward(Properties ctx, int M_PromotionReward_ID,
|
public MPromotionReward(Properties ctx, int M_PromotionReward_ID,
|
||||||
String trxName) {
|
String trxName) {
|
||||||
super(ctx, M_PromotionReward_ID, trxName);
|
super(ctx, M_PromotionReward_ID, trxName);
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -21,6 +34,7 @@ import org.compiere.model.MOrderLine;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.Query;
|
import org.compiere.model.Query;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -72,13 +86,13 @@ public class PromotionRule {
|
||||||
OrderLineComparator olComparator = new OrderLineComparator(orderLineIndex);
|
OrderLineComparator olComparator = new OrderLineComparator(orderLineIndex);
|
||||||
//distribute order lines
|
//distribute order lines
|
||||||
for (Map.Entry<Integer, List<Integer>> entry : promotions.entrySet()) {
|
for (Map.Entry<Integer, List<Integer>> entry : promotions.entrySet()) {
|
||||||
Query query = new Query(MTable.get(order.getCtx(), I_M_PromotionDistribution.Table_ID),
|
Query query = new Query(Env.getCtx(), MTable.get(order.getCtx(), I_M_PromotionDistribution.Table_ID),
|
||||||
"M_PromotionDistribution.M_Promotion_ID = ? AND M_PromotionDistribution.IsActive = 'Y'", order.get_TrxName());
|
"M_PromotionDistribution.M_Promotion_ID = ? AND M_PromotionDistribution.IsActive = 'Y'", order.get_TrxName());
|
||||||
query.setParameters(new Object[]{entry.getKey()});
|
query.setParameters(new Object[]{entry.getKey()});
|
||||||
query.setOrderBy("SeqNo");
|
query.setOrderBy("SeqNo");
|
||||||
List<X_M_PromotionDistribution> list = query.<X_M_PromotionDistribution>list();
|
List<X_M_PromotionDistribution> list = query.<X_M_PromotionDistribution>list();
|
||||||
|
|
||||||
Query rewardQuery = new Query(MTable.get(order.getCtx(), I_M_PromotionReward.Table_ID),
|
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());
|
"M_PromotionReward.M_Promotion_ID = ? AND M_PromotionReward.IsActive = 'Y'", order.get_TrxName());
|
||||||
rewardQuery.setParameters(new Object[]{entry.getKey()});
|
rewardQuery.setParameters(new Object[]{entry.getKey()});
|
||||||
rewardQuery.setOrderBy("SeqNo");
|
rewardQuery.setOrderBy("SeqNo");
|
||||||
|
@ -504,7 +518,7 @@ public class PromotionRule {
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
private static List<Integer> findPromotionLine(int promotion_ID, MOrder order) throws SQLException {
|
private static List<Integer> findPromotionLine(int promotion_ID, MOrder order) throws SQLException {
|
||||||
Query query = new Query(MTable.get(order.getCtx(), I_M_PromotionLine.Table_ID), " M_PromotionLine.M_Promotion_ID = ? AND M_PromotionLine.IsActive = 'Y'", order.get_TrxName());
|
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});
|
query.setParameters(new Object[]{promotion_ID});
|
||||||
List<X_M_PromotionLine>plist = query.<X_M_PromotionLine>list();
|
List<X_M_PromotionLine>plist = query.<X_M_PromotionLine>list();
|
||||||
//List<M_PromotionLine_ID>
|
//List<M_PromotionLine_ID>
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 Low Heng Sin *
|
||||||
|
* Copyright (C) 2009 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.adempiere.model;
|
package org.adempiere.model;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
|
@ -11,6 +24,11 @@ import org.compiere.model.X_C_Order;
|
||||||
import org.compiere.model.X_C_OrderLine;
|
import org.compiere.model.X_C_OrderLine;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class PromotionValidator implements ModelValidator {
|
public class PromotionValidator implements ModelValidator {
|
||||||
|
|
||||||
private int m_AD_Client_ID;
|
private int m_AD_Client_ID;
|
||||||
|
|
Loading…
Reference in New Issue