X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDATEV%2FCSV.pm;h=8b8e8859822facac10eb86eded3cf49e5368bd3c;hb=95b5d54bac9dc0cb47c67444c9e19c1d68b0d520;hp=65f6cf0d1ebd764330d77a4b3b5ed3c5ab11aa31;hpb=1c46843f9e08f6878ea1290d1d69a38dff9178bc;p=kivitendo-erp.git diff --git a/SL/DATEV/CSV.pm b/SL/DATEV/CSV.pm index 65f6cf0d1..8b8e88598 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 { @@ -478,8 +478,15 @@ my @kivitendo_to_datev = ( valid_check => sub { my ($check) = @_; return ($check =~ m/^(0|1)$/) }, }, # pos 114 { - kivi_datev_name => 'not yet implemented', - }, + kivi_datev_name => 'leistungsdatum', + csv_header_name => t8('Payment Date'), + max_length => 8, + type => 'Date', + default => '', + input_check => sub { my ($check) = @_; return 1 if ('' eq $check); return (ref (DateTime->from_kivitendo($check)) eq 'DateTime') }, + formatter => sub { my ($input) = @_; return '' if ('' eq $input); return DateTime->from_kivitendo($input)->strftime('%d%m%Y') }, + valid_check => sub { my ($check) = @_; return 1 if ('' eq $check); return ($check =~ m/^[0-9]{8}$/) }, + }, # pos 115 { kivi_datev_name => 'not yet implemented', },