Browse Source

Bug 22544: Update to current codebase

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
master
Josef Moravec 12 months ago
committed by Jonathan Druart
parent
commit
15573ab950
  1. 9
      Koha/News.pm
  2. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
  3. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
  4. 12
      t/db_dependent/Koha/News.t
  5. 4
      tools/koha-news.pl

9
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 ];

2
koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt

@ -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>

2
koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt

@ -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>

12
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,

4
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 );

Loading…
Cancel
Save