Skip to content

Conflicting values of conditioned fields by non-exposed fields #8350

@tokinrandr

Description

@tokinrandr

Describe the bug
When correcting a declaration, it is possible to register both values of two or more fields (sections, groups) conditioned (shown, hidden, ...) by non-exposed fields (checkbox, ...). Once registered, and when we need to use their values (i.e. in certificate construction for printing), it is difficult, if not impossible, to identify which of them should be considered, because both of them exist and the non-exposed ones do not.

Which feature of OpenCRVS your bug concern?

  • Correcting a record
  • Declaration form configuration
  • Certificate construction

To Reproduce

  1. Take a registered and ready to print birth declaration, with mother as informant and father's details (or vice versa, or none of the as informant)
  2. Make a correction by checking "Father's details are not available" without clearing the father's details fields
  3. The reverse is also true: first, no father's details and then unchecking "Father's details are not available" without manually emptying the field "Reason for not providing father's details" fields.
  4. So, for these cases, we have both values of father's details and reason for not providing father's details.
    (Same for mother's details)
  5. On the certificate, we need to conditionally show or hide the father/mother's details based on these values. But since we have both values, we can't identify which one is true and this leads to incorrect display of the information. (i.e. either father's details are always shown or hidden)

Expected behaviour
Two behaviour options:

  1. On record correction, if conditioned, automatically clear unneeded values of fields (but to consider that keeping these values might help users not to fill these fields again).
  2. On certificate construction, correctly expose all usable fields.
    This way we should be able to tell exactly what information to use without any confusion.

Actual behaviour

  • On record correction, unneeded values of conditioned fields are kept when changing the values of conditioner fields (checkbox, etc.)
  • On certificate construction, some information is displayed/hidden incorrectly because they can only rely on values that are confusing instead of a simple and precise value of field that is not exposed actually

Screenshots
As a related example, here we have both values of father's details and Reason for not providing father’s details that are conditioned by Father's details are not available

Image
Image

And in Country Config side, inside helpers where we handle what to show on the certificate, we are using something like:

function canShowFatherDetails(_this: Record<string, string>) {
  ...
  return !('fatherReasonNotApplying' in _this) // or ('fatherFamilyName' in _this)
  ...
}

Nothing simple as fatherDetailsExist value is exposed which should be used instead of fatherReasonNotApplying and fatherFamilyName which actually can have values when they should not.

OpenCRVS Core Version:

  • v1.6.1 (Git branch: release-v1.6.1)

Country Configuration Version:

  • v1.6.0 (Git branch: release-v1.6.0)

Desktop:
(ANY)
tested on:

  • OS: Linux
  • Browser Chrome
  • Version 132.0.6834.83

Smartphone:
ANY

Additional context
NONE

Possible fixes
We have tryed to expose the field detailsExist on country config by using the template operation booleanTransformer on it and it works but it needs a little add in the function at the core in:
packages/client/src/forms/register/mappings/query/field-mappings.ts
to be like:
Image
It makes sure that the sectionId like father or mother is set on transformedData otherwise it will throw an error.

Reproducible demo
NONE

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions