IDEMPIERE-2540:Allowing Vendor qty break to specify breaks for all customers

This commit is contained in:
Deepak Pansheriya 2015-03-25 13:13:15 +05:30
parent b20eccf1ab
commit 23a9ccd7e0
3 changed files with 60 additions and 7 deletions

View File

@ -0,0 +1,28 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2540: Allowing Vendor qty break to specify breaks for all customers
-- Mar 25, 2015 12:46:56 PM IST
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2015-03-25 12:46:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56928
;
-- Mar 25, 2015 12:46:59 PM IST
ALTER TABLE M_ProductPriceVendorBreak MODIFY C_BPartner_ID NUMBER(10) DEFAULT NULL
;
-- Mar 25, 2015 12:47:00 PM IST
ALTER TABLE M_ProductPriceVendorBreak MODIFY C_BPartner_ID NULL
;
-- Mar 25, 2015 12:47:00 PM IST
ALTER TABLE M_ProductPriceVendorBreak DROP CONSTRAINT cbpartner_mproductpricevendorb
;
-- Mar 25, 2015 12:47:00 PM IST
ALTER TABLE M_ProductPriceVendorBreak ADD CONSTRAINT cbpartner_mproductpricevendorb FOREIGN KEY (C_BPartner_ID) REFERENCES c_bpartner(c_bpartner_id) DEFERRABLE INITIALLY DEFERRED
;
SELECT register_migration_script('201503251255_IDEMPIERE-2540') FROM dual
;

View File

@ -0,0 +1,25 @@
-- IDEMPIERE-2540: Allowing Vendor qty break to specify breaks for all customers
-- Mar 25, 2015 12:46:56 PM IST
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2015-03-25 12:46:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56928
;
-- Mar 25, 2015 12:46:59 PM IST
INSERT INTO t_alter_column values('m_productpricevendorbreak','C_BPartner_ID','NUMERIC(10)',null,'NULL')
;
-- Mar 25, 2015 12:47:00 PM IST
INSERT INTO t_alter_column values('m_productpricevendorbreak','C_BPartner_ID',null,'NULL',null)
;
-- Mar 25, 2015 12:47:00 PM IST
ALTER TABLE M_ProductPriceVendorBreak DROP CONSTRAINT cbpartner_mproductpricevendorb
;
-- Mar 25, 2015 12:47:00 PM IST
ALTER TABLE M_ProductPriceVendorBreak ADD CONSTRAINT cbpartner_mproductpricevendorb FOREIGN KEY (C_BPartner_ID) REFERENCES c_bpartner(c_bpartner_id) DEFERRABLE INITIALLY DEFERRED
;
SELECT register_migration_script('201503251255_IDEMPIERE-2540') FROM dual
;

View File

@ -52,7 +52,7 @@ public class MProductPricing
m_Qty = Qty; m_Qty = Qty;
m_isSOTrx = isSOTrx; m_isSOTrx = isSOTrx;
int thereAreVendorBreakRecords = DB.getSQLValue(null, int thereAreVendorBreakRecords = DB.getSQLValue(null,
"SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND C_BPartner_ID=?", "SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)",
m_M_Product_ID, m_C_BPartner_ID); m_M_Product_ID, m_C_BPartner_ID);
m_useVendorBreak = thereAreVendorBreakRecords > 0; m_useVendorBreak = thereAreVendorBreakRecords > 0;
} // MProductPricing } // MProductPricing
@ -440,9 +440,9 @@ public class MProductPricing
+ " AND pp.IsActive='Y'" + " AND pp.IsActive='Y'"
+ " AND p.M_Product_ID=?" // #1 + " AND p.M_Product_ID=?" // #1
+ " AND pv.M_PriceList_Version_ID=?" // #2 + " AND pv.M_PriceList_Version_ID=?" // #2
+ " AND pp.C_BPartner_ID=?" // #3 + " AND (pp.C_BPartner_ID=? OR pp.C_BPartner_ID is NULL)" // #3
+ " AND ?>=pp.BreakValue" // #4 + " AND ?>=pp.BreakValue" // #4
+ " ORDER BY BreakValue DESC"; + " ORDER BY pp.C_BPartner_ID, BreakValue DESC";
m_calculated = false; m_calculated = false;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -561,9 +561,9 @@ public class MProductPricing
+ " AND pp.IsActive='Y'" + " AND pp.IsActive='Y'"
+ " AND p.M_Product_ID=?" // #1 + " AND p.M_Product_ID=?" // #1
+ " AND pv.M_PriceList_ID=?" // #2 + " AND pv.M_PriceList_ID=?" // #2
+ " AND pp.C_BPartner_ID=?" // #3 + " AND (pp.C_BPartner_ID=? OR pp.C_BPartner_ID is NULL)" // #3
+ " AND ?>=pp.BreakValue" // #4 + " AND ?>=pp.BreakValue" // #4
+ " ORDER BY pv.ValidFrom DESC, BreakValue DESC"; + " ORDER BY pp.C_BPartner_ID, pv.ValidFrom DESC, BreakValue DESC";
m_calculated = false; m_calculated = false;
if (m_PriceDate == null) if (m_PriceDate == null)
m_PriceDate = new Timestamp (System.currentTimeMillis()); m_PriceDate = new Timestamp (System.currentTimeMillis());
@ -646,9 +646,9 @@ public class MProductPricing
+ " AND pp.IsActive='Y'" + " AND pp.IsActive='Y'"
+ " AND p.M_Product_ID=?" // #1 + " AND p.M_Product_ID=?" // #1
+ " AND pl.M_PriceList_ID=?" // #2 + " AND pl.M_PriceList_ID=?" // #2
+ " AND pp.C_BPartner_ID=?" // #3 + " AND (pp.C_BPartner_ID=? OR pp.C_BPartner_ID is NULL)" // #3
+ " AND ?>=pp.BreakValue" // #4 + " AND ?>=pp.BreakValue" // #4
+ " ORDER BY pv.ValidFrom DESC, BreakValue DESC"; + " ORDER BY pp.C_BPartner_ID, pv.ValidFrom DESC, BreakValue DESC";
m_calculated = false; m_calculated = false;
if (m_PriceDate == null) if (m_PriceDate == null)
m_PriceDate = new Timestamp (System.currentTimeMillis()); m_PriceDate = new Timestamp (System.currentTimeMillis());