use Modern::Perl;
return {
bug_number => "29778",
description => "Delete orphan additional contents",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
$dbh->do(q{
DELETE FROM additional_contents
WHERE code NOT IN (
SELECT code
FROM additional_contents
WHERE lang = "default"
);
});
},
}
my $contents =
Koha::AdditionalContents->search( { idnew => \@ids } );
if ( C4::Context->preference("NewsLog") ) {
while ( my $c = $contents->next ) {
Koha::AdditionalContents->search( { code => $c->code } )->delete;
logaction('NEWS', 'DELETE' , undef, sprintf("%s|%s|%s|%s", $c->code, $c->title, $c->lang, $c->content));
$contents->delete;
};
-