From: Moritz Bunkus Date: Wed, 11 Mar 2020 11:25:24 +0000 (+0100) Subject: DATEV: UStID-Nummern-Validierung auf neues Modul SL::VATIDNr umgestellt X-Git-Tag: release-3.5.6.1~245^2~2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c20ee3de1b3dea582430643d784fbeb31a7d3fb0;p=kivitendo-erp.git DATEV: UStID-Nummern-Validierung auf neues Modul SL::VATIDNr umgestellt --- diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 99c852371..c5d75ea00 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -37,6 +37,7 @@ use SL::DB; use SL::HTML::Util (); use SL::Iconv; use SL::Locale::String qw(t8); +use SL::VATIDNr; use Data::Dumper; use DateTime; @@ -1045,7 +1046,7 @@ sub generate_datev_lines { $datev_data{buchungstext} = $transaction->[$haben]->{'name'}; } if (($transaction->[$haben]->{'ustid'} // '') ne "") { - $datev_data{ustid} = $transaction->[$haben]->{'ustid'}; + $datev_data{ustid} = SL::VATIDNr->normalize($transaction->[$haben]->{'ustid'}); } if (($transaction->[$haben]->{'duedate'} // '') ne "") { $datev_data{belegfeld2} = $transaction->[$haben]->{'duedate'}; @@ -1164,7 +1165,7 @@ sub kne_buchungsexport { $name =~ s/\ *$//; $kne_file->add_block("\x1E" . $name . "\x1C"); - $kne_file->add_block("\xBA" . $kne->{'ustid'} . "\x1C") if $kne->{'ustid'}; + $kne_file->add_block("\xBA" . SL::VATIDNr->normalize($kne->{'ustid'}) . "\x1C") if $kne->{'ustid'}; $kne_file->add_block("\xB3" . $kne->{'waehrung'} . "\x1C" . "\x79"); }; diff --git a/SL/DATEV/CSV.pm b/SL/DATEV/CSV.pm index 65f6cf0d1..05598b12a 100644 --- a/SL/DATEV/CSV.pm +++ b/SL/DATEV/CSV.pm @@ -11,6 +11,7 @@ use SL::DB::Chart; use SL::Helper::DateTime; use SL::Locale::String qw(t8); use SL::Util qw(trim); +use SL::VATIDNr; use Rose::Object::MakeMethods::Generic ( scalar => [ qw(datev_lines from to locked warnings) ], @@ -240,14 +241,13 @@ my @kivitendo_to_datev = ( input_check => sub { my ($ustid) = @_; return 1 if ('' eq $ustid); - $ustid =~ s{\s+}{}g; - return ($ustid =~ m/^CH|^[A-Z]{2}\w{5,13}$/); + return SL::VATIDNr->validate($ustid); }, formatter => sub { my ($input) = @_; $input =~ s/\s//g; return $input }, valid_check => sub { my ($ustid) = @_; return 1 if ('' eq $ustid); - return ($ustid =~ m/^CH|^[A-Z]{2}\w{5,13}$/); + return SL::VATIDNr->validate($ustid); }, }, # pos 40 {