X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FForm.pm;h=9c05c335354cf9edcbf106f68d5c1ab2a88339eb;hb=e3dfdb7a78f6e0bc8ac1075fedc36f8247c6fd92;hp=29d9d6c137c4bb5568985718693141bbfd0eab5c;hpb=2644d2a93d051b4040354c87c0410ebf494a15df;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 29d9d6c13..9c05c3353 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -857,6 +857,9 @@ sub parse_template { # therefore copy to webdav, even if we do not have the webdav feature enabled (just archive) my $copy_to_webdav = $::instance_conf->get_webdav_documents && !$self->{preview} && $self->{tmpdir} && $self->{tmpfile} && $self->{type} && $self->{type} ne 'statement'; + + $self->{attachment_filename} ||= $self->generate_attachment_filename; + if ( $ext_for_format eq 'pdf' && $self->doc_storage_enabled ) { $self->append_general_pdf_attachments(filepath => $self->{tmpdir}."/".$self->{tmpfile}, type => $self->{type}); @@ -873,7 +876,6 @@ sub parse_template { if (!$self->{preview} && $self->{attachment_type} !~ m{^dunning} && $self->doc_storage_enabled) { - $self->{attachment_filename} ||= $self->generate_attachment_filename; $self->store_pdf($self); } $self->cleanup; @@ -892,7 +894,6 @@ sub parse_template { } if ( !$self->{preview} && $ext_for_format eq 'pdf' && $self->{attachment_type} !~ m{^dunning} && $self->doc_storage_enabled) { - $self->{attachment_filename} ||= $self->generate_attachment_filename; my $file_obj = $self->store_pdf($self); $self->{print_file_id} = $file_obj->id if $file_obj; } @@ -951,17 +952,15 @@ sub send_email { $mail->{to} = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email}; $mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|; $mail->{fileid} = time() . '.' . $$ . '.'; + $mail->{content_type} = "text/html"; my $full_signature = $self->create_email_signature(); - $full_signature =~ s/\r//g; $mail->{attachments} = []; my @attfiles; # if we send html or plain text inline if (($self->{format} eq 'html') && ($self->{sendmode} eq 'inline')) { - $mail->{content_type} = "text/html"; $mail->{message} =~ s/\r//g; $mail->{message} =~ s{\n}{
\n}g; - $full_signature =~ s{\n}{
\n}g; $mail->{message} .= $full_signature; open(IN, "<", $self->{tmpfile}) @@ -974,9 +973,10 @@ sub send_email { $attachment_name =~ s{\.(.+?)$}{.${ext_for_format}} if ($ext_for_format); if (($self->{attachment_policy} // '') eq 'old_file') { - my ( $attfile ) = SL::File->get_all(object_id => $self->{id}, - object_type => $self->{formname}, - file_type => 'document'); + my ( $attfile ) = SL::File->get_all(object_id => $self->{id}, + object_type => $self->{type}, + file_type => 'document', + print_variant => $self->{formname},); if ($attfile) { $attfile->{override_file_name} = $attachment_name if $attachment_name; @@ -1232,10 +1232,12 @@ sub generate_email_body { return undef unless $body; + $body .= GenericTranslations->get(translation_type => "salutation_punctuation_mark", language_id => $self->{language_id}); + $body = '

' . $::locale->quote_special_chars('HTML', $body) . '

'; + my $translation_type = $params{translation_type} // "preset_text_$self->{formname}"; my $main_body = GenericTranslations->get(translation_type => $translation_type, language_id => $self->{language_id}); $main_body = GenericTranslations->get(translation_type => $params{fallback_translation_type}, language_id => $self->{language_id}) if !$main_body && $params{fallback_translation_type}; - $body .= GenericTranslations->get(translation_type => "salutation_punctuation_mark", language_id => $self->{language_id}) . "\n\n"; $body .= $main_body; $body = $main::locale->unquote_special_chars('HTML', $body); @@ -3438,19 +3440,11 @@ sub reformat_numbers { } sub create_email_signature { - my $client_signature = $::instance_conf->get_signature; my $user_signature = $::myconfig{signature}; - my $signature = ''; - if ( $client_signature or $user_signature ) { - $signature = "\n\n-- \n"; - $signature .= $user_signature . "\n" if $user_signature; - $signature .= $client_signature . "\n" if $client_signature; - }; - return $signature; - -}; + return join '', grep { $_ } ($user_signature, $client_signature); +} sub calculate_tax { # this function calculates the net amount and tax for the lines in ar, ap and