From: Bernd Bleßmann Date: Mon, 6 Dec 2021 13:55:21 +0000 (+0100) Subject: DMS attachment_policy, falls kein Dokument vorhanden, erste Version erstellen X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~264 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1efa86b1825e32da0644fd3812060dafab3efa8e;p=kivitendo-erp.git DMS attachment_policy, falls kein Dokument vorhanden, erste Version erstellen angepasster commit von Jan --- diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index eedde3f88..7fc87e7c4 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -2156,7 +2156,17 @@ sub send_sales_purchase_email { $::form->{media} = 'email'; - if (($::form->{attachment_policy} // '') =~ m{^(?:old_file|no_file)$}) { + $::form->{attachment_policy} //= ''; + + # Is an old file version available? + my $attfile; + if ($::form->{attachment_policy} eq 'old_file') { + $attfile = SL::File->get_all(object_id => $id, + object_type => $::form->{formname}, + file_type => 'document'); + } + + if ($::form->{attachment_policy} eq 'no_file' || ($::form->{attachment_policy} eq 'old_file' && $attfile)) { $::form->send_email(\%::myconfig, 'pdf'); } else {