From 8ef3cc13deb0659c65aa871416b1ee4133058a95 Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Tue, 27 Oct 2009 19:55:07 +0000 Subject: [PATCH] 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 --- base/src/org/compiere/model/MPayment.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/base/src/org/compiere/model/MPayment.java b/base/src/org/compiere/model/MPayment.java index 6f475f7486..64af86852e 100644 --- a/base/src/org/compiere/model/MPayment.java +++ b/base/src/org/compiere/model/MPayment.java @@ -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