From cdd2f4c8b75ed28be4e48e99ddc5e49bdc139fe6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 22 Aug 2018 12:27:54 +0200 Subject: [PATCH] DATEV-CSV-Export Belegfeld 2: trim statt regex verwenden --- SL/DATEV/CSV.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SL/DATEV/CSV.pm b/SL/DATEV/CSV.pm index faa2b8ddb..908347a44 100644 --- a/SL/DATEV/CSV.pm +++ b/SL/DATEV/CSV.pm @@ -10,6 +10,7 @@ use SL::DB::Datev; use SL::DB::Chart; use SL::Helper::DateTime; use SL::Locale::String qw(t8); +use SL::Util qw(trim); use Rose::Object::MakeMethods::Generic ( scalar => [ qw(datev_lines from to locked warnings) ], @@ -112,7 +113,7 @@ my @kivitendo_to_datev = ( type => 'Text', default => '', input_check => sub { my ($check) = @_; return 1 unless $check; return (ref (DateTime->from_kivitendo($check)) eq 'DateTime') }, - formatter => sub { my ($input) = @_; my $date = DateTime->from_kivitendo($input)->strftime('%e%m%y'); $date =~ s/^\s+//; return $date }, + formatter => sub { my ($input) = @_; return trim(DateTime->from_kivitendo($input)->strftime('%e%m%y')) }, valid_check => sub { my ($check) = @_; return ($check =~ m/^[0-9]{5,6}$/) }, }, { @@ -548,4 +549,3 @@ becaus warnings are generated after the call to lines: my $lines = $datev_csv->lines; die if @{ $datev_csv->warnings }; somethin_with($lines); - -- 2.20.1