Revision 0fba3edd
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1198 | 1198 |
$main::lxdebug->enter_sub(); |
1199 | 1199 |
|
1200 | 1200 |
my ($self, $myconfig, $userspath) = @_; |
1201 |
my ($template, $out);
|
|
1201 |
my $out;
|
|
1202 | 1202 |
|
1203 | 1203 |
local (*IN, *OUT); |
1204 | 1204 |
|
... | ... | |
1207 | 1207 |
|
1208 | 1208 |
my $ext_for_format; |
1209 | 1209 |
|
1210 |
my $template_type; |
|
1210 | 1211 |
if ($self->{"format"} =~ /(opendocument|oasis)/i) { |
1211 |
$template = OpenDocumentTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1212 |
$template_type = 'OpenDocument';
|
|
1212 | 1213 |
$ext_for_format = $self->{"format"} =~ m/pdf/ ? 'pdf' : 'odt'; |
1213 | 1214 |
|
1214 | 1215 |
} elsif ($self->{"format"} =~ /(postscript|pdf)/i) { |
1215 | 1216 |
$ENV{"TEXINPUTS"} = ".:" . getcwd() . "/" . $myconfig->{"templates"} . ":" . $ENV{"TEXINPUTS"}; |
1216 |
$template = LaTeXTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1217 |
$template_type = 'LaTeX';
|
|
1217 | 1218 |
$ext_for_format = 'pdf'; |
1218 | 1219 |
|
1219 | 1220 |
} elsif (($self->{"format"} =~ /html/i) || (!$self->{"format"} && ($self->{"IN"} =~ /html$/i))) { |
1220 |
$template = HTMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1221 |
$template_type = 'HTML';
|
|
1221 | 1222 |
$ext_for_format = 'html'; |
1222 | 1223 |
|
1223 | 1224 |
} elsif (($self->{"format"} =~ /xml/i) || (!$self->{"format"} && ($self->{"IN"} =~ /xml$/i))) { |
1224 |
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1225 |
$template_type = 'XML';
|
|
1225 | 1226 |
$ext_for_format = 'xml'; |
1226 | 1227 |
|
1227 |
} elsif ( $self->{"format"} =~ /elsterwinston/i ) { |
|
1228 |
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath); |
|
1229 |
|
|
1230 |
} elsif ( $self->{"format"} =~ /elstertaxbird/i ) { |
|
1231 |
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath); |
|
1228 |
} elsif ( $self->{"format"} =~ /elster(?:winston|taxbird)/i ) { |
|
1229 |
$template_type = 'xml'; |
|
1232 | 1230 |
|
1233 | 1231 |
} elsif ( $self->{"format"} =~ /excel/i ) { |
1234 |
$template = ExcelTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
|
|
1232 |
$template_type = 'Excel';
|
|
1235 | 1233 |
$ext_for_format = 'xls'; |
1236 | 1234 |
|
1237 | 1235 |
} elsif ( defined $self->{'format'}) { |
... | ... | |
1244 | 1242 |
$self->error("Outputformat not defined: $self->{'format'}"); |
1245 | 1243 |
} |
1246 | 1244 |
|
1245 |
my $template = SL::Template::create(type => $template_type, |
|
1246 |
file_name => $self->{IN}, |
|
1247 |
form => $self, |
|
1248 |
myconfig => $myconfig, |
|
1249 |
userspath => $userspath); |
|
1250 |
|
|
1247 | 1251 |
# Copy the notes from the invoice/sales order etc. back to the variable "notes" because that is where most templates expect it to be. |
1248 | 1252 |
$self->{"notes"} = $self->{ $self->{"formname"} . "notes" }; |
1249 | 1253 |
|
Auch abrufbar als: Unified diff
SL/Template.pm in eine Datei pro Package aufgeteilt.