Bug 16782: Disclose JSON URL for reports on the saved report page

It has always annoyed me that you had to look at the help to divine the url for a report.
This patch works it out and displays it for you in a new column on the saved reports table.

Requirements:
- OPACBaseURL and staffClientBaseURL preferences must be set for the urls to be complete. It's ok if they are not, but it's better if they are.
- You must have a saved report that is public to your OPAC, and one that is not public.

To test:
- create a public saved report and a private staff report. They can be anything.
- view the saved reports page, note that under a new heading of JSON URL the link to the json feed for that report shows.
- copying and pasting that link into the address bar, or clicking it, should take you to the results of the selected report.

sponsored-by: Catalyst IT

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Bug 16782 - missing </td>, fixed now

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Liz Rea 2017-10-19 16:23:43 +13:00 committed by Nick Clemens
parent e1bfe98d85
commit afbbfce0ee
1 changed files with 12 additions and 2 deletions

View File

@ -389,6 +389,7 @@ canned reports and writing custom SQL reports.</p>
<th class="title-string">Last edit</th>
<th class="title-string">Last run</th>
<th>Public</th>
<th>JSON URL</th>
[% IF (usecache) %] <th>Cache expiry (seconds)</th> [% END %]
<th>Saved results</th>
[% IF has_obsolete_reports %]<th>Update</th>[% END %]
@ -419,11 +420,20 @@ canned reports and writing custom SQL reports.</p>
<td><span title="[% savedreport.date_created %]">[% savedreport.date_created | $KohaDates %]</span></td>
<td><span title="[% savedreport.last_modified %]">[% savedreport.last_modified | $KohaDates with_hours => 1 %]</span></td>
<td><span title="[% savedreport.last_run %]">[% savedreport.last_run | $KohaDates with_hours => 1 %]</span></td>
<td>
[% IF (savedreport.public) %]
<td>Yes</td>
Yes
[% ELSE %]
<td>No</td>
No
[% END %]
</td>
<td>
[% IF (savedreport.public) %]
<a href="[% OPACBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]">[% OPACBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
[% ELSE %]
<a href="/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]">[% staffClientBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
[% END %]
</td>
[% IF (usecache) %] <td>[% savedreport.cache_expiry %]</td> [% END %]
<td>
[% FOR result IN savedreport.results %]