From 15573ab950690d133bc5fa6d3624648caff1d08d Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 30 Sep 2020 18:58:01 +0000 Subject: [PATCH] Bug 22544: Update to current codebase Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- Koha/News.pm | 9 +++++++-- .../intranet-tmpl/prog/en/modules/intranet-main.tt | 2 +- .../intranet-tmpl/prog/en/modules/tools/koha-news.tt | 2 +- t/db_dependent/Koha/News.t | 12 ++++++------ tools/koha-news.pl | 4 ++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Koha/News.pm b/Koha/News.pm index f0106a7852..79f2a2104a 100644 --- a/Koha/News.pm +++ b/Koha/News.pm @@ -55,7 +55,12 @@ type is one of this: - slip - for ISSUESLIP notice - koha - for intranet - opac - for online catalogue -- OpanNavRight - Right column in the online catalogue +- OpacNavRight - Right column in the online catalogue +- OpacLoginInstructions +- OpacMainUserBlock +- OpacCustomSearch +- opacheader +- opaccredits lang is language code - it is used only when type is opac or OpacNavRight @@ -78,7 +83,7 @@ sub search_for_display { } $search_params->{branchcode} = [ $params->{library_id}, undef ] if $params->{library_id}; - $search_params->{timestamp} = { '<=' => \'NOW()' }; + $search_params->{published_on} = { '<=' => \'NOW()' }; $search_params->{-or} = [ expirationdate => { '>=' => \'NOW()' }, expirationdate => undef ]; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt index 189425fd0e..0af0cdf619 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -31,7 +31,7 @@ [% FOREACH koha_new IN koha_news %]

[% koha_new.title | html %]

[% koha_new.content | $raw %]
-

Posted on [% koha_new.timestamp | $KohaDates %][% IF( show_author && koha_new.borrowernumber ) %] by [% koha_new.author.title | html %] [% koha_new.author.firstname | html %] [% koha_new.author.surname | html %]
[% END %] +

Posted on [% koha_new.published_on | $KohaDates %][% IF( show_author && koha_new.borrowernumber ) %] by [% koha_new.author.title | html %] [% koha_new.author.firstname | html %] [% koha_new.author.surname | html %]
[% END %] [% IF ( CAN_user_tools ) %] Edit | Delete 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 1bf1148825..798a992658 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 @@ -178,7 +178,7 @@ [% ELSE %][% opac_new.library.branchname | html %] [% END %] [% opac_new.number | html %] - [% opac_new.timestamp | $KohaDates %] + [% opac_new.published_on | $KohaDates %] [% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.is_expired ) %](expired)[% END %] [% opac_new.title | html %] [% IF ( opac_new.author) %][% INCLUDE 'patron-title.inc' patron=opac_new.author hide_patron_infos_if_needed=1 %][% END %] diff --git a/t/db_dependent/Koha/News.t b/t/db_dependent/Koha/News.t index e87835a0a3..4572286b30 100755 --- a/t/db_dependent/Koha/News.t +++ b/t/db_dependent/Koha/News.t @@ -159,7 +159,7 @@ subtest '->search_for_display' => sub { class => 'Koha::News', value => { expirationdate => $yesterday, - timestamp => $today, + published_on => $today, lang => '', branchcode => undef, number => 1, @@ -169,7 +169,7 @@ subtest '->search_for_display' => sub { class => 'Koha::News', value => { expirationdate => $tomorrow, - timestamp => $today, + published_on => $today, lang => '', branchcode => undef, number => 2, @@ -179,7 +179,7 @@ subtest '->search_for_display' => sub { class => 'Koha::News', value => { expirationdate => $tomorrow, - timestamp => $tomorrow, + published_on => $tomorrow, lang => '', branchcode => undef, number => 3, @@ -189,7 +189,7 @@ subtest '->search_for_display' => sub { class => 'Koha::News', value => { expirationdate => $tomorrow, - timestamp => $today, + published_on => $today, lang => 'slip', branchcode => $library1->branchcode, number => 4, @@ -199,7 +199,7 @@ subtest '->search_for_display' => sub { class => 'Koha::News', value => { expirationdate => $tomorrow, - timestamp => $today, + published_on => $today, lang => 'koha', branchcode => $library2->branchcode, number => 5, @@ -209,7 +209,7 @@ subtest '->search_for_display' => sub { class => 'Koha::News', value => { expirationdate => $tomorrow, - timestamp => $today, + published_on => $today, lang => 'koha', branchcode => undef, number => 5, diff --git a/tools/koha-news.pl b/tools/koha-news.pl index 46c6574cdb..65f560a5dd 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -112,7 +112,7 @@ elsif ( $op eq 'add' ) { content => $content, lang => $lang, expirationdate => $expirationdate, - timestamp => $timestamp, + published_on => $published_on, number => $number, branchcode => $branchcode, borrowernumber => $borrowernumber, @@ -150,7 +150,7 @@ else { my $opac_news = Koha::News->search( $params, { - order_by => { -desc => 'timestamp' }, + order_by => { -desc => 'published_on' }, } ); $template->param( opac_news => $opac_news ); -- 2.39.5