From a6873ed48ebdaee1f5b1df63d431ccc54e829d7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 3 Dec 2021 14:29:42 +0100 Subject: [PATCH] =?utf8?q?copy=5Ffile=5Fto=5Fwebdav=5Ffolder:=20=C3=9Cberg?= =?utf8?q?ebenen=20Anhang-Name=20ber=C3=BCcksichtigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Common.pm | 4 +++- SL/Form.pm | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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; } -- 2.20.1