From 40c471697ca78d2aea52cd1a6cc2a583055a6f6a Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 10 Feb 2014 14:13:11 -0500 Subject: [PATCH] [SIGNED-OFF] Bug 11736 - Use new DataTables include in Koha news templates Bug 10649 introduced a new include file for adding DataTables-related JavaScript assets. This patch adds use of this include file to the Koha news page. To test you should have existing news items with varying creation and expiration dates. Apply the patch and confirm that table sorting works correctly for all settings of the dateformat system preference. C4::NewsChannels.pm has been modified so that it now passes an unformatted date to the template, where the KohaDates plugin is used to apply the correct formatting. Sorting is based on the unformatted date. Also corrected: Capitalization errors. Signed-off-by: wajasu --- C4/NewsChannels.pm | 2 -- .../intranet-tmpl/prog/en/modules/tools/koha-news.tt | 17 +++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm index 0201729..7c34239 100644 --- a/C4/NewsChannels.pm +++ b/C4/NewsChannels.pm @@ -116,8 +116,6 @@ sub get_opac_news { my $count = 0; while (my $row = $sth->fetchrow_hashref) { if ((($limit) && ($count < $limit)) || (!$limit)) { - $row->{'newdate'} = format_date($row->{'newdate'}); - $row->{'expirationdate'} = format_date($row->{'expirationdate'}); push @opac_news, $row; } $count++; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt index b92f63a..411ab1f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt @@ -1,20 +1,21 @@ +[% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › News [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] [% IF ( opac_news_count ) %] - - - [% INCLUDE 'datatables-strings.inc' %] - + + [% INCLUDE 'datatables.inc' %]