FR [3132797] - FS02 Cash Flow

http://www.adempiere.com/index.php/FS02_Cash_Flow
https://sourceforge.net/tracker/?func=detail&aid=3132797&group_id=176962&atid=879335
Fix a problem with the IsPayScheduleValid - it needs to be false for non-schemas to allow the invoice to be paid
This commit is contained in:
Carlos Ruiz 2011-03-26 00:27:59 -05:00
parent 1c3c6b728e
commit f9dca8470f
3 changed files with 29 additions and 11 deletions

View File

@ -1563,13 +1563,22 @@ public class MInvoice extends X_C_Invoice implements DocAction
MPaymentTerm pt = new MPaymentTerm(getCtx(), getC_PaymentTerm_ID(), null); MPaymentTerm pt = new MPaymentTerm(getCtx(), getC_PaymentTerm_ID(), null);
log.fine(pt.toString()); log.fine(pt.toString());
MInvoicePaySchedule[] schedule = MInvoicePaySchedule.getInvoicePaySchedule int numSchema = pt.getSchedule(false).length;
(getCtx(), getC_Invoice_ID(), 0, get_TrxName());
if (schedule.length > 0) MInvoicePaySchedule[] schedule = MInvoicePaySchedule.getInvoicePaySchedule
(getCtx(), getC_Invoice_ID(), 0, get_TrxName());
if (schedule.length > 0) {
if (numSchema == 0)
return false; // created a schedule for a payment term that doesn't manage schedule
return validatePaySchedule(); return validatePaySchedule();
else } else {
return pt.apply(this); // calls validate pay schedule boolean isValid = pt.apply(this); // calls validate pay schedule
if (numSchema == 0)
return true; // no schedule, no schema, OK
else
return isValid;
}
} // createPaySchedule } // createPaySchedule

View File

@ -1649,13 +1649,22 @@ public class MOrder extends X_C_Order implements DocAction
MPaymentTerm pt = new MPaymentTerm(getCtx(), getC_PaymentTerm_ID(), null); MPaymentTerm pt = new MPaymentTerm(getCtx(), getC_PaymentTerm_ID(), null);
log.fine(pt.toString()); log.fine(pt.toString());
int numSchema = pt.getSchedule(false).length;
MOrderPaySchedule[] schedule = MOrderPaySchedule.getOrderPaySchedule MOrderPaySchedule[] schedule = MOrderPaySchedule.getOrderPaySchedule
(getCtx(), getC_Order_ID(), 0, get_TrxName()); (getCtx(), getC_Order_ID(), 0, get_TrxName());
if (schedule.length > 0) if (schedule.length > 0) {
if (numSchema == 0)
return false; // created a schedule for a payment term that doesn't manage schedule
return validatePaySchedule(); return validatePaySchedule();
else } else {
return pt.applyOrder(this); // calls validate pay schedule boolean isValid = pt.applyOrder(this); // calls validate pay schedule
if (numSchema == 0)
return true; // no schedule, no schema, OK
else
return isValid;
}
} // createPaySchedule } // createPaySchedule

View File

@ -224,7 +224,7 @@ public class MPaymentTerm extends X_C_PaymentTerm
/** /**
* Apply Payment Term without schedule to Invoice * Apply Payment Term without schedule to Invoice
* @param invoice invoice * @param invoice invoice
* @return true as no payment schedule * @return false as no payment schedule
*/ */
private boolean applyNoSchedule (MInvoice invoice) private boolean applyNoSchedule (MInvoice invoice)
{ {
@ -234,7 +234,7 @@ public class MPaymentTerm extends X_C_PaymentTerm
invoice.setC_PaymentTerm_ID(getC_PaymentTerm_ID()); invoice.setC_PaymentTerm_ID(getC_PaymentTerm_ID());
if (invoice.isPayScheduleValid()) if (invoice.isPayScheduleValid())
invoice.setIsPayScheduleValid(false); invoice.setIsPayScheduleValid(false);
return true; return false;
} // applyNoSchedule } // applyNoSchedule
/** /**
@ -324,7 +324,7 @@ public class MPaymentTerm extends X_C_PaymentTerm
/** /**
* Apply Payment Term without schedule to Order * Apply Payment Term without schedule to Order
* @param order order * @param order order
* @return true as no payment schedule * @return false as no payment schedule
*/ */
private boolean applyOrderNoSchedule (MOrder order) private boolean applyOrderNoSchedule (MOrder order)
{ {
@ -334,7 +334,7 @@ public class MPaymentTerm extends X_C_PaymentTerm
order.setC_PaymentTerm_ID(getC_PaymentTerm_ID()); order.setC_PaymentTerm_ID(getC_PaymentTerm_ID());
if (order.isPayScheduleValid()) if (order.isPayScheduleValid())
order.setIsPayScheduleValid(false); order.setIsPayScheduleValid(false);
return true; return false;
} // applyOrderNoSchedule } // applyOrderNoSchedule
/** /**