rymghosn opened a new pull request, #6288:
URL: https://github.com/apache/fineract/pull/6288
Currently, a Tax Component's percentage, GL accounts (debit/credit), and
start date can be modified at any time via PUT /v1/taxes/component/{id},
even after the component has been linked to transactions through a Tax
Group. This risks inconsistencies in historical calculations and journal
entries, since past periods rely on the component's percentage and GL
account mapping at the time they were recorded.
This PR enforces the following rules on tax component updates:
- If a Tax Component has not been linked to any Tax Group, all fields
(name, percentage, GL accounts, start date) remain editable.
- If a Tax Component is linked to a Tax Group that is in turn referenced
by at least one Charge (i.e. it is "in use"), only the name can still be
edited. Attempting to change percentage, GL accounts, or start date
returns a validation error.
- Start date specifically: if the existing start date is still in the
future (not yet active), it can still be changed, but only to another date
strictly after today. Once the start date has passed (component active),
it is locked regardless of usage.
- GL account (debit/credit type and account) updates are now supported
through the update endpoint for components not yet in use — previously
this endpoint did not support changing GL accounts at all.
Changes
- ChargeRepository: added existsByTaxGroupContainingTaxComponent(Long) to
check whether any Charge references a Tax Group containing a given Tax
Component.
- TaxComponent: added isInUse(Supplier<Boolean>) (mapped-to-a-group AND
charge-usage check), and extended update(...) to accept and apply GL
account changes.
- TaxComponentData: added accountsEditable indicator, surfaced on GET
/v1/taxes/component/{id}.
- TaxReadPlatformServiceImpl: computes accountsEditable and conditionally
includes GL account template options based on it.
- TaxWritePlatformServiceImpl: enforces the restricted-fields validation
when a component is in use, and resolves GL accounts from the update
command.
- TaxValidator: extends supported update parameters to include GL account
fields; adds the two-tier start-date validation rule described above.
- TaxConfiguration: wires the new
ChargeRepository/GLAccountRepositoryWrapper dependencies into the read/write
service beans.
--
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]