From 5f2db8d8b21544b068dd85a74f7e4753b9b4fc20 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 11 Mar 2025 05:00:18 +0000 Subject: [PATCH] Bug 39298: Add runtime parameter support to report templates This change makes it so that you can provide runtime parameters and use "Run with template". Test plan: 0. Apply the patch and koha-plack --restart kohadev 1. Create a report template. For example: [% FOREACH row IN data %] [% END %]
Transformed Biblionumber
Biblionumber [% row.biblionumber %]
2. Create a SQL report with a runtime parameter. For example: SELECT biblionumber FROM biblio WHERE biblionumber > <> 3. Run the report using "Run with template" 4. Specify a biblionumber of 1 5. Click "Run the report" 6. Note that the output is the template output and not regular SQL output Signed-off-by: David Nind --- .../prog/en/modules/reports/guided_reports_start.tt | 3 +++ reports/guided_reports.pl | 1 + 2 files changed, 4 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index 55afc39ff0..6eda1b2063 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -926,6 +926,9 @@
+ [% IF ( template_id ) %] + + [% END %]
diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 70196334d9..901e11faf0 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -971,6 +971,7 @@ if ( $op eq 'run' ) { 'auth_val_errors' => \@authval_errors, 'enter_params' => 1, 'id' => $report_id, + 'template_id' => $template_id, ); } else { my ( $sql, $header_types ) = $report->prep_report( \@param_names, \@sql_params ); -- 2.39.5