Fix [2962244] - Future dated price list version used in order
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2962244
This commit is contained in:
parent
159895bc9d
commit
edcd061da7
|
@ -321,7 +321,24 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
//
|
//
|
||||||
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
|
|
||||||
|
Timestamp invoiceDate = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced");
|
||||||
|
/** PLV is only accurate if PL selected in header */
|
||||||
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
||||||
|
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
|
||||||
|
{
|
||||||
|
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, invoiceDate);
|
||||||
|
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);
|
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
||||||
Timestamp date = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced");
|
Timestamp date = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced");
|
||||||
pp.setPriceDate(date);
|
pp.setPriceDate(date);
|
||||||
|
|
|
@ -621,7 +621,7 @@ public class CalloutOrder extends CalloutEngine
|
||||||
*/
|
*/
|
||||||
public String priceList (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
public String priceList (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
||||||
{
|
{
|
||||||
Integer M_PriceList_ID = (Integer)value;
|
Integer M_PriceList_ID = (Integer) mTab.getValue("M_PriceList_ID");
|
||||||
if (M_PriceList_ID == null || M_PriceList_ID.intValue()== 0)
|
if (M_PriceList_ID == null || M_PriceList_ID.intValue()== 0)
|
||||||
return "";
|
return "";
|
||||||
if (steps) log.warning("init");
|
if (steps) log.warning("init");
|
||||||
|
@ -640,7 +640,11 @@ public class CalloutOrder extends CalloutEngine
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, M_PriceList_ID.intValue());
|
pstmt.setInt(1, M_PriceList_ID.intValue());
|
||||||
Timestamp date = Env.getContextAsDate(ctx, WindowNo, "DateOrdered");
|
Timestamp date = new Timestamp(System.currentTimeMillis());
|
||||||
|
if (mTab.getAD_Table_ID() == I_C_Order.Table_ID)
|
||||||
|
date = Env.getContextAsDate(ctx, WindowNo, "DateOrdered");
|
||||||
|
else if (mTab.getAD_Table_ID() == I_C_Invoice.Table_ID)
|
||||||
|
date = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced");
|
||||||
pstmt.setTimestamp(2, date);
|
pstmt.setTimestamp(2, date);
|
||||||
|
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
@ -715,8 +719,6 @@ public class CalloutOrder extends CalloutEngine
|
||||||
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
||||||
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
|
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
String sql = "SELECT plv.M_PriceList_Version_ID "
|
String sql = "SELECT plv.M_PriceList_Version_ID "
|
||||||
+ "FROM M_PriceList_Version plv "
|
+ "FROM M_PriceList_Version plv "
|
||||||
+ "WHERE plv.M_PriceList_ID=? " // 1
|
+ "WHERE plv.M_PriceList_ID=? " // 1
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
-- Mar 16, 2010 10:59:51 PM COT
|
||||||
|
-- BF 2962244 Future dated price list version used in order
|
||||||
|
UPDATE AD_Column SET Callout=NULL,Updated=TO_DATE('2010-03-16 22:59:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56376
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Mar 16, 2010 11:00:48 PM COT
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutEngine.dateAcct; org.compiere.model.CalloutOrder.priceList',Updated=TO_DATE('2010-03-16 23:00:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2181
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Mar 16, 2010 11:00:51 PM COT
|
||||||
|
UPDATE AD_Column SET Callout=NULL,Updated=TO_DATE('2010-03-16 23:00:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2166
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Mar 16, 2010 11:01:11 PM COT
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutEngine.dateAcct; org.compiere.model.CalloutOrder.priceList',Updated=TO_DATE('2010-03-16 23:01:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3783
|
||||||
|
;
|
|
@ -0,0 +1,17 @@
|
||||||
|
-- Mar 16, 2010 10:59:51 PM COT
|
||||||
|
-- BF 2962244 Future dated price list version used in order
|
||||||
|
UPDATE AD_Column SET Callout=NULL,Updated=TO_TIMESTAMP('2010-03-16 22:59:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56376
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Mar 16, 2010 11:00:48 PM COT
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutEngine.dateAcct; org.compiere.model.CalloutOrder.priceList',Updated=TO_TIMESTAMP('2010-03-16 23:00:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2181
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Mar 16, 2010 11:00:51 PM COT
|
||||||
|
UPDATE AD_Column SET Callout=NULL,Updated=TO_TIMESTAMP('2010-03-16 23:00:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2166
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Mar 16, 2010 11:01:11 PM COT
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutEngine.dateAcct; org.compiere.model.CalloutOrder.priceList',Updated=TO_TIMESTAMP('2010-03-16 23:01:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3783
|
||||||
|
;
|
||||||
|
|
Loading…
Reference in New Issue