Skip to content

Lut 32733 : display N/A option for empty field#38

Open
rkaabeche wants to merge 4 commits into
lutece-platform:developfrom
rkaabeche:LUT-32733-display-NA-for-empty-field
Open

Lut 32733 : display N/A option for empty field#38
rkaabeche wants to merge 4 commits into
lutece-platform:developfrom
rkaabeche:LUT-32733-display-NA-for-empty-field

Conversation

@rkaabeche

Copy link
Copy Markdown

No description provided.

-- changeset workflow-formspdf:update_db_workflow-formspdf-2.0.0-2.0.1-rev1.sql
ALTER TABLE workflow_task_formspdf_template ADD COLUMN file_name VARCHAR(350);

-- changeset workflow-formspdf:update_db_workflow-formspdf-2.0.0-2.0.1-rev1.sql

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use a different changeset id, it will fail at runtime if liquibase is active.

E.g : -- changeset workflow-formspdf:update_db_workflow-formspdf-2.0.0-2.0.1-rev2.sql

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

well changing the id is not enough, you must create a new file src/sql/plugins/workflow/modules/formspdf/upgrade/update_db_workflow-formspdf-2.0.1-2.0.2.sql‎ as 2.0.1 is a release and the current version is 2.0.2-SNAPSHOT

So the id of the change should be -- changeset workflow-formspdf:update_db_workflow-formspdf-2.0.1-2.0.2.sql

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for your feedback.

It's been corrected.

private void replaceNullEntries( Map<String, Object> model, Locale currentLocale )
{
model.forEach( ( key, value ) -> {
if ( key.contains( "code_" ) )

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there any constant in Forms or Core to cover this prefix ? Can't we use entry_code_ a.k.a FormResponseSearchItem.FIELD_ENTRY_CODE_SUFFIX and start with ? is there any other case containing *code_* ? Otherwise, please provide a shared constant in the module.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This comes from GenericFormsProvider.getValuesModel(), where the suffixes “position_” and “code_” are added:

image image

I created two variables to make the code cleaner in our context.

private static final String PROPERTY_LABEL_DESCRIPTION = "module.workflow.formspdf.export.pdf.description";
private static final String EMPTY_RESPONSE_VALUE = "module.workflow.formspdf.modify.template.replaceEmpty.defaultValue";
private static final String FTL_SQUARE_BRACKET_TAG = "[#ftl]";
private static final String MARK_POSITION = "position_";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think we should have shared constants from Forms plugin, and use it in GenericAttributes and this module. It would better to avoid broken changes in the future.

@rkaabeche rkaabeche Jul 20, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

private static final String EMPTY_RESPONSE_VALUE = "module.workflow.formspdf.modify.template.replaceEmpty.defaultValue";
private static final String FTL_SQUARE_BRACKET_TAG = "[#ftl]";
private static final String MARK_POSITION = "position_";
private static final String MARK_CODE = "code_";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That's been changed, too

}
});
model.entrySet( ).removeIf( e -> {
if ( e.getKey( ).contains( MARK_POSITION ) )

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GenericFormsProvider uses it as a prefix so we should use startsWith instead of contains ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, that is indeed a prefix. I replaced it with a startWith

private void replaceNullEntries( Map<String, Object> model, Locale currentLocale )
{
model.forEach( ( key, value ) -> {
if ( key.contains( MARK_CODE ) )

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Same here, I replaced it with startsWith

@lobtx

lobtx commented Jul 20, 2026

Copy link
Copy Markdown

@rkaabeche
rkaabeche force-pushed the LUT-32733-display-NA-for-empty-field branch from 160a8b3 to 920eeb2 Compare July 23, 2026 13:42
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.

2 participants