use Modern::Perl;
use CGI qw ( -utf8 );
-use C4::Auth; # get_template_and_user
-use C4::Output;
-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::Quotes;
use C4::Members;
-use C4::Overdues;
+use C4::Overdues qw( checkoverdues );
use Koha::Checkouts;
use Koha::Holds;
-use Koha::News;
+use Koha::AdditionalContents;
use Koha::Patron::Messages;
my $input = CGI->new;
casAuthentication => $casAuthentication,
);
-my $homebranch;
+my $homebranch = $ENV{OPAC_BRANCH_DEFAULT};
if (C4::Context->userenv) {
$homebranch = C4::Context->userenv->{'branch'};
}
my $koha_news;
if (defined $news_id){
- $koha_news = Koha::News->search({ idnew => $news_id, lang => { '!=', 'koha' } }); # get news that is not staff-only news
+ $koha_news = Koha::AdditionalContents->search({ idnew => $news_id, location => ['opac_only', 'staff_and_opac'] }); # get news that is not staff-only news
if ( $koha_news->count > 0){
$template->param( news_item => $koha_news->next );
} else {
$template->param( single_news_error => 1 );
}
} else {
- $koha_news = Koha::News->search_for_display({
- type => 'opac',
- lang => $template->lang,
+ $koha_news = Koha::AdditionalContents->search_for_display(
+ {
+ category => 'news',
+ location => ['opac_only', 'staff_and_opac'],
+ lang => $template->lang,
library_id => $homebranch,
- });
+ }
+ );
}
# For dashboard