1 # @tag: convert_columns_to_html_for_sending_html_emails2
2 # @description: Versand von E-Mails in HTML: weitere Text-Spalten nach HTML umwandeln
3 # @depends: convert_columns_to_html_for_sending_html_emails
4 package SL::DBUpgrade2::convert_columns_to_html_for_sending_html_emails2;
9 use parent qw(SL::DBUpgrade2::Base);
14 my ($self, $table, $id_column, $column_to_convert, $condition) = @_;
16 $condition = $condition ? "WHERE $condition" : "";
19 SELECT ${id_column}, ${column_to_convert}
26 SET ${column_to_convert} = ?
27 WHERE ${id_column} = ?
30 my $h_fetch = $self->dbh->prepare($q_fetch);
31 $h_fetch->execute || $::form->dberror($q_fetch);
33 my $h_update = $self->dbh->prepare($q_update);
35 while (my $entry = $h_fetch->fetchrow_hashref) {
36 $entry->{$column_to_convert} //= '';
37 my $new_value = SL::HTML::Util->plain_text_to_html($entry->{$column_to_convert});
39 next if $entry->{$column_to_convert} eq $new_value;
41 $h_update->execute($new_value, $entry->{id}) || $::form->dberror($q_update);
48 $self->convert_column('dunning_config', 'id', 'email_body');