X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=SL%2FBackgroundJob%2FCreatePeriodicInvoices.pm;fp=SL%2FBackgroundJob%2FCreatePeriodicInvoices.pm;h=4e32063176f886920f6dbfe71faa43022abf0a99;hp=6151ec158581d46c8bc6fe8e0221063a6b1a91bb;hb=b293ff8ad52fc76ba0c44783e3982418114d6b08;hpb=d4925a8b60f04674885e30d9316dc0263f8b9a84 diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index 6151ec158..4e3206317 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -143,8 +143,10 @@ sub _replace_vars { my $sub_fmt = lc($params{attribute_format} // 'text'); my ($start_tag, $end_tag) = $sub_fmt eq 'html' ? ('<%', '%>') : ('<%', '%>'); + my @invoice_keys = $params{invoice} ? (map { $_->name } $params{invoice}->meta->columns) : (); + my $key_name_re = join '|', map { quotemeta } (@invoice_keys, keys %{ $params{vars} }); - $str =~ s{ ${start_tag} ([a-z0-9_]+) ( \s+ format \s*=\s* (.*?) \s* )? ${end_tag} }{ + $str =~ s{ ${start_tag} ($key_name_re) ( \s+ format \s*=\s* (.*?) \s* )? ${end_tag} }{ my ($key, $format) = ($1, $3); $key = $::locale->unquote_special_chars('html', $key) if $sub_fmt eq 'html'; my $new_value; @@ -449,6 +451,7 @@ sub _email_invoice { longdescription => 'html', partnotes => 'html', notes => 'html', + $::form->get_variable_content_types_for_cvars, }, ); @@ -470,7 +473,7 @@ sub _email_invoice { invoice => $data->{invoice}, vars => $data->{time_period_vars}, attribute => $_, - attribute_format => 'text' + attribute_format => ($_ eq 'email_body' ? 'html' : 'text') ); } @@ -486,6 +489,8 @@ sub _email_invoice { $mail->{bcc} = $global_bcc; $mail->{subject} = $data->{config}->email_subject; $mail->{message} = $data->{config}->email_body; + $mail->{message} .= SL::DB::Default->get->signature; + $mail->{content_type} = 'text/html'; $mail->{attachments} = [{ path => $pdf_file_name, name => sprintf('%s %s.pdf', $label, $data->{invoice}->invnumber),