[ https://issues.apache.org/jira/browse/FINERACT-753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Santosh Math closed FINERACT-753. --------------------------------- > incorrect savings account balance when charge transaction is reversed during > an overdraft recalculate Daily Balances > -------------------------------------------------------------------------------------------------------------------- > > Key: FINERACT-753 > URL: https://issues.apache.org/jira/browse/FINERACT-753 > Project: Apache Fineract > Issue Type: Bug > Components: Savings > Affects Versions: 1.3.1 > Reporter: andrewDzakpasu > Assignee: Ed Cable > Priority: Major > Labels: p1 > Fix For: 1.4.0 > > Attachments: current .png, previous issue.png, previous issue.png > > Time Spent: 20m > Remaining Estimate: 0h > > This bug occurs in specific scenarios where there is an overdraft on account > code section where the bug offers is below on > protected void recalculateDailyBalances(final Money openingAccountBalance, > final LocalDate interestPostingUpToDate) > {code:java} > runningBalance = runningBalance.plus(transactionAmount); > transaction.updateRunningBalance(runningBalance); > if (overdraftAmount.isZero() && runningBalance.isLessThanZero()) { > overdraftAmount = > overdraftAmount.plus(runningBalance.getAmount().negate()); > } > if (transaction.getId() == null && overdraftAmount.isGreaterThanZero()) { > transaction.updateOverdraftAmount(overdraftAmount.getAmount()); > } else if > (overdraftAmount.isNotEqualTo(transaction.getOverdraftAmount(getCurrency()))) > { > SavingsAccountTransaction accountTransaction = > SavingsAccountTransaction.copyTransaction(transaction); > transaction.reverse(); > if (overdraftAmount.isGreaterThanZero()) { > accountTransaction.updateOverdraftAmount(overdraftAmount.getAmount()); > } > accountTransaction.updateRunningBalance(runningBalance); > addTransaction(accountTransaction); > isTransactionsModified = true; > } > {code} > > steps to recreate . > Set up a savings account with an overdraft say 500. > # create saying account and add a charge fee of say 300 with opening balance > of 500 approve and activate. > # pay charge of 300 balance with now be 200 . charge is paid which creates > an object in m_savings_account_charge_paid_by > # now reverse the deposit of 500 . > # system will recalculateDailyBalances and reverse the charge transaction on > this section of the code > {code:java} > else if > (overdraftAmount.isNotEqualTo(transaction.getOverdraftAmount(getCurrency()))) > { > SavingsAccountTransaction accountTransaction = > SavingsAccountTransaction.copyTransaction(transaction); > transaction.reverse(); > if (overdraftAmount.isGreaterThanZero()) { > accountTransaction.updateOverdraftAmount(overdraftAmount.getAmount()); > } > accountTransaction.updateRunningBalance(runningBalance); > addTransaction(accountTransaction); > isTransactionsModified = true; > {code} > # now since the new charge created does not have the charged paid by object > in the table " m_savings_account_charge_paid_by" recalculating the account > balance becomes wrong -- This message was sent by Atlassian Jira (v8.3.4#803005)