Bug 40239

Summary: Improve TT validation when saving notice
Product: Koha Reporter: Marion Durand <marion.durand>
Component: NoticesAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 31211    
Bug Blocks:    

Description Marion Durand 2025-06-25 11:54:20 UTC
Bug 31211 add a validation system to detect error in notification template when saving, but some errors are not caught by this system:

For example, the following model will not generate any error or warning when saving, but it will completely (and silently) prevent sending the notification 
```
Hello [% borrower.date_due %]
```
(in general, when trying to access a sub-field/sub-object that doesn't exist)

Another example is a model looking like this :
```
Hello [% patron.surname %]
```
This notification is still sent, but the object patron doesn't exist and is not replaced. It would be great to test and warn the librarian if they are using invalid or non-available objects.
Comment 1 Marion Durand 2025-06-25 12:07:40 UTC
To reproduce : 
1- Go to Tools > Notification
2- In any notification template (but for example WELCOME is easy to generate from a patron page), enter the following model:
```
Hello,
[% borrower.date_due %]
```
or 
```
Hello [% patron.surname %]
```
3- Click on "Save and continue editing" and display the section (message transport type, for example email) you juste edited.
4- No error message has been added, the template looks valid
5- generate the notification.
With the first example, no notification is generated. With the second one, it is generated, but the object is not replaced.