Skip to content

Conversation

@tareq89
Copy link
Contributor

@tareq89 tareq89 commented Sep 30, 2025

issue: opencrvs/opencrvs-core#10584
core pr: opencrvs/opencrvs-core#10599

Checklist

  • I have linked the correct Github issue under "Development"
  • I have tested the changes locally, and written appropriate tests
  • I have tested beyond the happy path (e.g. edge cases, failure paths)
  • I have updated the changelog with this change (if applicable)
  • I have updated the GitHub issue status accordingly

@github-actions
Copy link
Contributor

Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:

  • Changelog is read by country implementors who might not always be familiar with all technical details of OpenCRVS. Keep language high-level, user friendly and avoid technical references to internals.
  • Answer "What's new?", "Why was the change made?" and "Why should I care?" for each change.
  • If it's a breaking change, include a migration guide answering "What do I need to do to upgrade?".

Comment on lines 381 to 390
{{#ifCond (lookup $declaration 'informant.relation') '===' 'Mother' }}
<tspan x="307" y="518.104">{{$lookup $declaration 'mother.name.fullname'}}</tspan>
{{ else }}
{{#ifCond (lookup $declaration 'informant.relation') '===' 'FATHER'}}
{{#ifCond (lookup $declaration 'informant.relation') '===' 'Father'}}
<tspan x="307" y="518.104">{{$lookup $declaration 'father.name.fullname'}}</tspan>
{{ else }}
<tspan x="307" y="518.104">{{$lookup $declaration 'informant.name.fullname'}}</tspan>
{{/ifCond}}
{{/ifCond}}
<tspan x="307" y="528.104">{{$intl 'v2.constants.informant' (lookup $declaration 'informant.relation')}}{{#ifCond (lookup $declaration 'informant.relation') '===' 'OTHER'}} ({{lookup $declaration 'informant.other.relation'}}) {{/ifCond}}</tspan>
<tspan x="307" y="528.104">{{lookup $declaration 'informant.relation'}}{{#ifCond (lookup $declaration 'informant.relation') '===' 'OTHER'}} ({{lookup $declaration 'informant.other.relation'}}) {{/ifCond}}</tspan>
Copy link
Contributor

@Zangetsu101 Zangetsu101 Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be kind enough to figure out why the values aren't consistent? i.e. OTHER, Mother, Father instead of OTHER, MOTHER, FATHER

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jamil314 has these changes in his PR btw

Copy link
Contributor Author

@tareq89 tareq89 Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zangetsu101 , @Nil20 , @jamil314

In v2-events/../pdfUtils.ts, we have the following code:

const resolvedDeclaration = stringifyDeclaration(fieldConfigs, $declaration)

const data = {
  $declaration: resolvedDeclaration,
  $metadata,
  $review: review,
  $references: {
    locations,
    users
  }
}

const output = template(data)
return output

The $declaration object contains all fields with their references resolved into human-readable values.
For example, the field informant.relation is a Select field. Its internal values are uppercase codes like FATHER, MOTHER, while the display labels are Father, Mother, etc.

After resolution, $declaration['informant.relation'] contains the labels (e.g., Father) instead of the raw values (e.g., FATHER).

Hence, when we bind these variables to the template, we use these resolved labels in the final output.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean we also need to think about french version of mother/father?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jamil314 , I have taken care of your concern in this PR and opencrvs/opencrvs-core#10599 here

@Nil20 Nil20 mentioned this pull request Sep 30, 2025
5 tasks
@tareq89 tareq89 force-pushed the ocrvs-10584 branch 2 times, most recently from 5d5ac47 to 6551e2f Compare October 6, 2025 09:44
Copy link
Contributor

@makelicious makelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the issue only in certified certificate or in all of them?

<!-- NOTE: Since we are using intl-lookup, we need to use informant.relation as actual value
rather than as stringified one. Hence we opt for native lookup over $lookup -->
{{#ifCond (lookup $declaration 'informant.relation') '===' 'MOTHER' }}
{{#ifCond (lookup $originalDeclaration 'informant.relation') '===' 'MOTHER' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way to to do this without original declaration? Previously we used native lookup not $lookup, since it provided the raw value. Any guesses what has changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In packages/client/src/v2-events/features/events/actions/print-certificate/pdfUtils.ts

...
  const stringifyDeclaration = getFormDataStringifier(
    intl,
    locations,
    adminLevels
  )
  const fieldConfigs = config.declaration.pages.flatMap((x) => x.fields)
  const resolvedDeclaration = stringifyDeclaration(fieldConfigs, $declaration)
...
  const data = {
    $declaration: resolvedDeclaration,
    $metadata,
    $review: review,
    $references: {
      locations,
      users
    }
  }

As you can see, we first resolve all the properties of the $declaration object, then we send it to svg template. Hence, we dont have any more reference values in $declaration rather always the resolved value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have reverted the change in the core, so now, we dont use resolved value for comparison anymore.

@tareq89 tareq89 merged commit 0923d38 into develop Oct 7, 2025
2 checks passed
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.

8 participants