Bug 32070: Consistent classes for primary buttons: Acquisitions
[koha-ffzg.git] / opac / opac-news-rss.pl
index f8c2b0e..60d700e 100755 (executable)
 
 use Modern::Perl;
 use CGI;
-use C4::Auth;    # get_template_and_user
-use C4::Output;
-use C4::NewsChannels;    # GetNewsToDisplay
-use C4::Languages qw(getTranslatedLanguages accept_language);
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
+use Koha::AdditionalContents;
 
 my $input = CGI->new;
 my $dbh   = C4::Context->dbh;
@@ -43,12 +42,15 @@ my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Con
 
 my $branchcode = $input->param('branchcode');
 
-my $all_koha_news   = GetNewsToDisplay( $news_lang, $branchcode );
-my $koha_news_count = scalar @$all_koha_news;
-
-$template->param(
-    koha_news           => $all_koha_news,
-    koha_news_count     => $koha_news_count,
+my $koha_news = Koha::AdditionalContents->search_for_display(
+    {
+        category   => 'news',
+        location   => ['opac_only', 'staff_and_opac'],
+        lang       => $news_lang,
+        library_id => $branchcode,
+    }
 );
 
+$template->param( koha_news => $koha_news );
+
 output_html_with_http_headers $input, $cookie, $template->output;