Add validation for Patron Notice Templates

Description

When investigating why some notices were not being sent for a library - we observed a message in the logs – indicating a possible issue with the Patron Notice Template syntax

17:48:43 [] [] [] [] ERROR TemplateEngineHelper Failed to close 'loans' tag @[null:1]
 
We determined that the patron notice had  invalid syntax and as a result notices were not going out

From tips

https://folio-org.atlassian.net/wiki/display/FOLIOtips/Settings+-+Circulation+-+Patron+notice+templates 

Requests to update or create new templates should validate template syntax and prevent users from creating template with errors - such as missing closing tags or tags appearing outside of needed blocks.

[
https://bugfest-kiwi.folio.ebsco.com/settings/circulation/patron-notices/962b8d90-9700-4435-8d6e-e7af50fb2242?

 

Environment

None

Potential Workaround

None

Attachments

1

Checklist

hide

TestRail: Results

Activity

Show:

Brooks TravisJune 6, 2024 at 7:10 AM

At a minimum, something that verifies the structural integrity of the template (can this actually be rendered by the backend) would be tremendously helpful in avoiding the situation where notices fail to generate, at all (500 errors).

Vignesh KalyanasundaramApril 27, 2023 at 9:08 AM

Hi and , I have discussed this Jira with , we have the below questions. Please take a look.

1)Do we need to only validate the closing tag {{/loans}} if that template is having start loans tag {{#loans}} ?
2)what do we need to do if the starting tag itself wrong. Instead of {{#loans}} if someone added the tag as {{loans}}, then in that case how can we validate it.
3)If we are adding a loan token in a template outside of multiple loan tags({{#loans}} {{/loans}}),then do we need to move the token alone inside the Multiple loan tag or we need to move the free text before/after the loan token.
 Example :
 The following book(s) expired.{{#loans{{item.title}} {{item.callNumber}}{{/loans}}on {{loan.dueDate}}}}
 what is the Expected behavior?
 The following book(s) expired.{{#loans{{item.title}} {{item.callNumber}}{{loan.dueDate}}{{/loans}}on }}
 OR
 The following book(s) expired.{{#loans{{item.title}} {{item.callNumber}}on {{loan.dueDate}}{{/loans}}}}
4.From the comments, it looks like there will be error if we don't close the loans tag. How can we know the end of tokens and close it.
5.If there is no start tag, do we need to remove {{/loans}} tag if it is added ?
6.start/close tag validation - only syntactic validation? - FE or BE?
7.what are the eligible candidates(free text, eligible tags, ....) that can be enclosed within start and close multiple loans tag? Basically rules for this set of tags
8.Scope of any existing validation

cc :   

Carole GodfreyApril 28, 2022 at 1:29 PM

Another sample template with extraneous {#loans}} tag – notices did not go out due to this formatting error

 

Carole GodfreyFebruary 27, 2022 at 5:30 PM

 

Carole GodfreyFebruary 27, 2022 at 5:26 PM
Edited

Adding a few more sample templates with issues that caused notices to not go out

Details

Assignee

Reporter

Priority

Sprint

Development Team

Volaris

Affected Institution

!!!ALL!!!

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created February 22, 2022 at 2:20 PM
Updated June 6, 2024 at 7:10 AM
TestRail: Cases
TestRail: Runs