From c86c1dd7f2c549105863dbb04f2380d24823c102 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 --- 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 151e6591c8..e901a57ec7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -25,7 +25,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 f0dc2d05d9..59277674d3 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 @@ -149,7 +149,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]

[% 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 1184f38798..1ddb186e78 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -113,7 +113,7 @@ elsif ( $op eq 'add' ) { content => $content, lang => $lang, expirationdate => $expirationdate, - timestamp => $timestamp, + published_on => $published_on, number => $number, branchcode => $branchcode, borrowernumber => $borrowernumber, @@ -151,7 +151,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.20.1