1129 |
1129 |
$self->{"cwd"} = getcwd();
|
1130 |
1130 |
$self->{"tmpdir"} = $self->{cwd} . "/${userspath}";
|
1131 |
1131 |
|
|
1132 |
my $ext_for_format;
|
|
1133 |
|
1132 |
1134 |
if ($self->{"format"} =~ /(opendocument|oasis)/i) {
|
1133 |
|
$template = OpenDocumentTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1135 |
$template = OpenDocumentTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1136 |
$ext_for_format = 'odt';
|
|
1137 |
|
1134 |
1138 |
} elsif ($self->{"format"} =~ /(postscript|pdf)/i) {
|
1135 |
1139 |
$ENV{"TEXINPUTS"} = ".:" . getcwd() . "/" . $myconfig->{"templates"} . ":" . $ENV{"TEXINPUTS"};
|
1136 |
|
$template = LaTeXTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
1137 |
|
} elsif (($self->{"format"} =~ /html/i) ||
|
1138 |
|
(!$self->{"format"} && ($self->{"IN"} =~ /html$/i))) {
|
1139 |
|
$template = HTMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
1140 |
|
} elsif (($self->{"format"} =~ /xml/i) ||
|
1141 |
|
(!$self->{"format"} && ($self->{"IN"} =~ /xml$/i))) {
|
1142 |
|
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1140 |
$template = LaTeXTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1141 |
$ext_for_format = 'pdf';
|
|
1142 |
|
|
1143 |
} elsif (($self->{"format"} =~ /html/i) || (!$self->{"format"} && ($self->{"IN"} =~ /html$/i))) {
|
|
1144 |
$template = HTMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1145 |
$ext_for_format = 'html';
|
|
1146 |
|
|
1147 |
} elsif (($self->{"format"} =~ /xml/i) || (!$self->{"format"} && ($self->{"IN"} =~ /xml$/i))) {
|
|
1148 |
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1149 |
$ext_for_format = 'xml';
|
|
1150 |
|
1143 |
1151 |
} elsif ( $self->{"format"} =~ /elsterwinston/i ) {
|
1144 |
1152 |
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1153 |
|
1145 |
1154 |
} elsif ( $self->{"format"} =~ /elstertaxbird/i ) {
|
1146 |
1155 |
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1156 |
|
1147 |
1157 |
} elsif ( defined $self->{'format'}) {
|
1148 |
1158 |
$self->error("Outputformat not defined. This may be a future feature: $self->{'format'}");
|
|
1159 |
|
1149 |
1160 |
} elsif ( $self->{'format'} eq '' ) {
|
1150 |
1161 |
$self->error("No Outputformat given: $self->{'format'}");
|
|
1162 |
|
1151 |
1163 |
} else { #Catch the rest
|
1152 |
1164 |
$self->error("Outputformat not defined: $self->{'format'}");
|
1153 |
1165 |
}
|
... | ... | |
1232 |
1244 |
} else {
|
1233 |
1245 |
|
1234 |
1246 |
if (!$self->{"do_not_attach"}) {
|
1235 |
|
$mail->{attachments} = [{ "filename" => $self->{"tmpfile"},
|
1236 |
|
"name" => $self->{"attachment_filename"} ? $self->{"attachment_filename"} : $self->{"tmpfile"} }];
|
|
1247 |
my $attachment_name = $self->{attachment_filename} || $self->{tmpfile};
|
|
1248 |
$attachment_name =~ s/\.(.+?)$/.${ext_for_format}/ if ($ext_for_format);
|
|
1249 |
$mail->{attachments} = [{ "filename" => $self->{tmpfile},
|
|
1250 |
"name" => $attachment_name }];
|
1237 |
1251 |
}
|
1238 |
1252 |
|
1239 |
1253 |
$mail->{message} =~ s/\r//g;
|
Beim Verschicken von Dokumenten per EMail die MIME-Header richtig setzen:
1. MIME-Header anhand des Dateinamens setzen; weniger anhand von $form->{format}, weil das nicht immer gesetzt ist und nicht immer zu einem richtigen MIME-Typ führt (so ist "format" z.B. "opendocument", und der MIME-Typ lautet aber "vnd.oasis.opendocument.text").
2. Die Dateinamenserweiterung von Dateianhängen beim Drucken/Mailen in $form anhand von $form->{format} anpassen, damit nicht ".pdf" dranhängt, wenn OpenDocument drin ist.
Fix für Bug 912.