From b261eca37348c33af97232e461f6d71176a9639c Mon Sep 17 00:00:00 2001 From: SusanneCalderon Date: Wed, 3 Oct 2018 11:23:49 -0600 Subject: [PATCH] adempiere #1555 BankTransfer: Voiding Payments https://github.com/adempiere/adempiere/issues/1555 --- base/src/org/compiere/model/MPayment.java | 9 ++++++--- base/src/org/eevolution/process/BankTransfer.java | 2 +- .../eevolution/process/BankTransferAbstract.java | 14 +++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/base/src/org/compiere/model/MPayment.java b/base/src/org/compiere/model/MPayment.java index 96ddf0af66..b15f8a89b1 100644 --- a/base/src/org/compiere/model/MPayment.java +++ b/base/src/org/compiere/model/MPayment.java @@ -2494,6 +2494,7 @@ public MPayment reverseIt(boolean isAccrual) public boolean reverseCorrectIt() { log.info(toString()); + String DocAction = getDocAction(); // Before reverseCorrect processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT); if (processMsg != null) @@ -2503,7 +2504,7 @@ public boolean reverseCorrectIt() return false; // Reverse all deposit from cash reverseGeneratedPayments(); - reverseRelatedPayments(); + reverseRelatedPayments(DocAction); // StringBuilder info = new StringBuilder(processMsg); // After reverseCorrect @@ -2544,13 +2545,13 @@ private void reverseGeneratedPayments() { /** * Reverse all payments generated by banktransfer */ - private void reverseRelatedPayments() { + private void reverseRelatedPayments(String DocAction) { if (getRelatedPayment_ID() !=0){ MPayment relatedPayment = (MPayment)getRelatedPayment(); if (relatedPayment.isProcessing()) // to avoid endless loop return; if (relatedPayment.getDocStatus().equals(MPayment.DOCSTATUS_Completed)){ - relatedPayment.processIt(MPayment.DOCACTION_Void); + relatedPayment.processIt(DocAction); relatedPayment.saveEx(); } else{ @@ -2569,6 +2570,7 @@ public boolean reverseAccrualIt() log.info(toString()); // Before reverseAccrual + String DocAction = MPayment.DOCACTION_Reverse_Accrual; processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL); if (processMsg != null) return false; @@ -2577,6 +2579,7 @@ public boolean reverseAccrualIt() return false; // After reverseAccrual + reverseRelatedPayments(DocAction); processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); if (processMsg != null) return false; diff --git a/base/src/org/eevolution/process/BankTransfer.java b/base/src/org/eevolution/process/BankTransfer.java index a637ab734b..df0049bb3b 100644 --- a/base/src/org/eevolution/process/BankTransfer.java +++ b/base/src/org/eevolution/process/BankTransfer.java @@ -74,7 +74,7 @@ private void generateBankTransfer() { } MBankAccount mBankFrom = new MBankAccount(getCtx(), getCBankAccountId(), get_TrxName()); - MBankAccount mBankTo = new MBankAccount(getCtx(), getBankAccountToId(), get_TrxName()); + MBankAccount mBankTo = new MBankAccount(getCtx(), getToCBankAccountId(), get_TrxName()); MPayment paymentBankFrom = new MPayment(getCtx(), 0 , get_TrxName()); paymentBankFrom.setC_BankAccount_ID(mBankFrom.getC_BankAccount_ID()); diff --git a/base/src/org/eevolution/process/BankTransferAbstract.java b/base/src/org/eevolution/process/BankTransferAbstract.java index bb3d3a7763..b6df08206b 100644 --- a/base/src/org/eevolution/process/BankTransferAbstract.java +++ b/base/src/org/eevolution/process/BankTransferAbstract.java @@ -35,7 +35,7 @@ public abstract class BankTransferAbstract extends SvrProcess { /** Parameter Name for Bank Account From */ public static final String FROM_C_BANKACCOUNT_ID = "From_C_BankAccount_ID"; /** Parameter Name for Bank Account To */ - public static final String C_BANKACCOUNTTO_ID = "C_BankAccountTo_ID"; + public static final String TO_C_BANKACCOUNT_ID = "To_C_BankAccount_ID"; /** Parameter Name for Business Partner */ public static final String C_BPARTNER_ID = "C_BPartner_ID"; /** Parameter Name for Currency */ @@ -61,7 +61,7 @@ public abstract class BankTransferAbstract extends SvrProcess { /** Parameter Value for Bank Account From */ private int cBankAccountId; /** Parameter Value for Bank Account To */ - private int bankAccountToId; + private int toCBankAccountId; /** Parameter Value for Business Partner */ private int bPartnerId; /** Parameter Value for Currency */ @@ -88,7 +88,7 @@ public abstract class BankTransferAbstract extends SvrProcess { @Override protected void prepare() { cBankAccountId = getParameterAsInt(FROM_C_BANKACCOUNT_ID); - bankAccountToId = getParameterAsInt(C_BANKACCOUNTTO_ID); + toCBankAccountId = getParameterAsInt(TO_C_BANKACCOUNT_ID); bPartnerId = getParameterAsInt(C_BPARTNER_ID); currencyId = getParameterAsInt(C_CURRENCY_ID); conversionTypeId = getParameterAsInt(C_CONVERSIONTYPE_ID); @@ -113,13 +113,13 @@ protected void setCBankAccountId(int cBankAccountId) { } /** Getter Parameter Value for Bank Account To */ - protected int getBankAccountToId() { - return bankAccountToId; + protected int getToCBankAccountId() { + return toCBankAccountId; } /** Setter Parameter Value for Bank Account To */ - protected void setBankAccountToId(int bankAccountToId) { - this.bankAccountToId = bankAccountToId; + protected void setToCBankAccountId(int toCBankAccountId) { + this.toCBankAccountId = toCBankAccountId; } /** Getter Parameter Value for Business Partner */