From: Bernd Bleßmann Date: Fri, 3 Dec 2021 13:29:42 +0000 (+0100) Subject: copy_file_to_webdav_folder: Übergebenen Anhang-Name berücksichtigen X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~259 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a6873ed48ebdaee1f5b1df63d431ccc54e829d7d;p=kivitendo-erp.git copy_file_to_webdav_folder: Übergebenen Anhang-Name berücksichtigen --- diff --git a/SL/Common.pm b/SL/Common.pm index a0d54feb6..15f8f7b93 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -593,8 +593,10 @@ sub copy_file_to_webdav_folder { return; } + $form->{attachment_filename} ||= $form->generate_attachment_filename; + my $timestamp = get_current_formatted_time(); - my $new_file = File::Spec->catfile($form->{cwd}, $webdav_folder, $form->generate_attachment_filename()); + my $new_file = File::Spec->catfile($form->{cwd}, $webdav_folder, $form->{attachment_filename}); $new_file =~ s{(.*)\.}{$1$timestamp\.}; if (!File::Copy::copy($current_file, $new_file)) { diff --git a/SL/Form.pm b/SL/Form.pm index 29d9d6c13..e8a3c0eab 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; }