X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-news-rss.pl;h=60d700e3e8a8be22312e5d09fb480fc8bfa615f6;hb=64a29e3b4c6bb94afec56a224259ad822ca5be50;hp=d48fcebc7a81b38c52e051db0820ccd226851226;hpb=5bbc5834d8f05f02b462d89bca2b96c4a78cae83;p=koha-ffzg.git diff --git a/opac/opac-news-rss.pl b/opac/opac-news-rss.pl index d48fcebc7a..60d700e3e8 100755 --- a/opac/opac-news-rss.pl +++ b/opac/opac-news-rss.pl @@ -20,12 +20,11 @@ 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 = new CGI; +my $input = CGI->new; my $dbh = C4::Context->dbh; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( @@ -34,7 +33,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( type => "opac", query => $input, authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), - flagsrequired => { borrow => 1 }, } ); @@ -42,17 +40,17 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( # use cookie setting for language, bug default to syspref if it's not set my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input); -my $homebranch; +my $branchcode = $input->param('branchcode'); -if (C4::Context->userenv) { - $homebranch = C4::Context->userenv->{'branch'}; -} -my $all_koha_news = &GetNewsToDisplay($news_lang,$homebranch); -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;