Revision 9e99dce5
Von Jan Büren vor mehr als 7 Jahren hinzugefügt
SL/DATEV.pm | ||
---|---|---|
215 | 215 |
return $self->{trans_id}; |
216 | 216 |
} |
217 | 217 |
|
218 |
sub warnings { |
|
219 |
my $self = shift; |
|
220 |
|
|
221 |
if (@_) { |
|
222 |
$self->{warnings} = \@_; |
|
223 |
} else { |
|
224 |
return $self->{warnings}; |
|
225 |
} |
|
226 |
} |
|
227 |
|
|
218 | 228 |
sub accnofrom { |
219 | 229 |
my $self = shift; |
220 | 230 |
|
... | ... | |
1365 | 1375 |
push @array_of_datev, \@csv_headers; |
1366 | 1376 |
push @array_of_datev, [ map { $_->{csv_header_name} } @csv_columns ]; |
1367 | 1377 |
|
1378 |
my @warnings; |
|
1368 | 1379 |
foreach my $row ( @datev_lines ) { |
1369 | 1380 |
my @current_datev_row; |
1370 | 1381 |
|
... | ... | |
1389 | 1400 |
die "Incorrect lenght of field" if length($row->{ $column->{kivi_datev_name} }) > $column->{max_length}; |
1390 | 1401 |
} |
1391 | 1402 |
if (exists $column->{valid_check} && $column->{kivi_datev_name} ne 'not yet implemented') { |
1392 |
# more checks |
|
1393 |
die "Not a valid value: '$row->{ $column->{kivi_datev_name} }'" . |
|
1394 |
" for '$column->{kivi_datev_name}' with amount '$row->{umsatz}'" |
|
1395 |
unless ($column->{valid_check}->($row->{ $column->{kivi_datev_name} })); |
|
1403 |
# more checks, listed as user warnings |
|
1404 |
push @warnings, t8("Wrong field value '#1' for field '#2' for the transaction" . |
|
1405 |
" with amount '#3'",$row->{ $column->{kivi_datev_name} }, |
|
1406 |
$column->{kivi_datev_name},$row->{umsatz}) |
|
1407 |
unless ($column->{valid_check}->($row->{ $column->{kivi_datev_name} })); |
|
1396 | 1408 |
} |
1397 | 1409 |
push @current_datev_row, $row->{ $column->{kivi_datev_name} }; |
1398 | 1410 |
} |
1399 | 1411 |
push @array_of_datev, \@current_datev_row; |
1400 | 1412 |
} |
1413 |
$self->warnings(@warnings) if @warnings; |
|
1401 | 1414 |
return \@array_of_datev; |
1402 | 1415 |
} |
1403 | 1416 |
|
bin/mozilla/datev.pl | ||
---|---|---|
127 | 127 |
setup_datev_export3_action_bar(download_token => $datev->download_token); |
128 | 128 |
|
129 | 129 |
$::form->header; |
130 |
print $::form->parse_html_template('datev/export3'); |
|
130 |
print $::form->parse_html_template('datev/export3', { WARNINGS => $datev->warnings });
|
|
131 | 131 |
} else { |
132 | 132 |
$::form->error("Export schlug fehl.\n" . join "\n", $datev->errors); |
133 | 133 |
} |
locale/de/all | ||
---|---|---|
3572 | 3572 |
'Warn before saving orders with duplicate parts (new controller only)' => 'Beim Speichern warnen, wenn doppelte Artikel in einem Auftrag sind', |
3573 | 3573 |
'Warning' => 'Warnung', |
3574 | 3574 |
'Warning! Loading a draft will discard unsaved data!' => 'Achtung! Beim Laden eines Entwurfs werden ungespeicherte Daten verworfen!', |
3575 |
'Warning: One or more field value are not in valid DATEV format at:' => 'Warnung: Ein oder mehere Felder haben ungültige Feldwerte laut DATEV-Spezifikation bei:', |
|
3575 | 3576 |
'Warnings and errors' => 'Warnungen und Fehler', |
3576 | 3577 |
'Watch status' => 'Hintergrund-Job Status', |
3577 | 3578 |
'WebDAV' => 'WebDAV', |
... | ... | |
3599 | 3600 |
'Working copy; no description yet' => 'Arbeitskopie; noch keine Beschreibung', |
3600 | 3601 |
'Working on export' => 'Generiere Export', |
3601 | 3602 |
'Write bin to default bin in part?' => 'Diesen Lagerplatz als Standardlagerplatz im Artikel setzen?', |
3603 |
'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'' => 'Falscher Feldwert \'#1\' für Feld \'#2\' bei der Transaktion mit dem Umsatz von \'#3\'', |
|
3602 | 3604 |
'Wrong tax keys recorded' => 'Gespeicherte Steuerschlüssel sind falsch', |
3603 | 3605 |
'Wrong taxes recorded' => 'Gespeicherte Steuern passen nicht zum Steuerschlüssel', |
3604 | 3606 |
'X' => 'X', |
t/datev/datev_format_2018.t | ||
---|---|---|
68 | 68 |
# check conversion to csv |
69 | 69 |
$datev1->from($startdate); |
70 | 70 |
$datev1->to($enddate); |
71 |
eval {
|
|
72 |
$datev1->csv_buchungsexport();
|
|
73 |
1; };
|
|
74 |
like($@, qr/^Not a valid value: '' for 'belegfeld1' with .*/, "wrong encoding");
|
|
71 |
$datev1->csv_buchungsexport();
|
|
72 |
my @warnings = $datev1->warnings;
|
|
73 |
is(@warnings[0]->[0]->{untranslated},
|
|
74 |
'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'', 'wrong_encoding');
|
|
75 | 75 |
|
76 |
# redefine invnumber, but still broken |
|
76 |
|
|
77 |
# redefine invnumber, we have mixed encodings, should still generate a warning |
|
77 | 78 |
$invoice->invnumber('ݗݘݰݶmuh'); |
78 | 79 |
$invoice->save(); |
79 |
$datev1->generate_datev_data; |
|
80 |
$datev1->generate_datev_lines; |
|
81 |
eval { |
|
82 |
$datev1->csv_buchungsexport(); |
|
83 |
1; }; |
|
84 |
like($@, qr/^Not a valid value: '' for 'belegfeld1' with amount/, "mixed encoding"); |
|
80 |
|
|
81 |
my $datev3 = SL::DATEV->new( |
|
82 |
dbh => $dbh, |
|
83 |
trans_id => $invoice->id, |
|
84 |
); |
|
85 |
|
|
86 |
$datev3->from($startdate); |
|
87 |
$datev3->to($enddate); |
|
88 |
$datev3->generate_datev_data; |
|
89 |
$datev3->generate_datev_lines; |
|
90 |
$datev3->csv_buchungsexport; |
|
91 |
@warnings = []; |
|
92 |
@warnings = $datev3->warnings; |
|
93 |
is(@warnings[0]->[0]->{untranslated}, |
|
94 |
'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'', 'mixed_wrong_encoding'); |
|
95 |
|
|
85 | 96 |
|
86 | 97 |
|
87 | 98 |
# create one haben buchung with GLTransaction today |
templates/webpages/datev/export3.html | ||
---|---|---|
15 | 15 |
[% END %] |
16 | 16 |
|
17 | 17 |
</b> |
18 |
<br> |
|
18 |
<br/><br/> |
|
19 |
[% IF WARNINGS.size %] |
|
20 |
<b>[% 'Warning: One or more field value are not in valid DATEV format at:' | $T8 %]</b><br /><br /> |
|
21 |
[%- FOREACH warning = WARNINGS %] |
|
22 |
[% warning | $T8 %]<br/> |
|
23 |
[%- END %] |
|
24 |
<br /> |
|
25 |
[% END %] |
|
19 | 26 |
|
20 | 27 |
[% IF datev.net_gross_differences.size %] |
21 | 28 |
[% INCLUDE 'datev/net_gross_difference.html' |
Auch abrufbar als: Unified diff
DATEV-Export: Feldprüfung als Warnungen ausgeben
Anstatt hart auszusteigen (die), erhält der Anwender jetzt eine
Übersicht der fehlerhaften Feldwerte mit einem Minimum an
Zusatz-Info (Umsatz der Transaktion). Entsprechend den
Test-Fall angepasst.