package SL::DATEV::CSV;
use strict;
-
-use SL::Locale::String qw(t8);
-use SL::DB::Datev;
-use DateTime; # safer before the Helper
-use SL::Helper::DateTime;
-
use Carp;
+use DateTime;
use Encode qw(decode);
use Scalar::Util qw(looks_like_number);
+use SL::DB::Datev;
+use SL::DB::Chart;
+use SL::Helper::DateTime;
+use SL::Locale::String qw(t8);
+
use Rose::Object::MakeMethods::Generic (
scalar => [ qw(datev_lines from to locked warnings) ],
);
type => 'Text',
default => '',
input_check => sub { my ($check) = @_; return ($check eq '' || $check =~ m/[A-Z]{2}\w{5,13}/) },
- formatter => sub { my ($input) = @_; return ($input =~ s/\s//g) },
+ formatter => sub { my ($input) = @_; $input =~ s/\s//g; return $input },
valid_check => sub {
my ($ustid) = @_;
return 1 if ('' eq $ustid);
}
sub _kivitendo_to_datev {
- my ($self) = @_;
-
- my $entries = scalar (@kivitendo_to_datev);
- push @kivitendo_to_datev, { kivi_datev_name => 'not yet implemented' } for 1 .. (116 - $entries);
- return @kivitendo_to_datev;
+ @kivitendo_to_datev, ({ kivi_datev_name => 'not yet implemented' }) x (116 - @kivitendo_to_datev);
}
sub header {
my @header;
# we can safely set these defaults
- # TODO use Helper::DateTime and get lenght_of_accounts from DATEV.pm
+ # TODO use Helper::DateTime and get length_of_accounts from DATEV.pm
my $today = DateTime->now(time_zone => "local");
my $created_on = $today->ymd('') . $today->hms('') . '000';
my $length_of_accounts = length(SL::DB::Manager::Chart->get_first(where => [charttype => 'A'])->accno) // 4;
if (defined $column->{default}) {
$data = $column->{default};
} else {
- die 'No sensible value or a sensible default found for the entry: ' . $column->{kivi_datev_name};
+ die 'No sensible value or a sensible default found for the entry: ' . $column->{kivi_datev_name};
}
}
# checkpoint a: no undefined data. All strict checks now!
=head1 TODO CAVEAT
-
-Currently no effort has be done that _kivitenod_to_datev is only intializied once:
-Therefore the second call may generate integrity faults:
-
- my $datev_csv_1 = SL::DATEV::CSV->new(...)->lines;
- my $datev_csv_2 = SL::DATEV::CSV->new(...)->lines;
-
-Secondly one can circumevent the check of the warnings.quite easily,
+One can circumevent the check of the warnings.quite easily,
becaus warnings are generated after the call to lines:
# WRONG usage