} or die $main::locale->text('No email for user with login #1 defined.', $ref->{invoice_employee_login});
}
+ my $html_template = SL::Template::create(type => 'HTML', form => $form, myconfig => $myconfig);
+ $html_template->set_tag_style('<%', '%>');
+
my $template = SL::Template::create(type => 'PlainText', form => $form, myconfig => $myconfig);
my $mail = Mailer->new();
$mail->{bcc} = $form->get_bcc_defaults($myconfig, $form->{bcc});
$mail->{from} = $from;
$mail->{to} = $ref->{recipient};
$mail->{subject} = $template->parse_block($ref->{email_subject});
- $mail->{message} = $template->parse_block($ref->{email_body});
+ $mail->{message} = $html_template->parse_block($ref->{email_body});
+ $mail->{content_type} = 'text/html';
my $sign_backup = $::myconfig{signature};
$::myconfig{signature} = $sign if $sign;
$mail->{message} .= $form->create_email_signature();
common part_selection
), "jquery/ui/i18n/jquery.ui.datepicker-$::myconfig{countrycode}");
+ $layout->use_javascript("$_.js") for @{ $params{use_javascripts} // [] };
+
$self->{favicon} ||= "favicon.ico";
$self->{titlebar} = join ' - ', grep $_, $self->{title}, $self->{login}, $::myconfig{dbname}, $self->read_version if $self->{title} || !$self->{titlebar};
$main::auth->assert('dunning_edit');
$form->{"title"} = $locale->text("Set eMail text");
- $form->header(no_layout => 1);
+ $form->header(
+ no_layout => 1,
+ use_javascripts => [ qw(ckeditor/ckeditor ckeditor/adapters/jquery) ],
+ );
print($form->parse_html_template("dunning/set_email"));
$main::lxdebug->leave_sub();
--- /dev/null
+# @tag: convert_columns_to_html_for_sending_html_emails2
+# @description: Versand von E-Mails in HTML: weitere Text-Spalten nach HTML umwandeln
+# @depends: convert_columns_to_html_for_sending_html_emails
+package SL::DBUpgrade2::convert_columns_to_html_for_sending_html_emails2;
+
+use strict;
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+
+use SL::HTML::Util;
+
+sub convert_column {
+ my ($self, $table, $id_column, $column_to_convert, $condition) = @_;
+
+ $condition = $condition ? "WHERE $condition" : "";
+
+ my $q_fetch = <<SQL;
+ SELECT ${id_column}, ${column_to_convert}
+ FROM ${table}
+ ${condition}
+SQL
+
+ my $q_update = <<SQL;
+ UPDATE ${table}
+ SET ${column_to_convert} = ?
+ WHERE ${id_column} = ?
+SQL
+
+ my $h_fetch = $self->dbh->prepare($q_fetch);
+ $h_fetch->execute || $::form->dberror($q_fetch);
+
+ my $h_update = $self->dbh->prepare($q_update);
+
+ while (my $entry = $h_fetch->fetchrow_hashref) {
+ $entry->{$column_to_convert} //= '';
+ my $new_value = SL::HTML::Util->plain_text_to_html($entry->{$column_to_convert});
+
+ next if $entry->{$column_to_convert} eq $new_value;
+
+ $h_update->execute($new_value, $entry->{id}) || $::form->dberror($q_update);
+ }
+}
+
+sub run {
+ my ($self) = @_;
+
+ $self->convert_column('dunning_config', 'id', 'email_body');
+
+ return 1;
+}
+
+1;
[%- USE T8 %]
-[%- USE HTML %]
+[%- USE HTML %][%- USE L -%]
<h1>[% title %]</h1>
<script type="text/javascript">
<!--
function email_updated() {
window.opener.document.getElementsByName(document.Form.input_subject.value)[0].value = document.getElementsByName("email_subject")[0].value;
- window.opener.document.getElementsByName(document.Form.input_body.value)[0].value = document.getElementsByName("email_body")[0].value;
- window.opener.document.getElementsByName(document.Form.input_attachment.value)[0].value = document.getElementsByName("email_attachment")[0].value; self.close();
+ window.opener.document.getElementsByName(document.Form.input_body.value)[0].value = $("#email_body").val();
+ window.opener.document.getElementsByName(document.Form.input_attachment.value)[0].value = document.getElementsByName("email_attachment")[0].value;
+ self.close();
}
-->
</script>
<tr>
<td valign="top">[% 'Body:' | $T8 %]</td>
- <td valign="top"><textarea id="email_body" name="email_body" rows="20" cols="70" wrap="soft">[% HTML.escape(email_body) %]</textarea></td>
+ <td valign="top">[% L.textarea_tag('email_body', email_body, rows=20, cols=70, class='texteditor') %]</td>
</tr>
<tr>