Bugzilla – Attachment 158092 Details for
Bug 34456
Add the ability to download a template rendered report as a file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34456: Add the ability to download a template rendered report as a file
Bug-34456-Add-the-ability-to-download-a-template-r.patch (text/plain), 4.31 KB, created by
Kyle M Hall (khall)
on 2023-10-30 17:38:28 UTC
(
hide
)
Description:
Bug 34456: Add the ability to download a template rendered report as a file
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-10-30 17:38:28 UTC
Size:
4.31 KB
patch
obsolete
>From 9dfe6ff495366e73a253e32ee9a1e17ebf5e97ed Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 2 Aug 2023 07:56:46 -0400 >Subject: [PATCH] Bug 34456: Add the ability to download a template rendered > report as a file > >Bug 34136 adds the ability to render a report using a notice template rather than displaying data in a table. It would be even more useful to be able to download the contents as a file where the notice subject can be used as the filename so the filename can be generated dynamically ( such as adding the current date as part of the filename ). > >Test Plan: >1) Follow the test plan for Bug 34136 >2) Run your report >3) Note under the Download menu the new item "Download as" with the > subject line for your template >4) Click that link, note the file contains the contents of your report! > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > .../prog/en/includes/reports-toolbar.inc | 3 +++ > reports/guided_reports.pl | 15 ++++++++++++++- > 2 files changed, 17 insertions(+), 1 deletion(-) > >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 de76725e8c1..70954f7b863 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >@@ -134,6 +134,9 @@ > <li><a id="csv" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=csv&report_id=[% id | html %]&reportname=[% name |uri %][% PROCESS params %]">[% PROCESS 'delimiter_text.inc' %]</a></li> > <li><a id="tab" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=tab&report_id=[% id | html %]&reportname=[% name |uri %][% PROCESS params %]">Tab separated text</a></li> > <li><a id="ods" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=ods&report_id=[% id | html %]&reportname=[% name |uri %][% PROCESS params %]">Open Document Spreadsheet</a></li> >+ [% IF processed_notice_title %] >+ <li><a id="template" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=template&report_id=[% id | html %]&template=[% template_id | html %]&reportname=[% name |uri %][% PROCESS params %]">Download as <i>[% processed_notice_title | html %]</i></a></li> >+ [% END %] > [% IF (results.json) %] > <li><a id="download-chart" href="#">Chart (.svg)</a></li> > [% END %] >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 6212fdae038..c3c104aaf28 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -884,7 +884,13 @@ elsif ($phase eq 'Run this report'){ > 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 ); >+ my $title_rendered = >+ process_tt( $notice_template->title, { data => $data, report_id => $report_id } ); >+ $template->param( >+ template_id => $template_id, >+ processed_notice => $notice_rendered, >+ processed_notice_title => $title_rendered, >+ ); > } > > $template->param( >@@ -983,6 +989,13 @@ elsif ($phase eq 'Export'){ > $content .= $_ while <$ods_fh>; > unlink $ods_filepath; > } >+ elsif ( $format eq 'template' ) { >+ my $template_id = $input->param('template'); >+ my $notice_template = Koha::Notice::Templates->find($template_id); >+ my $data = $sth->fetchall_arrayref({}); >+ $content = process_tt( $notice_template->content, { data => $data, report_id => $report_id, for_download => 1 } ); >+ $reportfilename = process_tt( $notice_template->title, { data => $data, report_id => $report_id } ); >+ } > } > print $input->header( > -type => $type, >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34456
:
154156
|
154158
|
157924
|
157925
|
158092
|
158093
|
158094
|
158105
|
158106
|
158107