San-43 commented on code in PR #5816:
URL: https://github.com/apache/fineract/pull/5816#discussion_r3162192381
##########
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();
Review Comment:
Hi @Aman-Mittal sure I can. The `LoanDTO` is the accounting view of a loan
as a whole, it carries loan-level context needed by the accounting processors
like the loan Id, Product Id, office Id, accounting flags, charge-off state,
and the list of new loan transactions. So conceptually: `LoanDTO` = accounting
payload for one loan.
On the other hand, `LoanTransactionDTO` is the accounting view of **one
transaction on that loan**. It carries data for one transaction: transaction
type, transaction date, transaction office, amount split, payment type, and
reversal flags. `LoanTransactionDTO` = accounting payload for one loan
transaction
This distinction matters and its very important for this ticket because
client transfer transactions can be posted under a different office from the
current loan office.
For example, in a client transfer from Office A to Office B, the
transfer-approved journal entry should be posted in Office B. Before the latest
change, the processor was using the loan-level office from `LoanDTO`, so that
journal entry could incorrectly be posted in Office A. Take the image i posted
in the PR description for the `Transfer aproved`, the journal entry would not
have been posted under the correct `test office`(office B), it would have been
the incorrect `Head office`(office A). Hope this example makes the distinction
clearer.
--
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]