# check conversion to csv
$datev1->from($startdate);
$datev1->to($enddate);
-my ($datev_ref, $warnings_ref, $die_message);
+my ($datev_csv, $die_message);
eval {
- ($datev_ref, $warnings_ref) = SL::DATEV::CSV->new(datev_lines => $datev1->generate_datev_lines,
- from => $startdate,
- to => $enddate,
- locked => $datev1->locked,
- );
+ $datev_csv = SL::DATEV::CSV->new(datev_lines => $datev1->generate_datev_lines,
+ from => $startdate,
+ to => $enddate,
+ locked => $datev1->locked,
+ );
+ my $lines_aref = $datev_csv->lines; # dies only if we assign (do stuff with the data)
1;
} or do {
$die_message = $@;
};
-
ok($die_message =~ m/Falscher Feldwert 'ݗݘݰݶ' für Feld 'belegfeld1' bei der Transaktion mit dem Umsatz von/, 'wrong_encoding');
$datev3->to($enddate);
$datev3->generate_datev_data;
$datev3->generate_datev_lines;
-my ($datev_ref2, $warnings_ref2, $die_message2);
+my ($datev_csv2, $die_message2);
eval {
- ($datev_ref2, $warnings_ref2) = SL::DATEV::CSV->new(datev_lines => $datev3->generate_datev_lines,
- from => $startdate,
- to => $enddate,
- locked => $datev3->locked,
- );
+ $datev_csv2 = SL::DATEV::CSV->new(datev_lines => $datev3->generate_datev_lines,
+ from => $startdate,
+ to => $enddate,
+ locked => $datev3->locked,
+ );
+my $lines_aref = $datev_csv2->lines; # dies only if we assign (do stuff with the data)
+
1;
} or do {
$die_message2 = $@;
$datev2->generate_datev_data;
$datev2->generate_datev_lines;
-my ($datev_ref3, $warnings_ref3) = SL::DATEV::CSV->new(datev_lines => $datev2->generate_datev_lines,
- from => $startdate,
- to => $enddate,
- locked => $datev2->locked,
- );
+my $datev_csv3 = SL::DATEV::CSV->new(datev_lines => $datev2->generate_datev_lines,
+ from => $startdate,
+ to => $enddate,
+ locked => $datev2->locked,
+ );
-my @data_csv = splice @{ $datev_ref3 }, 2, 5;
-@data_csv = sort { $a->[0] cmp $b->[0] } @data_csv;
+my @data_csv = $datev_csv3->lines;
+@data_csv = sort { $a->[0] cmp $b->[0] } @{ $datev_csv3->lines };
cmp_deeply($data_csv[0], [ 100, 'H', 'EUR', '', '', '', '4660', '1000', 9, '1703', 'Reise März 2',
'', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '' ]
);
+# TODO warnings are not yet tested
+# currently most of the valid_checks are senseless because of
+# the strict input_checks before. Maybe something like encoding mismatch of invnumber,
+# can be altered to just a warning (not a mandantory field!)
+
done_testing();
clear_up();