From 29e9236775c2c7c16e2ed8dcaacae2d5784c3071 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 --- C4/NewsChannels.pm | 14 +------------- tools/koha-news.pl | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm index 61ebed99b5..77e041a645 100644 --- a/C4/NewsChannels.pm +++ b/C4/NewsChannels.pm @@ -28,7 +28,7 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw( &GetNewsToDisplay - &add_opac_new &upd_opac_new &del_opac_new + &add_opac_new &upd_opac_new ); } @@ -109,18 +109,6 @@ sub upd_opac_new { return $retval; } -sub del_opac_new { - my ($ids) = @_; - if ($ids) { - 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 1de32e93dc..cf580a2233 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -139,7 +139,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.17.1