Revision b3b1b699
Von Moritz Bunkus vor fast 13 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1094 | 1094 |
|
1095 | 1095 |
# OUT is used for the media, screen, printer, email |
1096 | 1096 |
# for postscript we store a copy in a temporary file |
1097 |
my $fileid = time; |
|
1098 |
my $prepend_userspath; |
|
1099 |
|
|
1100 |
if (!$self->{tmpfile}) { |
|
1101 |
$self->{tmpfile} = "${fileid}.$self->{IN}"; |
|
1102 |
$prepend_userspath = 1; |
|
1103 |
} |
|
1104 |
|
|
1105 |
$prepend_userspath = 1 if substr($self->{tmpfile}, 0, length $userspath) eq $userspath; |
|
1106 |
|
|
1107 |
$self->{tmpfile} =~ s|.*/||; |
|
1108 |
$self->{tmpfile} =~ s/[^a-zA-Z0-9\._\ \-]//g; |
|
1109 |
$self->{tmpfile} = "$userspath/$self->{tmpfile}" if $prepend_userspath; |
|
1097 |
my ($temp_fh, $suffix); |
|
1098 |
$suffix = $self->{IN}; |
|
1099 |
$suffix =~ s/.*\.//; |
|
1100 |
($temp_fh, $self->{tmpfile}) = File::Temp::tempfile( |
|
1101 |
'lx-office-printXXXXXX', |
|
1102 |
SUFFIX => '.' . ($suffix || 'tex'), |
|
1103 |
DIR => $userspath, |
|
1104 |
UNLINK => 1, |
|
1105 |
); |
|
1106 |
close $temp_fh; |
|
1110 | 1107 |
|
1111 | 1108 |
if ($template->uses_temp_file() || $self->{media} eq 'email') { |
1112 | 1109 |
$out = $self->{OUT}; |
... | ... | |
1152 | 1149 |
$mail->{charset} = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; |
1153 | 1150 |
$mail->{to} = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email}; |
1154 | 1151 |
$mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|; |
1155 |
$mail->{fileid} = "$fileid.";
|
|
1152 |
$mail->{fileid} = time() . '.' . $$ . '.';
|
|
1156 | 1153 |
$myconfig->{signature} =~ s/\r//g; |
1157 | 1154 |
|
1158 | 1155 |
# if we send html or plain text inline |
bin/mozilla/ustva.pl | ||
---|---|---|
848 | 848 |
#file suffix |
849 | 849 |
$file .= '.xml'; |
850 | 850 |
$file =~ s|.*/||; |
851 |
$form->{tmpfile} = "$::lx_office_conf{paths}{userspath}/$file"; |
|
852 | 851 |
|
853 | 852 |
$form->{attachment_filename} = $file; |
854 | 853 |
|
... | ... | |
894 | 893 |
# Define serveral filenames |
895 | 894 |
$form->{IN} = 'taxbird.txb'; |
896 | 895 |
|
897 |
$form->{attachment_filename} = "USTVA-" . $form->{period} |
|
898 |
. sprintf("%02d", $form->{year} % 100) . ".txb"; |
|
896 |
$form->{attachment_filename} = "USTVA-" . ($form->{period} * 1) . sprintf("%02d", $form->{year} % 100) . ".txb"; |
|
899 | 897 |
|
900 | 898 |
$form->{attachment_filename} =~ s|.*/||; |
901 |
$form->{tmpfile} = "$::lx_office_conf{paths}{userspath}/" . $form->{attachment_filename}; |
|
902 | 899 |
|
903 | 900 |
# TODO: set Output to UTF-8 or system Preference |
904 | 901 |
#$form->{"iconv"} = Text::Iconv->new($myconfig{dbcharset}, "UTF-8"); |
Auch abrufbar als: Unified diff
File::Temp für Erzeugung temporärer Dateinamen nutzen
Fix für Bug 1747.