pwargulak opened a new pull request, #6758:
URL: https://github.com/apache/fineract/pull/6758

   ## Description
   
   [FINERACT-3008](https://issues.apache.org/jira/browse/FINERACT-3008)
   
   Deleting a Working Capital loan application deleted its notes and its 
projected amortization model, but not the entries of datatables registered on 
`m_wc_loan`. Their foreign key then refused the delete with 403 
`error.msg.data.integrity.issue` (by id, by external id and through the batch 
API), and when an entity datatable check made the datatable mandatory, the 
entry could not be deleted first either, so the application could never be 
deleted.
   
   `WorkingCapitalLoanApplicationWritePlatformServiceImpl#deleteApplication` 
now deletes those entries before the loan, in the same transaction, through a 
new `DatatableWriteService#deleteDatatableEntriesOfEntity(EntityTables, Long)`. 
It deletes by the entity's foreign key column from every datatable registered 
on the entity, single- and multi-row alike, without the entity datatable check 
refusal of a single entry delete, and publishes 
`DatatableEntryDeletedBusinessEvent` for each datatable that had entries, as 
the entry delete does. The state rule is unchanged: only a submitted 
application can be deleted.
   
   Loan application and client deletes have the same shape (they clear no 
datatable entries either); they are left out of this change and noted on the 
ticket.
   
   Tests: new `FeignWorkingCapitalLoanApplicationDeleteDatatableTest` (4: 
single-row entry, two datatables incl. a multi-row one with another loan's 
entry kept, a datatable made mandatory by an entity check, and an approved 
application still refused with its entry kept) — the first three fail on 
`develop` with the 403; new `DatatableWriteServiceImplDeleteEntityEntriesTest` 
(2).
   
   Run locally on develop 43911acb2f: rat, spotless, checkstyle, spotbugs, 
javadoc and modernizer of the touched modules are clean; the unit suites of 
`fineract-working-capital-loan` (1715 tests) and `fineract-core` (490) and the 
`dataqueries` unit tests of `fineract-provider` (72), no failures; and the new 
test with `WorkingCapitalLoanApplicationCRUDTest`, 
`BatchWorkingCapitalLoanIntegrationTest`, 
`EntityDatatableChecksIntegrationTest`, 
`FeignClientEntityDatatableCheckSubtypeTest` and `DatatableIntegrationTest` (62 
tests) on PostgreSQL, MariaDB and MySQL. Not run: the other integration test 
classes and the e2e (Cucumber) suite.
   
   ## Checklist
   
   - [x] Write the commit message as per [our 
guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
   - [x] 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.
   - [x] Create/update [unit or integration 
tests](https://fineract.apache.org/docs/current/#_testing) for verifying the 
changes made.
   - [x] Follow our [coding 
conventions](https://cwiki.apache.org/confluence/display/FINERACT/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
   - [x] [This PR must not be a "code 
dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit).
 Large changes can be made in a branch, with assistance. Ask for help on the 
[developer mailing list](https://fineract.apache.org/#contribute).
   - [x] If merging this PR resolves a JIRA issue, I will mark that issue as 
resolved and set "Fix Version/s" appropriately.
   - [x] I followed the [AI 
Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy).
   


-- 
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]

Reply via email to