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 ).
Created attachment 154156 [details] [review] 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!
Created attachment 154158 [details] [review] 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>
Kyle, can you please help resolve? Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 34456 - Add the ability to download a template rendered report as a file error: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc). error: could not build fake ancestor Patch failed at 0001 Bug 34456 - Add the ability to download a template rendered report as a file hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-34456---Add-the-ability-to-download-a-template-mpcxly5w.patch
Created attachment 157924 [details] [review] 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>
Created attachment 157925 [details] [review] 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>
This works, but there are some bigger and smaller issues: 1) It produces an invalid HTML file, missing the html and body tags. If we were to add them to the template, the template could no longer be properly displayed in Koha. That's why I feel it would be better to add those on export. It's created with a .html ending, so I assume that is the use case. 2) The patch commit line needs to be fixed. 3) I think we should change the label in the download menu to fit with the others. It's a list of formats now, never including the word "Download", so my suggestion would be something like: "HTML using [template] '<template>'" If possible please avoid the <i> as they break up the string. 4) Perltidy please.
(In reply to Katrin Fischer from comment #6) > This works, but there are some bigger and smaller issues: > > 1) It produces an invalid HTML file, missing the html and body tags. If we > were to add them to the template, the template could no longer be properly > displayed in Koha. That's why I feel it would be better to add those on > export. It's created with a .html ending, so I assume that is the use case. This feature is meant to generate arbitrary formats. The only production use case we have right now produces an XML file. To make the data viewable before download I use IF blocks to warp the xml in a textarea. This is just one possible way to deal with the issue. The main point is that this feature isn't mean to be HTML only. > 2) The patch commit line needs to be fixed. Fixed! > 3) I think we should change the label in the download menu to fit with the > others. It's a list of formats now, never including the word "Download", so > my suggestion would be something like: "HTML using [template] '<template>'" > If possible please avoid the <i> as they break up the string. As explained above, this isn't meant to be strictly for HTML. Instead, I'll change the option to "Rendered template ( <filename> )". That will more closely match what we are doing now. > > 4) Perltidy please. Can do!
I was wondering if it should work for different formats. I am ok with the name change, but should we also do something about the file ending then?
Created attachment 158092 [details] [review] 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>
Created attachment 158093 [details] [review] Bug 34456: (QA follow-up) Change download link language
Created attachment 158094 [details] [review] Bug 34456: (QA follow-up) perltidy code
(In reply to Katrin Fischer from comment #8) > I was wondering if it should work for different formats. I am ok with the > name change, but should we also do something about the file ending then? The file name is controlled by the report title template. Does that work for you?
(In reply to Kyle M Hall from comment #12) > (In reply to Katrin Fischer from comment #8) > > I was wondering if it should work for different formats. I am ok with the > > name change, but should we also do something about the file ending then? > > The file name is controlled by the report title template. Does that work for > you? Can you rephrase that? Or I'll try to explain better: the file I downloaded had a .html ending.
(In reply to Katrin Fischer from comment #13) > (In reply to Kyle M Hall from comment #12) > > (In reply to Katrin Fischer from comment #8) > > > I was wondering if it should work for different formats. I am ok with the > > > name change, but should we also do something about the file ending then? > > > > The file name is controlled by the report title template. Does that work for > > you? > > Can you rephrase that? Or I'll try to explain better: the file I downloaded > had a .html ending. The "Message subject" becomes the filename. I think your browser is adding the .html to your file. I have mine set to "Example.xml" and when I choose to download it my browser tells me it is an html file, but honors the "Example.xml" message subject. I bet if I changed it to just "Example" my browser would tack on the .html on its' own.
Created attachment 158105 [details] [review] 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> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 158106 [details] [review] Bug 34456: (QA follow-up) Change download link language Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 158107 [details] [review] Bug 34456: (QA follow-up) perltidy code Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 23.11. Nice work everyone, thanks!
Depends on Bug 34136 not in 23.05.x