Skip to content

FINERACT-2705: Skip journal entries with unresolved GL accounts in savings interest posting job - #6174

Open
Abhishek6122008 wants to merge 1 commit into
apache:developfrom
Abhishek6122008:bugfix/FINERACT-2705-savings-interest-posting-gl-guard
Open

FINERACT-2705: Skip journal entries with unresolved GL accounts in savings interest posting job#6174
Abhishek6122008 wants to merge 1 commit into
apache:developfrom
Abhishek6122008:bugfix/FINERACT-2705-savings-interest-posting-gl-guard

Conversation

@Abhishek6122008

@Abhishek6122008 Abhishek6122008 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Description

Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.

Your assigned reviewer(s) will follow our guidelines for code reviews.

@adamsaghy adamsaghy changed the title FINERACT-2705: Skip journal entries with unresolved GL accounts in sa… FINERACT-2705: Skip journal entries with unresolved GL accounts in savings interest posting job Jul 27, 2026
Aman-Mittal
Aman-Mittal previously approved these changes Jul 30, 2026

@Aman-Mittal Aman-Mittal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@Abhishek6122008
Abhishek6122008 force-pushed the bugfix/FINERACT-2705-savings-interest-posting-gl-guard branch 2 times, most recently from 1770e86 to 7fc1523 Compare August 4, 2026 22:05
@Abhishek6122008

Copy link
Copy Markdown
Contributor Author

@adamsaghy can you have another look at my PR when you’re free, just to make sure everything looks good?

@Abhishek6122008

Copy link
Copy Markdown
Contributor Author

@adamsaghy @Aman-Mittal gentle ping on this one — CI is green, could you review and let me know if the approach looks right?

@@ -150,6 +150,17 @@ private void batchUpdateJournalEntries(final List<SavingsAccountData> savingsAcc
savingsAccountData.getId(), auditDatetime, auditDatetime, false, BigDecimal.ZERO, BigDecimal.ZERO,
null, savingsAccountTransactionData.getTransactionDate(), null, userId, userId,
DateUtils.getBusinessLocalDate() });
} else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont really like this idea:

  • if no accounting is set on the loan product -> we should not reach this point: Saving accounts without accounting should not be picked up
  • If cash based accounting is set and no accrual transactions to be created-> we should not reach this point: Savings accounts with Cash based accounting (hence no Accruals) should not be picked up.

@bharathc27 What do you think?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamsaghy I agree that non-accounting loan products and their associated loans can be skipped. However, I believe income posting would still apply to loan accounts under both cash-based and accrual-based accounting.

From a practical perspective, it makes sense for the job to continue processing even if one account fails. However, we should maintain a list of the accounts that failed, along with the relevant error messages, so that users can review them and take the necessary action.
I hope this fix is taking care of that as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamsaghy @bharathcgowda Thank you for the suggestions. Based on your feedback, I was thinking of keeping this guard as a safety net, so that if the account selection is tightened later, the branch would simply stop firing.

For the reporting gap Bharath mentioned, I was also thinking of collecting the skipped/failed accounts and logging a single WARN summary per run instead of the current silent debug.

Please let me know if you think this approach makes sense, and I'll go ahead with it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets review first whether none accounting reach this point: it should not i believe.

cash based accounting and income posting: @bharathcgowda can you help me understand better?

…vings interest posting job

batchUpdateJournalEntries guarded journal-entry creation with the
product-level SAVINGS_CONTROL and INTEREST_ON_SAVINGS mappings but
inserted the transaction-level accounts resolved by selectAccountId,
which uses accrual-only mappings (INTEREST_PAYABLE/INTEREST_RECEIVABLE).
For cash-based products these resolve to 0, so the single-batch INSERT
into acc_gl_journal_entry violates its foreign key and rolls back
interest posting for every account in the tenant. Check the actual
transaction-level accounts and skip unresolved ones with a warning
instead of aborting the whole batch.
@Abhishek6122008
Abhishek6122008 force-pushed the bugfix/FINERACT-2705-savings-interest-posting-gl-guard branch from 8434b2c to 4d9e068 Compare August 27, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants