[ FR 2836965 ] Group1 and Group2 fields are not considered in Schema Lines (Fixed)

http://sourceforge.net/tracker/index.php?func=detail&aid=2836965&group_id=176962&atid=879335
[ FR 1871403 ] Adding new field of product into Price List Schema (Fixed)
http://sourceforge.net/tracker/index.php?func=detail&aid=1871403&group_id=176962&atid=879335
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2836965
This commit is contained in:
mjudd 2010-02-25 13:12:33 +00:00
parent 8aaa009751
commit d4834a9372
1 changed files with 61 additions and 57 deletions

View File

@ -264,6 +264,7 @@ public class M_PriceList_Create extends SvrProcess {
+ " ,limit_addamt" + " ,limit_discount" + " ,limit_addamt" + " ,limit_discount"
+ " ,limit_rounding" + " ,limit_minamt" + " ,limit_rounding" + " ,limit_minamt"
+ " ,limit_maxamt" + " ,limit_fixed" + " ,limit_maxamt" + " ,limit_fixed"
+ " ,group1" + " ,group2"
+ " ,c_conversiontype_id" + " ,c_conversiontype_id"
+ " FROM M_DiscountSchemaLine" + " FROM M_DiscountSchemaLine"
+ " WHERE M_DiscountSchema_ID=" + " WHERE M_DiscountSchema_ID="
@ -292,10 +293,9 @@ public class M_PriceList_Create extends SvrProcess {
// //
sqlins = "INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID) " sqlins = "INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID) "
+ " SELECT DISTINCT " + m_AD_PInstance_ID +", po.M_Product_ID " + " SELECT DISTINCT " + m_AD_PInstance_ID +", po.M_Product_ID "
+ " FROM M_Product p, M_Product_PO po" + " FROM M_Product p, M_Product_PO po"
+ " WHERE p.M_Product_ID=po.M_Product_ID " + " WHERE p.M_Product_ID=po.M_Product_ID "
+ " AND (p.AD_Client_ID=" + " AND (p.AD_Client_ID=" + v.getInt("AD_Client_ID")
+ v.getInt("AD_Client_ID")
+ " OR p.AD_Client_ID=0)" + " OR p.AD_Client_ID=0)"
+ " AND p.IsActive='Y' AND po.IsActive='Y' AND po.IsCurrentVendor='Y' " + " AND p.IsActive='Y' AND po.IsActive='Y' AND po.IsCurrentVendor='Y' "
// //
@ -303,15 +303,16 @@ public class M_PriceList_Create extends SvrProcess {
// //
// globalqss - detected bug, JDBC returns zero for null values // globalqss - detected bug, JDBC returns zero for null values
// so we're going to use NULLIF(value, 0) // so we're going to use NULLIF(value, 0)
+ " AND (NULLIF(" + dl.getInt("M_Product_Category_ID") + " AND (NULLIF(" + dl.getInt("M_Product_Category_ID") + ",0) IS NULL"
+ ",0) IS NULL OR p.M_Product_Category_ID IN (" + " OR p.M_Product_Category_ID IN (" + getSubCategoryWhereClause(dl.getInt("M_Product_Category_ID")) + "))"
+ getSubCategoryWhereClause(dl.getInt("M_Product_Category_ID")) + "))" + " AND (NULLIF(" + dl.getInt("C_BPartner_ID") + ",0) IS NULL OR po.C_BPartner_ID=" + dl.getInt("C_BPartner_ID") + ")"
+ " AND (NULLIF(" + dl.getInt("C_BPartner_ID") + " AND (NULLIF(" + dl.getInt("M_Product_ID") + ",0) IS NULL OR p.M_Product_ID=" + dl.getInt("M_Product_ID") + ")";
+ ",0) IS NULL OR po.C_BPartner_ID="
+ dl.getInt("C_BPartner_ID") + ")" if (dl.getString("Group1")!=null)
+ " AND (NULLIF(" + dl.getInt("M_Product_ID") sqlins = sqlins + " AND (p.Group1=('" + dl.getString("Group1") + "'))";
+ ",0) IS NULL OR p.M_Product_ID=" if (dl.getString("Group2")!=null)
+ dl.getInt("M_Product_ID") + ")"; sqlins = sqlins + " AND (p.Group2=('" + dl.getString("Group2") + "'))";
cnti = DB.executeUpdate(sqlins, get_TrxName()); cnti = DB.executeUpdate(sqlins, get_TrxName());
if (cnti == -1) if (cnti == -1)
raiseError(" INSERT INTO T_Selection ", sqlins); raiseError(" INSERT INTO T_Selection ", sqlins);
@ -323,54 +324,57 @@ public class M_PriceList_Create extends SvrProcess {
// Create Selection from existing PriceList // Create Selection from existing PriceList
// //
sqlins = "INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID)" sqlins = "INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID)"
+ " SELECT DISTINCT " + m_AD_PInstance_ID +", p.M_Product_ID" + " SELECT DISTINCT " + m_AD_PInstance_ID +", p.M_Product_ID"
+ " FROM M_Product p, M_ProductPrice pp" + " FROM M_Product p, M_ProductPrice pp"
+ " WHERE p.M_Product_ID=pp.M_Product_ID" + " WHERE p.M_Product_ID=pp.M_Product_ID"
+ " AND pp.M_PriceList_Version_ID = " + " AND pp.M_PriceList_Version_ID = " + v.getInt("M_PriceList_Version_Base_ID")
+ v.getInt("M_PriceList_Version_Base_ID")
+ " AND p.IsActive='Y' AND pp.IsActive='Y'" + " AND p.IsActive='Y' AND pp.IsActive='Y'"
// //
//Optional Restrictions //Optional Restrictions
// //
+ " AND (NULLIF(" + dl.getInt("M_Product_Category_ID") + " AND (NULLIF(" + dl.getInt("M_Product_Category_ID") + ",0) IS NULL"
+ ",0) IS NULL OR p.M_Product_Category_ID IN (" + " OR p.M_Product_Category_ID IN (" + getSubCategoryWhereClause(dl.getInt("M_Product_Category_ID")) + "))"
+ getSubCategoryWhereClause(dl.getInt("M_Product_Category_ID")) + "))" + " AND (NULLIF(" + dl.getInt("C_BPartner_ID") + ",0) IS NULL OR EXISTS "
+ " AND (NULLIF(" + dl.getInt("C_BPartner_ID") + "(SELECT m_product_id"
+ ",0) IS NULL OR EXISTS " + ",c_bpartner_id"
+ " (SELECT m_product_id" + ",ad_client_id"
+ " , c_bpartner_id" + ",ad_org_id"
+ " , ad_client_id" + ",isactive"
+ " , ad_org_id" + ",created "
+ " , isactive" + ",createdby"
+ " , created " + ",updated "
+ " , createdby" + ",updatedby"
+ " , updated " + ",iscurrentvendor"
+ " , updatedby" + ",c_uom_id"
+ " , iscurrentvendor" + ",c_currency_id"
+ " , c_uom_id" + ",pricelist"
+ " , c_currency_id" + ",pricepo"
+ " , pricelist" + ",priceeffective"
+ " , pricepo" + ",pricelastpo"
+ " ,priceeffective" + ",pricelastinv"
+ " ,pricelastpo" + ",vendorproductno"
+ " ,pricelastinv" + ",upc"
+ " ,vendorproductno" + ",vendorcategory"
+ " ,upc" + ",discontinued"
+ " ,vendorcategory" + ",discontinuedby"
+ " ,discontinued" + ",order_min"
+ " ,discontinuedby" + ",order_pack"
+ " ,order_min" + ",costperorder"
+ " ,order_pack" + ",deliverytime_promised"
+ " ,costperorder" + ",deliverytime_actual"
+ " ,deliverytime_promised" + ",qualityrating"
+ " ,deliverytime_actual" + ",royaltyamt"
+ " ,qualityrating" + ",group1"
+ " ,royaltyamt" + ",group2"
+ " , manufacturer FROM M_Product_PO po WHERE po.M_Product_ID=p.M_Product_ID AND po.C_BPartner_ID=" + ",manufacturer FROM M_Product_PO po WHERE po.M_Product_ID=p.M_Product_ID"
+ dl.getInt("C_BPartner_ID") + "))" + " AND po.C_BPartner_ID=" + dl.getInt("C_BPartner_ID") + "))"
+ " AND (NULLIF(" + dl.getInt("M_Product_ID") + " AND (NULLIF(" + dl.getInt("M_Product_ID") + ",0) IS NULL OR p.M_Product_ID=" + dl.getInt("M_Product_ID") + ")";
+ ",0) IS NULL OR p.M_Product_ID="
+ dl.getInt("M_Product_ID") + ")"; if (dl.getString("Group1")!=null)
sqlins = sqlins + " AND (p.Group1=('" + dl.getString("Group1") + "'))";
if (dl.getString("Group2")!=null)
sqlins = sqlins + " AND (p.Group2=('" + dl.getString("Group2") + "'))";
cnti = DB.executeUpdate(sqlins, get_TrxName()); cnti = DB.executeUpdate(sqlins, get_TrxName());
if (cnti == -1) if (cnti == -1)
raiseError( raiseError(