Bug 10649 introduced a new include file for adding DataTables-related JavaScript assets. This patch adds use of this include file to all catalog-related pages which use DataTables.
The checkout history script has been altered to send unformatted dates to the template, and the template now uses the "title-string" sorting filter to enable sorting on unformatted dates. To test, view the following pages and confirm that table sorting is still working correctly: Catalog -> Biblio detail page Catalog -> Biblio detail page -> Checkout history --- catalogue/issuehistory.pl | 8 +------ .../prog/en/modules/catalogue/detail.tt | 8 +++---- .../prog/en/modules/catalogue/issuehistory.tt | 25 ++++++++++---------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/catalogue/issuehistory.pl b/catalogue/issuehistory.pl index a5c4d0d..ffb8d02 100755 --- a/catalogue/issuehistory.pl +++ b/catalogue/issuehistory.pl @@ -26,7 +26,6 @@ use C4::Output; use C4::Circulation; # GetBiblioIssues use C4::Biblio; # GetBiblio GetBiblioFromItemNumber use C4::Search; # enabled_staff_search_views -use Koha::DateUtils; my $query = new CGI; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( @@ -67,12 +66,7 @@ if ($itemnumber){ %{$biblio}, ); } -foreach (@{$issues}){ - $_->{date_due} = format_sqldatetime($_->{date_due}); - $_->{issuedate} = format_sqldatetime($_->{issuedate}); - $_->{returndate} = format_sqldatetime($_->{returndate}); - $_->{lastreneweddate} = format_sqldatetime($_->{lastreneweddate}); -} + $template->param( total => scalar @$issues, issues => $issues, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index a9c042d..79ee4fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -22,7 +22,7 @@ Details for [% title |html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %] [% END %] </title> -[% INCLUDE 'doc-head-close.inc' %]<script type="text/JavaScript" language="JavaScript"> +[% INCLUDE 'doc-head-close.inc' %]<script type="text/JavaScript"> //<![CDATA[ // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html function verify_images() { @@ -63,15 +63,13 @@ function verify_images() { //]]> </script> <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> -<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> +[% INCLUDE 'datatables.inc' %] +<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> [% INCLUDE 'browser-strings.inc' %] <!--[if lt IE 9]> <script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script> <![endif]--> <script type="text/javascript" src="[% interface %]/js/browser.js"></script> -[% INCLUDE 'datatables-strings.inc' %] -<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> <script type="text/javascript"> //<![CDATA[ var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt index 5f8da2e..4cd11ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt @@ -1,16 +1,15 @@ +[% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] <title>Koha › Catalog › Checkout history for [% title |html %]</title> [% INCLUDE 'doc-head-close.inc' %] <link rel="stylesheet" href="[% themelang %]/css/datatables.css" /> -<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> -<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> -[% INCLUDE 'datatables-strings.inc' %] +[% INCLUDE 'datatables.inc' %] <script type="text/javascript" id="js"> $(document).ready(function() { - [% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); - [% END %] $("#table_issues").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumns": [ + null,null,null,null,{ "sType": "title-string" },{ "sType": "title-string" },{ "sType": "title-string" } + ], "aaSorting": [[ 4, "desc" ]] }) ); @@ -61,25 +60,25 @@ $(document).ready(function() { [% END %]</td> <td>[% IF ( issue.renewals ) %] - Yes[% IF ( issue.lastreneweddate ) %], <small>last on: [% issue.lastreneweddate %]</small> + Yes[% IF ( issue.lastreneweddate ) %], <small>last on: [% issue.lastreneweddate |$KohaDates with_hours => 1 %]</small> [% END %] [% ELSE %] No [% END %]</td> <td>[% IF ( issue.issuedate ) %] - [% issue.issuedate %] + <span title="[% issue.issuedate %]">[% issue.issuedate |$KohaDates with_hours => 1 %]</span> [% ELSE %] - + <span title="0000-00-00"></span> [% END %]</td> <td>[% IF ( issue.date_due ) %] - [% issue.date_due %] + <span title="[% issue.date_due %]">[% issue.date_due |$KohaDates with_hours => 1 %]</span> [% ELSE %] - + <span title="0000-00-00"></span> [% END %]</td> <td>[% IF ( issue.returndate ) %] - [% issue.returndate %] + <span title="[% issue.returndate %]">[% issue.returndate |$KohaDates with_hours => 1 %]</span> [% ELSE %] - + <span title="0000-00-00"></span> [% END %]</td> </tr> [% END %] -- 1.7.9.5 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/