View | Details | Raw Unified | Return to bug 22544
Collapse All | Expand All

(-)a/C4/NewsChannels.pm (-23 / +1 lines)
Lines 30-36 BEGIN { Link Here
30
    @ISA = qw(Exporter);
30
    @ISA = qw(Exporter);
31
    @EXPORT = qw(
31
    @EXPORT = qw(
32
        &GetNewsToDisplay
32
        &GetNewsToDisplay
33
        &add_opac_new &upd_opac_new &del_opac_new
33
        &add_opac_new &upd_opac_new
34
    );
34
    );
35
}
35
}
36
36
Lines 123-150 sub upd_opac_new { Link Here
123
    return $retval;
123
    return $retval;
124
}
124
}
125
125
126
sub del_opac_new {
127
    my ($ids) = @_;
128
    if ($ids) {
129
130
        #Log news deletion
131
        if (C4::Context->preference("NewsLog")) {
132
            foreach my $newsid ( split(/,/, $ids )) {
133
                my $n = Koha::News->find( $newsid );
134
                logaction('NEWS', 'DELETE', undef, $n->unblessed->{lang} . ' | ' . $n->unblessed->{content} );
135
            }
136
        }
137
138
        my $dbh = C4::Context->dbh;
139
        my $sth = $dbh->prepare("DELETE FROM opac_news WHERE idnew IN ($ids)");
140
        $sth->execute();
141
        return 1;
142
    } else {
143
        return 0;
144
    }
145
146
}
147
148
=head2 GetNewsToDisplay
126
=head2 GetNewsToDisplay
149
127
150
    $news = &GetNewsToDisplay($lang,$branch);
128
    $news = &GetNewsToDisplay($lang,$branch);
(-)a/tools/koha-news.pl (-2 / +1 lines)
Lines 143-149 elsif ( $op eq 'edit' ) { Link Here
143
}
143
}
144
elsif ( $op eq 'del' ) {
144
elsif ( $op eq 'del' ) {
145
    my @ids = $cgi->multi_param('ids');
145
    my @ids = $cgi->multi_param('ids');
146
    del_opac_new( join ",", @ids );
146
    Koha::News->search({ idnew => @ids })->delete;
147
    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
147
    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
148
}
148
}
149
149
150
- 

Return to bug 22544