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 ba5b9d3d92..de76725e8c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc @@ -63,6 +63,23 @@ Run report + [% IF templates.count %] +
+ + +
+ [% END %]
Schedule 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 98812c4420..07f18eb2a9 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 @@ -903,7 +903,9 @@ [% END # /IF ( enter_params ) %] - [% IF ( execute ) %] + [% IF processed_notice %] + [% processed_notice | $raw %] + [% ELSIF ( execute ) %]

[% name | html %] Report ID: [% id | html %]

[% IF ( notes ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 79e660255c..f25d9a3340 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -172,6 +172,7 @@
  • Serials (new issue)
  • Suggestions
  • Point of sale
  • +
  • Report
  • @@ -230,6 +231,7 @@ [% CASE 'serial' %]Serials (new issue) [% CASE 'suggestions' %]Suggestions [% CASE 'pos' %]Point of sale + [% CASE 'report' %]Report [% CASE %][% lette.module | html %] [% END %] @@ -411,6 +413,11 @@ [% ELSE %] [% END %] + [% IF ( module == "report" ) %] + + [% ELSE %] + + [% END %]
  • diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 46792bf88c..e8c8941d46 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -37,6 +37,8 @@ use Koha::Libraries; use Koha::Patron::Categories; use Koha::SharedContent; use Koha::Util::OpenDocument qw( generate_ods ); +use Koha::Notice::Templates; +use Koha::TemplateUtils qw( process_tt ); use C4::ClassSource qw( GetClassSources ); =head1 NAME @@ -79,6 +81,8 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $session_id = $input->cookie('CGISESSID'); my $session = $session_id ? get_session($session_id) : undef; +$template->param( templates => Koha::Notice::Templates->search({ module => 'report' }) ); + my $filter; if ( $input->param("filter_set") or $input->param('clear_filters') ) { $filter = {}; @@ -671,6 +675,7 @@ elsif ($phase eq 'Run this report'){ my $report_id = $input->param('reports'); my @sql_params = $input->multi_param('sql_params'); my @param_names = $input->multi_param('param_name'); + my $template_id = $input->param('template'); my $want_full_chart = $input->param('want_full_chart') || 0; # offset algorithm @@ -872,6 +877,15 @@ elsif ($phase eq 'Run this report'){ $url = join('&sql_params=', $url, map { URI::Escape::uri_escape_utf8($_) } @sql_params); } + if ($template_id) { + my $notice_template = Koha::Notice::Templates->find($template_id); + my ( $sth2, $errors2 ) = execute_query( { sql => $sql, report_id => $report_id } ); + my $data = $sth2->fetchall_arrayref( {} ); + my $notice_rendered = + process_tt( $notice_template->content, { data => $data, report_id => $report_id } ); + $template->param( processed_notice => $notice_rendered ); + } + $template->param( 'results' => \@rows, 'allresults' => \@allrows,