From 7027235199a85bbfe80af4f15c4bf5c58ee3e66a Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 10 Feb 2014 09:29:13 -0500 Subject: [PATCH] Bug 11718 - Use new DataTables include in reports templates Bug 10649 introduced a new include file for adding DataTables-related JavaScript assets. This patch adds use of this include file to all circ-related pages which use DataTables. Apply the patch and test the following pages to confirm that table sorting works correctly: - Reports -> Guided reports -> Use saved (reports/guided_reports.pl?phase=Use saved): "Creation date" sorting has been reconfigured to use the title-string method for sorting on an unformatted date. C4:Reports::Guided.pm has been modified to pass an unformatted date to the template. Sorting should work correctly for all settings of the dateformat system pref. - Reports -> Catalog by item type (reports/manager.pl?report_name=itemtypes) - Reports -> Serials statistics wizard (reports/serials_stats.pl): The subscription begin and subscription end columns have been modified to use the title-string filter for sorting. An unformatted date is now passed from reports/serials_stats.pl to the template, where the KohaDates filter is used for formatting. Sorting is based on the unformatted date. Sorting should work correctly for all settings of the dateformat system pref. - Sorting of titles should now exclude article from sorting. - Minor template improvements: - Vendor name now links to vendor details. - Subscription title now links to subscription details. - Library name is now shown instead of branchcode. Signed-off-by: Aleisha --- C4/Reports/Guided.pm | 1 - .../en/modules/reports/guided_reports_start.tt | 18 +++++-------- .../prog/en/modules/reports/itemtypes.tt | 6 +--- .../prog/en/modules/reports/serials_stats.tt | 26 ++++++++++--------- reports/serials_stats.pl | 3 +- 5 files changed, 24 insertions(+), 30 deletions(-) diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index 22a23dd..f827090 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -673,7 +673,6 @@ sub get_saved_reports { $query .= " ORDER by date_created"; my $result = $dbh->selectall_arrayref($query, {Slice => {}}, @args); - $_->{date_created} = format_date($_->{date_created}) foreach @$result; return $result; } 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 2ac91d6..64522a8 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 @@ -1,3 +1,4 @@ +[% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] Koha › Reports › Guided reports wizard [% IF ( saved1 ) %]› Saved Reports @@ -21,16 +22,11 @@ </style> [% IF ( saved1 ) %] <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> -<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> -[% INCLUDE 'datatables-strings.inc' %] -<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> +[% INCLUDE 'datatables.inc' %] [% END %] <script type="text/javascript"> //<![CDATA[ -[% IF (dateformat == 'metric' && saved1) %] -dt_add_type_uk_date(); -[% END %] var group_subgroups = {}; [% FOREACH group IN groups_with_subgroups %] var gid = "[% group.id %]" @@ -61,9 +57,6 @@ function load_group_subgroups () { $(document).ready(function(){ [% IF (saved1) %] - [% IF (dateformat == "metric") %] - dt_add_type_uk_date(); - [% END %] var rtable = $("#table_reports").dataTable($.extend(true, {}, dataTablesDefaults, { 'bAutoWidth': false, 'sDom': 't<"bottom pager"ilpf>', @@ -72,10 +65,13 @@ $(document).ready(function(){ 'iDisplayLength': 20, 'aaSorting': [[ 1, "asc" ]], 'aoColumnDefs': [ - { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1, -2, -3, -4] }, + { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1, -2, -3] }, { 'bSearchable': false, 'aTargets': [3, 4] }, { "aTargets": [ 1, 2 ], "sType": "natural" } ], + "aoColumns": [ + null,null,null,null,null,null,null,null,{ "sType": "title-string" },null,[% IF (usecache) %]null,[% END %]null,null + ], 'oLanguage': { 'sZeroRecords': _("No matching reports found") } @@ -326,7 +322,7 @@ canned reports and writing custom SQL reports.</p> <td>[% savedreport.subgroupname %]</td> <td>[% savedreport.notes %]</td> <td>[% savedreport.borrowersurname %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname %][% END %] ([% savedreport.borrowernumber %])</td> - <td>[% savedreport.date_created %]</td> + <td><span title="[% savedreport.date_created %]">[% savedreport.date_created | $KohaDates %]</span></td> [% IF (savedreport.public) %] <td>Yes</td> [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt index acbba9d..689f262 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt @@ -2,10 +2,8 @@ <title>Koha › Reports › Catalog by item types [% INCLUDE 'doc-head-close.inc' %] [% IF ( do_it ) %] - - -[% INCLUDE 'datatables-strings.inc' %] - + +[% INCLUDE 'datatables.inc' %] -[% INCLUDE 'datatables-strings.inc' %] - + +[% INCLUDE 'datatables.inc' %]