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

(-)a/installer/data/mysql/atomicupdate/bug_29778.pl (+18 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "29778",
5
    description => "Delete orphan additional contents",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        $dbh->do(q{
10
            DELETE FROM additional_contents
11
            WHERE code NOT IN (
12
                SELECT code
13
                FROM additional_contents
14
                WHERE lang = "default"
15
            );
16
        });
17
    },
18
}
(-)a/tools/additional-contents.pl (-4 / +3 lines)
Lines 204-215 elsif ( $op eq 'delete_confirmed' ) { Link Here
204
                my $contents =
204
                my $contents =
205
                  Koha::AdditionalContents->search( { idnew => \@ids } );
205
                  Koha::AdditionalContents->search( { idnew => \@ids } );
206
206
207
                if ( C4::Context->preference("NewsLog") ) {
207
                while ( my $c = $contents->next ) {
208
                    while ( my $c = $contents->next ) {
208
                    Koha::AdditionalContents->search( { code => $c->code } )->delete;
209
                    if ( C4::Context->preference("NewsLog") ) {
209
                        logaction('NEWS', 'DELETE' , undef, sprintf("%s|%s|%s|%s", $c->code, $c->title, $c->lang, $c->content));
210
                        logaction('NEWS', 'DELETE' , undef, sprintf("%s|%s|%s|%s", $c->code, $c->title, $c->lang, $c->content));
210
                    }
211
                    }
211
                }
212
                }
212
                $contents->delete;
213
            }
213
            }
214
        );
214
        );
215
    };
215
    };
216
- 

Return to bug 29778