Foo Developer created FINERACT-2682:
---------------------------------------

             Summary: Bulk client import fails when a mandatory datatable is 
configured on the Client entity
                 Key: FINERACT-2682
                 URL: https://issues.apache.org/jira/browse/FINERACT-2682
             Project: Apache Fineract
          Issue Type: Bug
          Components: Client, Data Tables
            Reporter: Foo Developer


When a custom datatable is registered against the Client entity 
({{{}m_client{}}}) and an Entity Datatable Check makes that datatable mandatory 
for client creation (Entity = Client, Status = Create), the Bulk Client Import 
(Excel upload) feature fails.

Steps to Reproduce:
 # Admin > System > Manage Data Tables — add a new datatable for the Client 
entity (e.g. a single-row datatable with one text column).
 # Admin > Organization > Entity Data Table Checks — add a check for Entity = 
Client, Status = Create, Data Table = the one created in step 1.
 # Admin > Organization > Bulk Import — download the Bulk Client Upload 
template (both Person and Entity legal forms).
 # Populate the template with valid client data.
 # Upload the file via Bulk Import.

Expected Result: The client is created successfully, and the downloaded 
template includes columns for the required datatable so it can be populated.

Actual Result: The upload fails. The bulk import workbook populator and import 
handlers have no support for datatable columns: the template doesn't render 
columns for datatables configured on the Client entity, and the import handlers 
have no way to validate, parse, or submit datatable data as part of client 
creation — so a mandatory datatable check blocks every row.

*Proposed fix (implemented, PR forthcoming):*
 * {{ClientEntityWorkbookPopulator}} / {{ClientPersonWorkbookPopulator}} render 
a column per datatable configured against the Client entity (including 
datatables with no existing check, so they can be optionally populated), with 
support for dropdown, date, datetime, and boolean column types. Columns from 
single-row datatables are marked mandatory ({{{}*{}}}) to match Entity 
Datatable Check requirements; multi-row (repeatable child) datatable columns 
are always optional.
 * {{ImportHandlerUtils}} gains helpers to parse and validate datatable columns 
from the workbook, and {{validateRequiredDatatables()}} skips multi-row 
datatables since they represent repeatable child data, not a single mandatory 
value.
 * {{ClientEntityImportHandler}} / {{ClientPersonImportHandler}} submit parsed 
datatable data as part of the client-create command, with clearer error 
reporting when validation fails.
 * {{DatatableData}} gains an {{isMultiRow()}} flag, threaded through 
{{DatatableReadServiceImpl}} (and {{{}ReadSurveyServiceImpl{}}}, which shares 
the same {{DatatableData.create(...)}} factory).

Includes unit tests for single-row vs. multi-row {{DatatableData}} handling.

*Affected APIs:*
 * {{GET 
/v1/clients/downloadtemplate?legalFormType=CLIENTS_PERSON|CLIENTS_ENTITY}}
 * {{POST 
/v1/clients/uploadtemplate?legalFormType=CLIENTS_PERSON|CLIENTS_ENTITY}}
 * {{{}GET /v1/imports{}}}, {{GET /v1/imports/downloadOutputTemplate}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to