San-43 commented on code in PR #5816:
URL: https://github.com/apache/fineract/pull/5816#discussion_r3162308407
##########
fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java:
##########
@@ -52,10 +52,10 @@ public class AccrualBasedAccountingProcessorForLoan
implements AccountingProcess
@Override
public void createJournalEntriesForLoan(final LoanDTO loanDTO) {
- final Long officeId = loanDTO.getOfficeId();
- final GLClosure latestGLClosure =
this.helper.getLatestClosureByBranch(officeId);
- final Office office = this.helper.getOfficeById(officeId);
for (final LoanTransactionDTO loanTransactionDTO :
loanDTO.getNewLoanTransactions()) {
+ final Long officeId = loanTransactionDTO.getOfficeId() == null ?
loanDTO.getOfficeId() : loanTransactionDTO.getOfficeId();
+ final GLClosure latestGLClosure =
this.helper.getLatestClosureByBranch(officeId);
Review Comment:
Good point. I kept the transaction-office behavior because transfers need
Office A/Office B from the loan transaction, but I will change the
implementation to cache Office and GLClosure by officeId. That avoids repeated
lookups when multiple transactions belong to the same office.
--
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]