Error you can assign 2 payment same invoice that was paid

https://sourceforge.net/tracker/index.php?func=detail&aid=2880182&group_id=176962&atid=879332

I move the exception for the preparateIt method, the validation try envisions that can not be assigned an invoice that has already been paid, the exception is thrown when the invoice allocate directly in a payment

kind regards
Victor Perez
www.e-evolution.com
This commit is contained in:
vpj-cd 2009-10-27 19:55:07 +00:00
parent a383c2c9ca
commit 8ef3cc13de
1 changed files with 12 additions and 8 deletions

View File

@ -1639,7 +1639,18 @@ public final class MPayment extends X_C_Payment
m_processMsg = "@PeriodClosed@";
return DocAction.STATUS_Invalid;
}
// Stop workflow if invoice are paid
if (getC_Invoice_ID() != 0)
{
boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, I_C_Invoice.COLUMNNAME_C_Invoice_ID + "=? AND " + I_C_Invoice.COLUMNNAME_IsPaid + "=?", get_TrxName())
.setClient_ID()
.setParameters(new Object[]{getC_Invoice_ID(), "Y"})
.match();
if(InvoiceIsPaid)
throw new AdempiereException("@ValidationError@ @C_Invoice_ID@ @IsPaid@");
}
// Unsuccessful Online Payment
if (isOnline() && !isApproved())
{
@ -2010,13 +2021,6 @@ public final class MPayment extends X_C_Payment
// Create invoice Allocation - See also MCash.completeIt
if (getC_Invoice_ID() != 0)
{
boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, I_C_Invoice.COLUMNNAME_C_Invoice_ID + "=? AND " + I_C_Invoice.COLUMNNAME_IsPaid + "=?", get_TrxName())
.setClient_ID()
.setParameters(new Object[]{getC_Invoice_ID(), "Y"})
.match();
if(InvoiceIsPaid)
throw new AdempiereException("@ValidationError@ @C_Invoice_ID@ @IsPaid@");
else
return allocateInvoice();
}
// Invoices of a AP Payment Selection