From 5866c88d840709bdae2b6ef7e573b6fa2890141d Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Tue, 19 Mar 2019 10:23:40 +0000 Subject: [PATCH] Bug 22544: Move del_opac_new to Koha namespace Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- C4/NewsChannels.pm | 24 +----------------------- tools/koha-news.pl | 2 +- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm index 0917a67ae4..2126b40184 100644 --- a/C4/NewsChannels.pm +++ b/C4/NewsChannels.pm @@ -30,7 +30,7 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw( &GetNewsToDisplay - &add_opac_new &upd_opac_new &del_opac_new + &add_opac_new &upd_opac_new ); } @@ -123,28 +123,6 @@ sub upd_opac_new { return $retval; } -sub del_opac_new { - my ($ids) = @_; - if ($ids) { - - #Log news deletion - if (C4::Context->preference("NewsLog")) { - foreach my $newsid ( split(/,/, $ids )) { - my $n = Koha::News->find( $newsid ); - logaction('NEWS', 'DELETE', undef, $n->unblessed->{lang} . ' | ' . $n->unblessed->{content} ); - } - } - - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("DELETE FROM opac_news WHERE idnew IN ($ids)"); - $sth->execute(); - return 1; - } else { - return 0; - } - -} - =head2 GetNewsToDisplay $news = &GetNewsToDisplay($lang,$branch); diff --git a/tools/koha-news.pl b/tools/koha-news.pl index e8d72f1c48..ab6c89c5d4 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -143,7 +143,7 @@ elsif ( $op eq 'edit' ) { } elsif ( $op eq 'del' ) { my @ids = $cgi->multi_param('ids'); - del_opac_new( join ",", @ids ); + Koha::News->search({ idnew => @ids })->delete; print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl"); } -- 2.39.5