FINERACT-2717: Check all currency usages before allowing currency removal - #6191
Open
Samer-Melhem-FOO wants to merge 2 commits into
Open
FINERACT-2717: Check all currency usages before allowing currency removal#6191Samer-Melhem-FOO wants to merge 2 commits into
Samer-Melhem-FOO wants to merge 2 commits into
Conversation
…oval The currency-in-use check when removing an organisation currency only looked at loan products, savings products, and charges, so a currency still referenced by actual loans, savings/share accounts, client transactions, account transfers, cashier transactions, or GL journal entries could be silently removed. Broadened the check to cover all of those tables and gave CurrencyInUseException a clearer message. Added CurrencyWritePlatformServiceJpaRepositoryImplTest covering: a currency removed successfully when unused, CurrencyInUseException thrown when still referenced, and the usage check being skipped for currencies that remain allowed.
Contributor
Author
|
Two checks are currently failing here, both unrelated to this PR's change (
Could a maintainer re-run the failed jobs? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
CurrencyWritePlatformServiceJpaRepositoryImpl#updateAllowedCurrenciesallows removing a currency from the organisation's allowed-currency list. The existing in-use check only looked at loan products, savings products, and charges, so a currency still referenced by actual loans, savings/share accounts, client transactions, account transfers, cashier transactions, or GL journal entries could be silently removed.This broadens the check to a
JdbcTemplate-based scan across all relevant tables (m_product_loan,m_savings_product,m_share_product,m_charge,m_loan,m_savings_account,m_share_account,m_client_transaction,m_account_transfer_transaction,m_cashier_transactions,acc_gl_journal_entry) and improvesCurrencyInUseException's message to be clearer to end users.JIRA
https://issues.apache.org/jira/browse/FINERACT-2717
Test plan
./gradlew :fineract-core:compileJava :fineract-provider:compileJavapassesCurrencyWritePlatformServiceJpaRepositoryImplTest(no prior test existed for this class), covering:CurrencyInUseExceptionthrown when the removed currency is still referenced./gradlew :fineract-provider:test --tests "...CurrencyWritePlatformServiceJpaRepositoryImplTest"— all 3 tests pass