From a4a014e365a6d27d1105096861a19f94aa5372f7 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 10 Feb 2014 14:13:11 -0500 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer Works as described, no problems found. Also passes tests and QA script. Signed-off-by: Galen Charlton --- C4/NewsChannels.pm | 2 -- .../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 0201729ce2..7c342390d4 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 b92f63a7b1..411ab1fa82 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' %]