From: Udo Spallek Date: Fri, 15 Dec 2006 02:46:53 +0000 (+0000) Subject: Mehrere neue Outputtypen für die parsing engine eingebaut: X-Git-Tag: release-2.4.0^2~18 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9f055edb25f912aa2cb3dfd8e8a4cf20703f75a2;p=kivitendo-erp.git Mehrere neue Outputtypen für die parsing engine eingebaut: xml, elsterwinston, elstertaxbird und die Funktion zusaetzlich abgesichert gegen fehlende oder falsche Outputformate. Ferner wird das $form->{tempfile} nur noch ueberschrieben, wenn es vorher leer war. Definiert man also vor dem Aufruf von parse_template die Variable $form->{tempfile}, dann kann man damit den Ausgabedateinamen festlegen. --- 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}";