Dhanno98 commented on code in PR #5940:
URL: https://github.com/apache/fineract/pull/5940#discussion_r3454307280


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImpl.java:
##########
@@ -1052,32 +1087,39 @@ private boolean addCharge(final Loan loan, final Charge 
chargeDefinition, LoanCh
         loanChargeValidator.validateChargeAdditionForDisbursedLoan(loan, 
loanCharge);
         
loanChargeValidator.validateChargeHasValidSpecifiedDateIfApplicable(loan, 
loanCharge, loan.getDisbursementDate());
         loanChargeService.addLoanCharge(loan, loanCharge);
-        loanCharge = this.loanChargeRepository.saveAndFlush(loanCharge);
-
-        // we want to apply charge transactions only for those loans charges 
that are applied when a loan is active and
-        // the loan product uses Upfront Accrual accounting (or None/Cash when 
allow-cash-and-non-cash-accrual is true),
-        // or only when the loan is closed too
-        final boolean accrualEnabledForActiveStatus = 
configurationDomainService.isAllowCashAndNonCashAccrual()
-                ? 
loan.isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()
-                : loan.isUpfrontAccrualAccountingEnabledOnLoanProduct();
-        if ((loan.getStatus().isActive() && accrualEnabledForActiveStatus) || 
loan.getStatus().isOverpaid()
-                || loan.getStatus().isClosedObligationsMet()) {
-            final LoanTransaction applyLoanChargeTransaction = 
loanChargeService.handleChargeAppliedTransaction(loan, loanCharge, null);
-            if (applyLoanChargeTransaction != null) {
-                
this.loanTransactionRepository.saveAndFlush(applyLoanChargeTransaction);
-                
loanJournalEntryPoster.postJournalEntriesForLoanTransaction(applyLoanChargeTransaction,
 false, false);
-                businessEventNotifierService
-                        .notifyPostBusinessEvent(new 
LoanAccrualTransactionCreatedBusinessEvent(applyLoanChargeTransaction));
+
+        // If charge amount is not zero
+        if (!isZeroCharge(loanCharge)) {

Review Comment:
   Reverted.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to