https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43597
--- Comment #1 from Kyle M Hall (khall) <[email protected]> --- Created attachment 208074 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208074&action=edit Bug 43597: Add system message for notice templates that fail to render Currently, a notice template can call a method that doesn't exist, for example [% checkout.biblio.title %] instead of [% checkout.item.biblio.title %]. The check in the notice editor renders the template with no objects, so the bad token is simply empty and the template saves without complaint. The template then dies the first time Koha renders it for real: ERROR PROCESSING TEMPLATE: undef error - The method Koha::Checkout->biblio is not covered by tests! Nothing in the staff interface shows this. For a checkout notice it means an error page at checkout time. For an overdue notice it means overdue_notices.pl dies on the first patron every night and no overdue notices go out at all. We have seen exactly that at a library: a librarian edited the ODUE template, the nightly cron died quietly from then on, and it was months before anyone noticed no notices were being sent. This patch makes GetPreparedLetter record a system message when a stored template fails to render. The message names the template code, module, library, transport and language along with the first line of the error, and repeats collapse into one message with an occurrence count. The error is then rethrown, so callers behave exactly as before. Ad hoc letters like the notice editor preview are not reported because they have no template code to point at. If the caller wraps GetPreparedLetter in a transaction that it then rolls back, the system message is rolled back with it. Test Plan: 1) Apply this patch 2) Restart all the things! 3) Edit the ISSUESLIP notice ( Tools > Notices and slips ) and add [% borrower.biblio.title %] anywhere in the print template 4) Check an item out to a patron, then from the checkouts page click Print > Print slip 5) Note the error! 6) Browse to Administration > System messages 7) Note the message for ISSUESLIP with the error text! 8) Print the slip again, note the occurrences count is now 2! 9) Remove the bad token from ISSUESLIP, print the slip again, note the slip prints and no new message appears 10) prove t/db_dependent/Letters/TemplateToolkit.t -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
