- sponsor development, promotion.
- fixed license header
- fixed compilation warning
This commit is contained in:
Heng Sin Low 2009-06-25 12:20:48 +00:00
parent d561db337a
commit 3817fb61e2
9 changed files with 170 additions and 3 deletions

View File

@ -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;
import java.sql.ResultSet;
import java.util.Properties;
/**
*
* @author hengsin
*
*/
public class MPromotion extends X_M_Promotion {
private static final long serialVersionUID = 5437777366112957770L;
public MPromotion(Properties ctx, int M_Promotion_ID, String trxName) {
super(ctx, M_Promotion_ID, trxName);
}

View File

@ -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;
import java.sql.ResultSet;
import java.util.Properties;
/**
*
* @author hengsin
*
*/
public class MPromotionDistribution extends X_M_PromotionDistribution {
private static final long serialVersionUID = 1532619121257280486L;
public MPromotionDistribution(Properties ctx,
int M_PromotionDistribution_ID, String trxName) {
super(ctx, M_PromotionDistribution_ID, trxName);

View File

@ -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;
import java.sql.ResultSet;
import java.util.Properties;
/**
*
* @author hengsin
*
*/
public class MPromotionGroup extends X_M_PromotionGroup {
private static final long serialVersionUID = 4203915332775348579L;
public MPromotionGroup(Properties ctx, int M_PromotionGroup_ID,
String trxName) {
super(ctx, M_PromotionGroup_ID, trxName);

View File

@ -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;
import java.sql.ResultSet;
import java.util.Properties;
/**
*
* @author hengsin
*
*/
public class MPromotionGroupLine extends X_M_PromotionGroupLine {
private static final long serialVersionUID = -3945719908086926013L;
public MPromotionGroupLine(Properties ctx, int M_PromotionGroupLine_ID,
String trxName) {
super(ctx, M_PromotionGroupLine_ID, trxName);

View File

@ -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;
import java.sql.ResultSet;
@ -5,6 +18,8 @@ import java.util.Properties;
public class MPromotionLine extends X_M_PromotionLine {
private static final long serialVersionUID = -8284722914757724765L;
public MPromotionLine(Properties ctx, int M_PromotionLine_ID, String trxName) {
super(ctx, M_PromotionLine_ID, trxName);
}

View File

@ -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;
import java.sql.ResultSet;
import java.util.Properties;
/**
*
* @author hengsin
*
*/
public class MPromotionPreCondition extends X_M_PromotionPreCondition {
private static final long serialVersionUID = 7344556244799964804L;
public MPromotionPreCondition(Properties ctx,
int M_PromotionPreCondition_ID, String trxName) {
super(ctx, M_PromotionPreCondition_ID, trxName);

View File

@ -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;
import java.sql.ResultSet;
import java.util.Properties;
/**
*
* @author hengsin
*
*/
public class MPromotionReward extends X_M_PromotionReward {
private static final long serialVersionUID = -1466367082383341103L;
public MPromotionReward(Properties ctx, int M_PromotionReward_ID,
String trxName) {
super(ctx, M_PromotionReward_ID, trxName);

View File

@ -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;
import java.math.BigDecimal;
@ -21,6 +34,7 @@ import org.compiere.model.MOrderLine;
import org.compiere.model.MTable;
import org.compiere.model.Query;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
*
@ -72,13 +86,13 @@ public class PromotionRule {
OrderLineComparator olComparator = new OrderLineComparator(orderLineIndex);
//distribute order lines
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());
query.setParameters(new Object[]{entry.getKey()});
query.setOrderBy("SeqNo");
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());
rewardQuery.setParameters(new Object[]{entry.getKey()});
rewardQuery.setOrderBy("SeqNo");
@ -504,7 +518,7 @@ public class PromotionRule {
* @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});
List<X_M_PromotionLine>plist = query.<X_M_PromotionLine>list();
//List<M_PromotionLine_ID>

View File

@ -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;
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.util.DB;
/**
*
* @author hengsin
*
*/
public class PromotionValidator implements ModelValidator {
private int m_AD_Client_ID;