Bug 26091: Add column configuration and export options to catalog statistics report

This patch makes the catalog statistics report output a DataTable with
on-the-fly column configuration and export options.

Because the report can generate results with an arbitrary set of table
headers, the columns set to be passed to DataTables is built on the fly
along with the table. There is no global table setting.

Since the "grand total" cell might reflect a total which includes hidden
columns, the table footer label now indicates "all results."

To test, apply the patch and go to Reports.

- Submit a query to the "catalog" statistics wizard which will return
  multiple results.
- On the results page, confirm that the DataTable displays correctly and
  that all controls work as expected, including column configuration and
  export options.
- Submit other queries which will return a different set of columns in
  the result. Confirm that everything continues to work as expected.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Bug 26091: (follow-up) Remove unused TablesSettings usage

Since the table column information is built in the template rather than
in the columns_settings YML file we don't need "USE TablesSettings" in
this template.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2020-07-29 16:21:10 +00:00 committed by Jonathan Druart
parent 1ceb44ba2d
commit 4dc25f3192
1 changed files with 47 additions and 9 deletions

View File

@ -26,14 +26,17 @@
[% END %]
[% END %]
<table>
<tr>
<th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
[% FOREACH loopco IN mainloo.loopcol %]
<th>[% loopco.coltitle | html %]</th>
[% END %]
<th>TOTAL</th>
</tr>
<table id="catalogue_stats">
<thead>
<tr>
<th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
[% FOREACH loopco IN mainloo.loopcol %]
<th>[% loopco.coltitle | html %]</th>
[% END %]
<th>TOTAL</th>
</tr>
</thead>
<tbody>
[% FOREACH loopro IN mainloo.looprow %]
<tr>
[% IF ( loopro.hilighted ) %]<td class="hilighted">[% ELSE %]<td>[% END %]
@ -50,8 +53,10 @@
</td>
</tr>
[% END %]
</tbody>
<tfoot>
<tr>
<th>TOTAL</th>
<th>TOTAL (all results)</th>
[% FOREACH loopfoote IN mainloo.loopfooter %]
<th>
[% loopfoote.totalcol | html %]
@ -59,6 +64,7 @@
[% END %]
<th>[% mainloo.total | html %]</th>
</tr>
</tfoot>
</table>
[% END %]
[% ELSE %]
@ -303,6 +309,8 @@
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
function changeRemovedDateTrStatus() {
var Cellvalue = $("input[name='Cellvalue']:checked").val();
@ -335,6 +343,36 @@
changeRemovedDateTrStatus();
});
changeRemovedDateTrStatus();
columns_settings = [% FILTER collapse %]
[
{
"is_hidden": 0,
"columnname": "[% mainloo.line | html %]_[% mainloo.column | html %]",
"cannot_be_toggled": 1,
"cannot_be_modified": 1
},
[% FOREACH loopco IN mainloo.loopcol %]
{
"is_hidden": 0,
"columnname": "[% loopco.coltitle | html %]",
"cannot_be_toggled": 0,
"cannot_be_modified": 0
},
[% END %]
{
"is_hidden": 0,
"columnname": "total",
"cannot_be_toggled": 0,
"cannot_be_modified": 0
},
];
[% END %]
var catalogue_stats = KohaTable("catalogue_stats", {
'autoWidth': false,
'paging': false,
}, columns_settings );
});
</script>
[% END %]