Revision e428a414
Von Jan Büren vor mehr als 6 Jahren hinzugefügt
t/datev/datev_format_2018.t | ||
---|---|---|
68 | 68 |
# check conversion to csv |
69 | 69 |
$datev1->from($startdate); |
70 | 70 |
$datev1->to($enddate); |
71 |
my ($datev_ref, $warnings_ref) = SL::DATEV::CSV->new(datev_lines => $datev1->generate_datev_lines, |
|
71 |
my ($datev_ref, $warnings_ref, $die_message); |
|
72 |
eval { |
|
73 |
($datev_ref, $warnings_ref) = SL::DATEV::CSV->new(datev_lines => $datev1->generate_datev_lines, |
|
72 | 74 |
from => $startdate, |
73 | 75 |
to => $enddate, |
74 | 76 |
locked => $datev1->locked, |
75 | 77 |
); |
76 |
my @warnings = $warnings_ref; |
|
77 |
is($warnings[0]->[0]->{untranslated}, |
|
78 |
'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'', 'wrong_encoding'); |
|
78 |
1; |
|
79 |
} or do { |
|
80 |
$die_message = $@; |
|
81 |
}; |
|
82 |
|
|
83 |
ok($die_message =~ m/Falscher Feldwert 'ݗݘݰݶ' für Feld 'belegfeld1' bei der Transaktion mit dem Umsatz von/, 'wrong_encoding'); |
|
79 | 84 |
|
80 | 85 |
|
81 |
# redefine invnumber, we have mixed encodings, should still generate a warning |
|
82 | 86 |
$invoice->invnumber('ݗݘݰݶmuh'); |
83 | 87 |
$invoice->save(); |
84 | 88 |
|
... | ... | |
91 | 95 |
$datev3->to($enddate); |
92 | 96 |
$datev3->generate_datev_data; |
93 | 97 |
$datev3->generate_datev_lines; |
94 |
my ($datev_ref2, $warnings_ref2) = SL::DATEV::CSV->new(datev_lines => $datev3->generate_datev_lines, |
|
98 |
my ($datev_ref2, $warnings_ref2, $die_message2); |
|
99 |
eval { |
|
100 |
($datev_ref2, $warnings_ref2) = SL::DATEV::CSV->new(datev_lines => $datev3->generate_datev_lines, |
|
95 | 101 |
from => $startdate, |
96 | 102 |
to => $enddate, |
97 | 103 |
locked => $datev3->locked, |
98 | 104 |
); |
105 |
1; |
|
106 |
} or do { |
|
107 |
$die_message2 = $@; |
|
108 |
}; |
|
99 | 109 |
|
100 |
|
|
101 |
|
|
102 |
@warnings = []; |
|
103 |
@warnings = $warnings_ref2; |
|
104 |
is($warnings[0]->[0]->{untranslated}, |
|
105 |
'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'', 'mixed_wrong_encoding'); |
|
106 |
|
|
107 |
|
|
110 |
# redefine invnumber, we have mixed encodings, should still fail |
|
111 |
ok($die_message2 =~ m/Falscher Feldwert 'ݗݘݰݶmuh' für Feld 'belegfeld1' bei der Transaktion mit dem Umsatz von/, 'mixed_wrong_encoding'); |
|
108 | 112 |
|
109 | 113 |
# create one haben buchung with GLTransaction today |
110 | 114 |
|
... | ... | |
145 | 149 |
)); |
146 | 150 |
|
147 | 151 |
my $gl_transaction = SL::DB::GLTransaction->new( |
148 |
reference => "Reisekosten März 2018",
|
|
152 |
reference => "Reise März 2018", |
|
149 | 153 |
description => "Reisekonsten März 2018 / Ma Schmidt", |
150 | 154 |
transdate => $today, |
151 | 155 |
gldate => $today, |
... | ... | |
176 | 180 |
|
177 | 181 |
my @data_csv = splice @{ $datev_ref3 }, 2, 5; |
178 | 182 |
@data_csv = sort { $a->[0] cmp $b->[0] } @data_csv; |
179 |
|
|
180 |
my $cp1252_posting_text = SL::Iconv::convert("UTF-8", "CP1252", 'Reisekosten März 2018'); |
|
181 |
cmp_bag($data_csv[0], [ 100, 'H', 'EUR', undef, undef, undef, '4660', '1000', 9, '1703', 'Reisekosten ', |
|
182 |
undef, undef, $cp1252_posting_text, undef, undef, undef, undef, undef, undef, undef, undef, |
|
183 |
undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, |
|
184 |
undef, undef, '', undef, undef, undef, undef, undef, undef, undef, undef, |
|
185 |
undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, |
|
186 |
undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, |
|
187 |
undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, |
|
188 |
undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, |
|
189 |
undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, |
|
190 |
undef, undef, undef, undef, undef ] |
|
183 |
cmp_bag($data_csv[0], [ 100, 'H', 'EUR', '', '', '', '4660', '1000', 9, '1703', 'Reise März 2', |
|
184 |
'', '', '', '', '', '', '', '', '', '', '', |
|
185 |
'', '', '', '', '', '', '', '', '', '', '', '', '', |
|
186 |
'', '', '', '', '', '', '', '', '', '', '', |
|
187 |
'', '', '', '', '', '', '', '', '', '', '', '', '', |
|
188 |
'', '', '', '', '', '', '', '', '', '', '', '', '', |
|
189 |
'', '', '', '', '', '', '', '', '', '', '', '', '', |
|
190 |
'', '', '', '', '', '', '', '', '', '', '', '', '', |
|
191 |
'', '', '', '', '', '', '', '', '', '', '', '', '', |
|
192 |
'', '', '', '', '' ] |
|
191 | 193 |
); |
192 | 194 |
|
193 | 195 |
done_testing(); |
Auch abrufbar als: Unified diff
DATEV/CSV.pm Testfälle für aktuelle Überarbeitung angepasst
Ungültiges Encoding wirft jetzt hart einen Fehler
Keine undef-Werte mehr in der Datenstruktur
Unsinninge Iconvs und Encodes erstmal entfernt