From 9f055edb25f912aa2cb3dfd8e8a4cf20703f75a2 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Fri, 15 Dec 2006 02:46:53 +0000 Subject: [PATCH] =?utf8?q?Mehrere=20neue=20Outputtypen=20f=C3=BCr=20die=20?= =?utf8?q?parsing=20engine=20eingebaut:=20xml,=20elsterwinston,=20elsterta?= =?utf8?q?xbird=20und=20die=20Funktion=20zusaetzlich=20abgesichert=20gegen?= =?utf8?q?=20fehlende=20oder=20falsche=20Outputformate.=20Ferner=20wird=20?= =?utf8?q?das=20$form->{tempfile}=20nur=20noch=20ueberschrieben,=20wenn=20?= =?utf8?q?es=20vorher=20leer=20war.=20Definiert=20man=20also=20vor=20dem?= =?utf8?q?=20Aufruf=20von=20parse=5Ftemplate=20die=20Variable=20$form->{te?= =?utf8?q?mpfile},=20dann=20kann=20man=20damit=20den=20Ausgabedateinamen?= =?utf8?q?=20festlegen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/SL/Form.pm b/SL/Form.pm index ef05c8591..5abc672c0 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -754,6 +754,19 @@ sub parse_template { } elsif (($self->{"format"} =~ /html/i) || (!$self->{"format"} && ($self->{"IN"} =~ /html$/i))) { $template = HTMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath); + } elsif (($self->{"format"} =~ /xml/i) || + (!$self->{"format"} && ($self->{"IN"} =~ /xml$/i))) { + $template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath); + } elsif ( $self->{"format"} =~ /elsterwinston/i ) { + $template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath); + } elsif ( $self->{"format"} =~ /elstertaxbird/i ) { + $template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath); + } elsif ( defined $self->{'format'}) { + $self->error("Outputformat not defined. This may be a future feature: $self->{'format'}"); + } elsif ( $self->{'format'} eq '' ) { + $self->error("No Outputformat given: $self->{'format'}"); + } else { #Catch the rest + $self->error("Outputformat not defined: $self->{'format'}"); } # Copy the notes from the invoice/sales order etc. back to the variable "notes" because that is where most templates expect it to be. @@ -767,7 +780,7 @@ sub parse_template { # OUT is used for the media, screen, printer, email # for postscript we store a copy in a temporary file my $fileid = time; - $self->{tmpfile} = "$userspath/${fileid}.$self->{IN}"; + $self->{tmpfile} = "$userspath/${fileid}.$self->{IN}" if ( $self->{tmpfile} eq '' ); if ($template->uses_temp_file() || $self->{media} eq 'email') { $out = $self->{OUT}; $self->{OUT} = ">$self->{tmpfile}"; -- 2.20.1