Skip to content

FINERACT-2892: Return Loan Product CREATE-check datatables in the template - #6582

Open
rymghosn wants to merge 1 commit into
apache:developfrom
foodeveloper:port/FINERACT-2892-loan-product-template-datatables
Open

rymghosn wants to merge 1 commit into
apache:developfrom
foodeveloper:port/FINERACT-2892-loan-product-template-datatables

Conversation

@rymghosn

@rymghosn rymghosn commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Description

JIRA: 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!

  • Write the commit message as per our guidelines
  • 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.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our 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)
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • 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)
  • I followed the AI Policy.

Your assigned reviewer(s) will follow our guidelines for code reviews.

…plate

GET /loanproducts/template did not return `datatables`, unlike the
client, group, center, loan and savings templates. With a Loan Product /
CREATE Entity Data Table Check in place, a UI had no way to know which
datatable entry the create form must collect, so the check could not be
satisfied from the screen.

The template now fills `datatables` from
EntityDatatableChecksReadService.retrieveTemplates(CREATE, m_product_loan,
null), the same way CentersApiResource does, and `datatables` is part of
the response parameter set so `fields=` filtering keeps it.

Assisted-By: claude-opus-5-5
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