Integrate revision 11229

Fix -> Account date changed on completed invoices!

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2925992
This commit is contained in:
vpj-cd 2010-01-05 07:50:58 +00:00
parent d8768c00f9
commit 7a831046d0
1 changed files with 18 additions and 3 deletions

View File

@ -990,6 +990,8 @@ public class MOrder extends X_C_Order implements DocAction
if (!success || newRecord)
return success;
// TODO: The changes here with UPDATE are not being saved on change log - audit problem
// Propagate Description changes
if (is_ValueChanged("Description") || is_ValueChanged("POReference"))
{
@ -1004,12 +1006,12 @@ public class MOrder extends X_C_Order implements DocAction
// Propagate Changes of Payment Info to existing (not reversed/closed) invoices
if (is_ValueChanged("PaymentRule") || is_ValueChanged("C_PaymentTerm_ID")
|| is_ValueChanged("DateAcct") || is_ValueChanged("C_Payment_ID")
|| is_ValueChanged("C_Payment_ID")
|| is_ValueChanged("C_CashLine_ID"))
{
String sql = "UPDATE C_Invoice i "
+ "SET (PaymentRule,C_PaymentTerm_ID,DateAcct,C_Payment_ID,C_CashLine_ID)="
+ "(SELECT PaymentRule,C_PaymentTerm_ID,DateAcct,C_Payment_ID,C_CashLine_ID "
+ "SET (PaymentRule,C_PaymentTerm_ID,C_Payment_ID,C_CashLine_ID)="
+ "(SELECT PaymentRule,C_PaymentTerm_ID,C_Payment_ID,C_CashLine_ID "
+ "FROM C_Order o WHERE i.C_Order_ID=o.C_Order_ID)"
+ "WHERE DocStatus NOT IN ('RE','CL') AND C_Order_ID=" + getC_Order_ID();
// Don't touch Closed/Reversed entries
@ -1017,6 +1019,19 @@ public class MOrder extends X_C_Order implements DocAction
log.fine("Payment -> #" + no);
}
// Propagate Changes of Date Account to existing (not completed/reversed/closed) invoices
if (is_ValueChanged("DateAcct"))
{
String sql = "UPDATE C_Invoice i "
+ "SET (DateAcct)="
+ "(SELECT DateAcct "
+ "FROM C_Order o WHERE i.C_Order_ID=o.C_Order_ID)"
+ "WHERE DocStatus NOT IN ('CO','RE','CL') AND Processed='N' AND C_Order_ID=" + getC_Order_ID();
// Don't touch Completed/Closed/Reversed entries
int no = DB.executeUpdate(sql, get_TrxName());
log.fine("DateAcct -> #" + no);
}
// Sync Lines
if ( is_ValueChanged("AD_Org_ID")
|| is_ValueChanged(MOrder.COLUMNNAME_C_BPartner_ID)