]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Form.pm
Letztes Datenkbankupgradescript für Datenbankversionen 2.2.0.x sowie neues Schema...
[mfinanz.git] / SL / Form.pm
index 2a04e15797c0ad4ebfbf5a1a48b329a6f04f4507..5abc672c040dba3b87482ad706cc2e2bb3910683 100644 (file)
@@ -146,7 +146,7 @@ sub new {
   $self->{action} = lc $self->{action};
   $self->{action} =~ s/( |-|,|\#)/_/g;
 
-  $self->{version}   = "2.3.9";
+  $self->{version}   = "2.4-RC2";
 
   $main::lxdebug->leave_sub();
 
@@ -664,7 +664,7 @@ sub format_amount {
   $amount = $self->round_amount($amount, $places) if ($places =~ /\d/);
 
   my @d = map { s/\d//g; reverse split // } my $tmp = $myconfig->{numberformat}; # get delim chars
-  my @p = split /\./, $amount ; # split amount at decimal point
+  my @p = split(/\./, $amount); # split amount at decimal point
 
   $p[0] =~ s/\B(?=(...)*$)/$d[1]/g if $d[1]; # add 1,000 delimiters
 
@@ -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}";
@@ -1656,7 +1669,7 @@ sub create_links {
     $self->{accounts} = "";
     while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
   
-      foreach my $key (split /:/, $ref->{link}) {
+      foreach my $key (split(/:/, $ref->{link})) {
         if ($key =~ /$module/) {
   
           # cross reference for keys
@@ -1755,7 +1768,7 @@ sub create_links {
     $self->{accounts} = "";
     while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
   
-      foreach my $key (split /:/, $ref->{link}) {
+      foreach my $key (split(/:/, $ref->{link})) {
         if ($key =~ /$module/) {
   
           # cross reference for keys
@@ -1844,7 +1857,7 @@ sub create_links {
     if ($self->{"$self->{vc}_id"}) {
 
       # only setup currency
-      ($self->{currency}) = split /:/, $self->{currencies};
+      ($self->{currency}) = split(/:/, $self->{currencies});
 
     } else {