From 0631649c2c4115f5820829f866af7e2bc2c6623f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 6 Dec 2021 12:28:33 +0100 Subject: [PATCH] =?utf8?q?Files:=20Druckvariante=20beim=20Drucken=20speich?= =?utf8?q?ern=20und=20bei=20E-Mail=20darauf=20pr=C3=BCfen,=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit … um festzustellen, welcher letzte Belegausdruck für die Variante relrevant ist. --- SL/File.pm | 10 ++++++---- SL/Form.pm | 7 ++++--- SL/Helper/File.pm | 15 ++++++++------- bin/mozilla/io.pl | 7 ++++--- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/SL/File.pm b/SL/File.pm index e232908e6..afc0cee1a 100644 --- a/SL/File.pm +++ b/SL/File.pm @@ -48,10 +48,11 @@ sub get_all { object_id => $params{object_id}, object_type => $params{object_type} ); - push @query, (file_name => $params{file_name}) if $params{file_name}; - push @query, (file_type => $params{file_type}) if $params{file_type}; - push @query, (mime_type => $params{mime_type}) if $params{mime_type}; - push @query, (source => $params{source}) if $params{source}; + push @query, (file_name => $params{file_name}) if $params{file_name}; + push @query, (file_type => $params{file_type}) if $params{file_type}; + push @query, (mime_type => $params{mime_type}) if $params{mime_type}; + push @query, (source => $params{source}) if $params{source}; + push @query, (print_variant => $params{print_variant}) if $params{print_variant}; my $sortby = $params{sort_by} || 'itime DESC,file_name ASC'; @@ -218,6 +219,7 @@ sub _save { mime_type => $params{mime_type}, title => $params{title}, description => $params{description}, + print_variant => $params{print_variant}, ); $file->itime($params{mtime}) if $params{mtime}; $params{itime} = $params{mtime} if $params{mtime}; diff --git a/SL/Form.pm b/SL/Form.pm index e8a3c0eab..229ad2c4d 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -975,9 +975,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; diff --git a/SL/Helper/File.pm b/SL/Helper/File.pm index 96901184b..e658b05e9 100644 --- a/SL/Helper/File.pm +++ b/SL/Helper/File.pm @@ -25,13 +25,14 @@ sub store_pdf { return if !$id || !$type; SL::File->save( - object_id => $id, - object_type => $type, - mime_type => 'application/pdf', - source => 'created', - file_type => 'document', - file_name => $form->{attachment_filename}, - file_path => $form->{tmpfile}, + object_id => $id, + object_type => $type, + mime_type => 'application/pdf', + source => 'created', + file_type => 'document', + file_name => $form->{attachment_filename}, + file_path => $form->{tmpfile}, + print_variant => $form->{formname}, ); } diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 7fc87e7c4..9628ddffd 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -2161,9 +2161,10 @@ sub send_sales_purchase_email { # 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'); + $attfile = SL::File->get_all(object_id => $id, + object_type => $type, + file_type => 'document', + print_variant => $::form->{formname},); } if ($::form->{attachment_policy} eq 'no_file' || ($::form->{attachment_policy} eq 'old_file' && $attfile)) { -- 2.20.1