From 67a645ce8de654ab8f0b4b0dfd7b91040a85716f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 1 Dec 2021 13:42:49 +0100 Subject: [PATCH] =?utf8?q?Auftrags-Controller:=20Email/DMS=20falls=20kein?= =?utf8?q?=20Dokument=20vorhanden,=20eines=20erstellen,=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit … wenn die Policy sagt, dass der letzte Ausdruck mitgeschickt werden soll --- SL/Controller/Order.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 759de322b..5c14971cb 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -474,9 +474,19 @@ sub action_send_email { $::form->{$_} = $::form->{print_options}->{$_} for keys %{ $::form->{print_options} }; $::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 => $self->order->id, + object_type => $::form->{formname}, + file_type => 'document'); + } + + if ($::form->{attachment_policy} ne 'no_file' && !($::form->{attachment_policy} eq 'old_file' && $attfile)) { my $doc; - my @errors = $self->generate_doc(\$doc, {media => $::form->{media}, + my @errors = $self->generate_pdf(\$doc, {media => $::form->{media}, format => $::form->{print_options}->{format}, formname => $::form->{print_options}->{formname}, language => $self->order->language, -- 2.20.1