Skip to content

FINERACT-2561: Move organisation currency validation outside loop in saveAllDebitOrCreditEntries#5712

Open
AshharAhmadKhan wants to merge 1 commit intoapache:developfrom
AshharAhmadKhan:FINERACT-2561-fix-repeated-currency-validation-in-saveAllDebitOrCreditEntries
Open

FINERACT-2561: Move organisation currency validation outside loop in saveAllDebitOrCreditEntries#5712
AshharAhmadKhan wants to merge 1 commit intoapache:developfrom
AshharAhmadKhan:FINERACT-2561-fix-repeated-currency-validation-in-saveAllDebitOrCreditEntries

Conversation

@AshharAhmadKhan
Copy link
Copy Markdown
Contributor

Description

JIRA: https://issues.apache.org/jira/browse/FINERACT-2561

The saveAllDebitOrCreditEntries() method was executing the same
organisation currency validation query inside the per-entry loop, causing
redundant identical database round-trips on every debit/credit line of a
manual journal entry request.

Since currencyCode does not change within a single request, the validation
only needs to run once per method invocation — not once per loop iteration.

This fix moves organisationCurrencyRepository.findOneWithNotFoundDetection(currencyCode)
to before the loop, consistent with the pattern already used in the same class
inside saveAllDebitOrCreditOpeningBalanceEntries().

No logic change — validation still happens, just once instead of N times.

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.

1 participant