[ 
https://issues.apache.org/jira/browse/FINERACT-2703?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Foo Developer reassigned FINERACT-2703:
---------------------------------------

    Assignee: Foo Developer

> Client creation incorrectly requires/rejects "Datatables" field regardless of 
> whether a datatable check applies to the client's legal form.
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2703
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2703
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Client
>            Reporter: Foo Developer
>            Assignee: Foo Developer
>            Priority: Critical
>              Labels: java
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> When "Entity Datatable Checks" are configured for client creation restricted 
> to a specific legal-form sub-type (Person or Entity), client creation fails 
> for the other sub-type with the error "Datatable cannot be empty", even 
> though no datatable check actually applies to that sub-type.
> h3. Steps to Reproduce
>  # Configure a Datatable linked to the Client entity, with Entity Sub-Type = 
> Person.
>  # Under Entity Data Table Checks, mark it as required at client creation 
> (status = CREATE).
>  # Attempt to create a client with Legal Form = Entity (non-person).
> h3. Expected Behavior
> The client should be created successfully — the Person-scoped datatable check 
> should not apply to an Entity client.
> h3. Actual Behavior
> Client creation fails with a validation error requiring a non-empty 
> datatables array, because:
>  # {{ClientDataValidator.validateForCreate(...)}} unconditionally requires 
> the {{datatables}} JSON array to be non-empty whenever the {{datatables}} 
> parameter is present in the request — it doesn't check whether any datatable 
> check is actually configured/required for the submitted legal form.
>  # Separately, {{EntityDatatableChecksWritePlatformServiceImpl}} looks up 
> required datatables via 
> {{{}entityDatatableChecksRepository.findByEntityAndStatusAndSubtype(entityName,
>  status, entitySubtype.toUpperCase()){}}}, but the stored subtype value is 
> not uppercase (e.g. {{{}"Person"{}}}, {{{}"Entity"{}}}), so this lookup can 
> silently return nothing when it shouldn't.
> h3. Suggested Fix
>  * Remove the erroneous {{.toUpperCase()}} call so the subtype lookup matches 
> the stored value.
>  * In {{{}ClientDataValidator{}}}, only enforce the non-empty datatables 
> array requirement when at least one {{EntityDatatableChecks}} record is 
> actually configured (globally or for the client's specific legal-form 
> subtype) for {{{}CLIENT{}}}/{{{}CREATE{}}}.
> h3. Affected Files
>  * 
> {{fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java}}
>  * 
> {{fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksWritePlatformServiceImpl.java}}



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

Reply via email to