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';
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};
$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;
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},
);
}
# 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)) {