Bug 40227 - When TT notices fail at generation, no error is visible in the interface
Summary: When TT notices fail at generation, no error is visible in the interface
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-24 12:28 UTC by Marion Durand
Modified: 2025-06-24 12:29 UTC (History)
0 users

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marion Durand 2025-06-24 12:28:57 UTC
When using an invalid letter model, the notification will not be generated and will not appear as failed in the message_queue table. 

There is no way to see that a notification has failed to generate (except by knowing he has requested a notice that has not appeared, it is easy for welcome as it is manual but way harder for DUE, PPREDUE, ... that are automaticly generated).



Step to reproduce : 
1- Select a borrower with an email address (primay email, no need to be a valid one)
2- On the detail page of the patron, click on "More" then "Send welcoe notice"
3- In tab Notices, check that it is generated correctly (default model)
4- Go to Tools > Notices and slip
5- Update the notice WELCOME with the following model
```
Welcome [% borrower.date_due %]
```
No warning is generated on the interface when saving
6- Repeat step 2
7- No notice is generated, no interface warning/error/message is generated, no log error either : the librarian has no way of knowing that it has failed !
Comment 1 Marion Durand 2025-06-24 12:29:39 UTC
The only case where I got some log is when the TT error is in a notice generated by a cronjob (advances_notices.pl, PREDUEDGST), I got the follwing error by an email report of the cron :


```
ERROR PROCESSING TEMPLATE: undef error - The method Koha::Item->date_due is not covered by tests!

Trace begun at /home/koha/src/Koha/Object.pm line 971
Koha::Object::AUTOLOAD('Koha::Item=HASH(0x652e9719dd30)') called at input text line 20
eval {...} at input text line 20
eval {...} at input text line 28
eval {...} at input text line 7
Template::Document::__ANON__('Template::Context=HASH(0x652e970c9310)') called at /usr/lib/x86_64-linux-gnu/perl5/5.30/Template/Document.pm line 163
eval {...} at /usr/lib/x86_64-linux-gnu/perl5/5.30/Template/Document.pm line 161
Template::Document::process('Template::Document=HASH(0x652e9715bdb8)', 'Template::Context=HASH(0x652e970c9310)') called at /usr/lib/x86_64-linux-gnu/perl5/5.30/Template/Context.pm line 351
eval {...} at /usr/lib/x86_64-linux-gnu/perl5/5.30/Template/Context.pm line 321
Template::Context::process('Template::Context=HASH(0x652e970c9310)', 'Template::Document=HASH(0x652e9715bdb8)') called at /usr/lib/x86_64-linux-gnu/perl5/5.30/Template/Service.pm line 94
eval {...} at /usr/lib/x86_64-linux-gnu/perl5/5.30/Template/Service.pm line 91
Template::Service::process('Template::Service=HASH(0x652e96fb4180)', 'SCALAR(0x652e93d6eda0)', 'HASH(0x652e97002668)') called at /usr/lib/x86_64-linux-gnu/perl5/5.30/Template.pm line 66
Template::process('Template=HASH(0x652e97002278)', 'SCALAR(0x652e93d6eda0)', 'HASH(0x652e97002668)', 'SCALAR(0x652e93d6f670)') called at /home/koha/src/C4/Letters.pm line 1721
C4::Letters::try {...}  at /usr/share/perl5/Try/Tiny.pm line 100
eval {...} at /usr/share/perl5/Try/Tiny.pm line 93
Try::Tiny::try('CODE(0x652e970c9718)', 'Try::Tiny::Finally=REF(0x652e8d0621b0)') called at /home/koha/src/C4/Letters.pm line 1725
C4::Letters::_process_tt('HASH(0x652e97002ed8)') called at /home/koha/src/C4/Letters.pm line 639
C4::Letters::GetPreparedLetter('module', 'circulation', 'letter_code', 'PREDUEDGST', 'branchcode', 'SEG', 'lang', 'default', 'substitute', 'HASH(0x652e96fcc128)', 'tables', 'HASH(0x652e93dacb70)', 'loops', 'HASH(0x652e9708a240)', 'message_transport_type', 'email') called at /home/koha/src/misc/cronjobs/advance_notices.pl line 503
main::parse_letter('HASH(0x652e96fc85c8)') called at /home/koha/src/misc/cronjobs/advance_notices.pl line 610
main::send_digests('HASH(0x652e96f80ab8)') called at /home/koha/src/misc/cronjobs/advance_notices.pl line 449
 at /home/koha/src/misc/cronjobs/advance_notices.pl line 503.
```