From cbbfa8c8d285ebaa6e8cec11754eb8c79c7cf35a Mon Sep 17 00:00:00 2001 From: Olivia Reynolds Date: Fri, 5 Jun 2026 12:40:50 +0000 Subject: [PATCH] Bug 38621: Use GetPreparedLetter for report templates Previously, report templates were rendered using process_tt directly. This made the available variables inconsistent with other notices and slips. This patch switches to rendering report templates through the same function as other notices. To match the arguments to this system, this patch also makes the report system reference templates by their code rather than ID. Test plan: 1. Under Tools > Notices and Slips, create a new notice in the Reports module. Choose a code and a name, and under Email assign a subject and the following body: [% today %] [% FOREACH d IN data %] [% d.title %] [% END %] 2. Under Reports, create a new report from SQL with a name and the following query: SELECT * FROM biblio LIMIT 1 3. Create another report from SQL with a different name and the following query, specifying a runtime parameter: SELECT * FROM biblio WHERE 'a'=<> LIMIT 1 4. On the first report, select "Run with template" and choose the template created earlier. 5. Verify that the report runs successfully, and the output does not include the current date. 6. On the second report, select "Run with template" and choose the template created earlier. Choose "a" as the runtime parameter value when asked. 7. Verify that the report runs successfully, and the output does not include the current date. 8. Apply patch. 9. On the first report, select "Run with template" and choose the template created earlier. 10. Verify that the report runs successfully, and the output now includes the current date along with the fetched data. 11. Under the Download dropdown, select "Rendered template (...)". 12. Verify the downloaded file matches the report output. 13. On the second report, select "Run with template" and choose the template created earlier. Choose "a" as the runtime parameter value when asked. 14. Verify that the report runs successfully, and the output now includes the current date along with the fetched data. 15. Under the Download dropdown, select "Rendered template (...)". 16. Verify the downloaded file matches the report output. Sponsored-by: Open Fifth Signed-off-by: David Nind Signed-off-by: Lisette Scheer Signed-off-by: Pedro Amorim --- .../prog/en/includes/reports-toolbar.inc | 4 +- .../modules/reports/guided_reports_start.tt | 4 +- reports/guided_reports.pl | 51 +++++++++---------- 3 files changed, 27 insertions(+), 32 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc index 9f275511e0..3181e8c28c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc @@ -71,7 +71,7 @@