X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fustva.pl;h=6466565b0e4e0c16ffba35c87a26c008cc278077;hb=1e0d413084100ccd892e8c5be95703be5d965de7;hp=db6995f89bf6d1a17a697faa5c1c2d6e67996f78;hpb=8d011bee4d01444862f49a083f9e47b2b07f0a9c;p=kivitendo-erp.git
diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl
index db6995f89..6466565b0 100644
--- a/bin/mozilla/ustva.pl
+++ b/bin/mozilla/ustva.pl
@@ -116,8 +116,7 @@ sub report {
my $company_given = ($form->{company} ne '')
? qq|
$form->{company}
\n|
- : qq||
+ : qq||
. $locale->text('No Company Name given') . qq|!
|;
@@ -674,9 +673,8 @@ sub generate_ustva {
};
}
- # Kontrollvariable für die Templates
- $form->{'year2007'} = ($form->{year} >= 2007 ) ? "1":"0";
-
+ # Kontrollvariablen für die Templates
+ $form->{"year$_"} = ($form->{year} >= $_ ) ? "1":"0" for 2007..2107;
# Get the USTVA
$ustva->ustva(\%myconfig, \%$form);
@@ -913,28 +911,44 @@ sub generate_ustva {
my $period = $form->{period};
$period * 1;
$period--;
- $form->{period} = $period;
+ $form->{taxbird_period} = $period;
} else {
$form->header;
USTVA::error( $locale->text('Wrong Period' ));
::end_of_request();
}
+ # heuristics for address splitting
+ # lx-office holds the entire address in a single field.
+ # taxbird expects it to be splitted into street, zipcode and city
+ if ($form->{co_street} =~ /\n/) {
+ my $new_co_street;
+ for (split /\n/, $form->{co_street}) {
+ if (/(\d{3,5})\s+(\w+)/) {
+ $form->{co_zip} = $1;
+ $form->{co_city} = $2;
+ } else {
+ $new_co_street .= $_;
+ }
+ }
+ $form->{co_street} = $new_co_street;
+ } else {
+ $form->{co_zip} = $form->{co_city};
+ $form->{co_zip} =~ s/\D//g;
+ $form->{co_city} =~ s/\d//g;
+ $form->{co_city} =~ s/^\s//g;
+ }
+
my $tax_office = first { $_->{name} eq $form->{elsterland} } @{ $ustva->{tax_office_information} };
$form->{taxbird_land_nr} = $tax_office->{taxbird_nr} if $tax_office;
- $form->{co_zip} = $form->{co_city};
- $form->{co_zip} =~ s/\D//g;
- $form->{co_city} =~ s/\d//g;
- $form->{co_city} =~ s/^\s//g;
-
($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel});
$form->{co_phone_prefix} =~ s/\s//g;
$form->{co_phone} =~ s/\s//g;
$form->{taxbird_steuernummer} = $form->{steuernummer};
# $form->{taxbird_steuernummer} =~ s/\D//g;
- $form->{taxbird_steuernummer} =~ s/\///; # ersten Querstrich ersetzen
+# $form->{taxbird_steuernummer} =~ s/\///; # ersten Querstrich ersetzen
# Numberformatting for Taxbird
my $temp_numberformat = $myconfig{numberformat};