Skip to content

Commit

Permalink
Bug 22544: Update to current codebase
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Renvoize <[email protected]>

Signed-off-by: Marcel de Rooy <[email protected]>

Signed-off-by: Jonathan Druart <[email protected]>
  • Loading branch information
xmorave2 authored and joubu committed Jul 6, 2021
1 parent ac70d7c commit 15573ab
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
9 changes: 7 additions & 2 deletions Koha/News.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ];

Expand Down
2 changes: 1 addition & 1 deletion koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
[% FOREACH koha_new IN koha_news %]
<div class="newsitem" id="news[% koha_new.idnew | html %]"><h4>[% koha_new.title | html %]</h4>
<div class="newsbody">[% koha_new.content | $raw %]</div>
<p class="newsfooter"> Posted on [% koha_new.timestamp | $KohaDates %][% IF( show_author && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author.title | html %] </span>[% koha_new.author.firstname | html %] [% koha_new.author.surname | html %]<br />[% END %]
<p class="newsfooter"> Posted on [% koha_new.published_on | $KohaDates %][% IF( show_author && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author.title | html %] </span>[% koha_new.author.firstname | html %] [% koha_new.author.surname | html %]<br />[% END %]
[% IF ( CAN_user_tools ) %]
<a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% koha_new.idnew | uri %]">Edit</a>
| <a class="news_delete" href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% koha_new.idnew | html %]">Delete</a>
Expand Down
2 changes: 1 addition & 1 deletion koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
[% ELSE %][% opac_new.library.branchname | html %]
[% END %]</td>
<td>[% opac_new.number | html %]</td>
<td data-order="[% opac_new.timestamp | html %]">[% opac_new.timestamp | $KohaDates %]</td>
<td data-order="[% opac_new.published_on | html %]">[% opac_new.published_on | $KohaDates %]</td>
<td data-order="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.is_expired ) %](<span class="expired">expired</span>)[% END %]</td>
<td>[% opac_new.title | html %]</td>
<td>[% IF ( opac_new.author) %][% INCLUDE 'patron-title.inc' patron=opac_new.author hide_patron_infos_if_needed=1 %][% END %]</td>
Expand Down
12 changes: 6 additions & 6 deletions t/db_dependent/Koha/News.t
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tools/koha-news.pl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
content => $content,
lang => $lang,
expirationdate => $expirationdate,
timestamp => $timestamp,
published_on => $published_on,
number => $number,
branchcode => $branchcode,
borrowernumber => $borrowernumber,
Expand Down Expand Up @@ -150,7 +150,7 @@
my $opac_news = Koha::News->search(
$params,
{
order_by => { -desc => 'timestamp' },
order_by => { -desc => 'published_on' },
}
);
$template->param( opac_news => $opac_news );
Expand Down

0 comments on commit 15573ab

Please sign in to comment.