rymghosn opened a new pull request, #6582: URL: https://github.com/apache/fineract/pull/6582
## Description JIRA: [FINERACT-2892](https://issues.apache.org/jira/browse/FINERACT-2892). This is the backend half; showing the datatable on the Loan Product screen is web-app work. Follow-up to #6538 (FINERACT-2874), which lets a Loan Product carry a CREATE Entity Data Table Check. This PR doesn't depend on #6538 to compile, but the gap only shows up once #6538 is in. **Root cause:** the client, group, center, loan and savings templates all return `datatables` from `EntityDatatableChecksReadService.retrieveTemplates(CREATE, <entity>, productId)`, so a UI knows which datatable entry the create form must collect. `GET /loanproducts/template` never did. With a Loan Product / CREATE check in place, `POST /loanproducts` then fails with 403 `error.msg.entry.required.in.datatable`, and the client has no way to discover which datatable it needs. **Fix:** `LoanProductData` gets a settable `datatables`. `LoanProductsApiResource.retrieveTemplate` fills it from `retrieveTemplates(CREATE, m_product_loan, null)`, the same way `CentersApiResource` does. `datatables` is also added to the response parameter set so `fields=` filtering keeps it. **Tests:** new `LoanProductsApiResourceTemplateDatatablesTest`. One test checks that the CREATE-check datatables reach the serialized template and that `datatables` is in the parameter set. The other checks that the field is absent when no check exists. **Manual verification** on a local build against PostgreSQL, with #6538 applied for both runs. The setup was a single-row datatable on `m_product_loan` plus an Entity Data Table Check (`m_product_loan`, status 100) on it: - before: `GET /loanproducts/template` → 200 with no `datatables` key, and `?fields=id,datatables` → 400 "The parameter datatables is not supported". - after: `datatables` lists the datatable with its column headers, `fields=id,datatables` keeps it, and once the check is deleted the key is absent again. ## Checklist Please make sure these boxes are checked before submitting your pull request - thanks! - [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 (the template gains an optional `datatables` field shaped like the other templates'; the `GetLoanProductsTemplateResponse` Swagger model is not updated here) - [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). - [ ] If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately. (this PR covers only the backend half of FINERACT-2892) - [x] I followed the [AI Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy). Your assigned reviewer(s) will follow our [guidelines for code reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide). -- 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]
