From d005a0cb06f97561d11e0b3bbb2859e8bf7d862b Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Thu, 15 Oct 2009 22:13:33 +0000 Subject: [PATCH] Error you can assign 2 payment same invoice http://sourceforge.net/tracker/?func=detail&aid=2880182&group_id=176962&atid=879332 --- base/src/org/compiere/model/MPayment.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/base/src/org/compiere/model/MPayment.java b/base/src/org/compiere/model/MPayment.java index bbc8aa9400..5696aaaf0e 100644 --- a/base/src/org/compiere/model/MPayment.java +++ b/base/src/org/compiere/model/MPayment.java @@ -2009,7 +2009,16 @@ public final class MPayment extends X_C_Payment { // Create invoice Allocation - See also MCash.completeIt if (getC_Invoice_ID() != 0) - return allocateInvoice(); + { + boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, I_C_Invoice.COLUMNNAME_C_Invoice_ID + "=? AND " + I_C_Invoice.COLUMNNAME_IsPaid + "=?", getTrx_Name()) + .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 if (allocatePaySelection()) return true; @@ -2059,6 +2068,12 @@ public final class MPayment extends X_C_Payment return alloc.save(get_TrxName()); } // allocateIt + private String getTrx_Name() { + // TODO Auto-generated method stub + return null; + } + + /** * Allocate single AP/AR Invoice * @return true if allocated