Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1d559eff

Von Jan Büren vor mehr als 6 Jahren hinzugefügt

  • ID 1d559eff1e8a7efba3d21704d93b8cb62749de75
  • Vorgänger 6d831130
  • Nachfolger b55d5bb4

DATEV: csv_buchungsexport nach DATEV::CSV.pm ausgelagert

Testfälle angepasst. POD angepasst.
Details:

DATEV.pm
- Klassenvariable locked hinzugefügt.
- Aufruf der CSV-Klasse anstatt der internen Methode

CSV.pm
- Konstruktor wie in DATEV.pm ergänzt und um minimale
Pflichtfeldprüfung ergänzt.
- datetofour durch SL::Helper::DateTime ersetzt
- Helper _format_amount auch aufrufen
- Routinen umbenannt (pseudoprivat mit Unterstrich)
- Prüfung auf locked als perlish boolean
- _csv_buchungsexport um zweiten return array_ref mit warnungen ergänzt

t/datev/*
- Testfälle enstprechend dem neuen API-Call umgeschrieben
- Einen Testfall zur Überprüfung von keiner Warnung ergänzt

Unterschiede anzeigen:

t/datev/datev_format_2018.t
68 68
# check conversion to csv
69 69
$datev1->from($startdate);
70 70
$datev1->to($enddate);
71
$datev1->csv_buchungsexport();
72
my @warnings = $datev1->warnings;
71
my ($datev_ref, $warnings_ref) = SL::DATEV::CSV->new(datev_lines  => $datev1->generate_datev_lines,
72
                                                     from         => $startdate,
73
                                                     to           => $enddate,
74
                                                     locked       => $datev1->locked,
75
                                                    );
76
my @warnings = $warnings_ref;
73 77
is($warnings[0]->[0]->{untranslated},
74 78
  'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'', 'wrong_encoding');
75 79

  
......
87 91
$datev3->to($enddate);
88 92
$datev3->generate_datev_data;
89 93
$datev3->generate_datev_lines;
90
$datev3->csv_buchungsexport;
94
my ($datev_ref2, $warnings_ref2) = SL::DATEV::CSV->new(datev_lines  => $datev3->generate_datev_lines,
95
                                                       from         => $startdate,
96
                                                       to           => $enddate,
97
                                                       locked       => $datev3->locked,
98
                                                      );
99

  
100

  
101

  
91 102
@warnings = [];
92
@warnings = $datev3->warnings;
103
@warnings = $warnings_ref2;
93 104
is($warnings[0]->[0]->{untranslated},
94 105
  'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'', 'mixed_wrong_encoding');
95 106

  
......
157 168
$datev2->generate_datev_data;
158 169
$datev2->generate_datev_lines;
159 170

  
160
my @data_csv = splice @{ $datev2->csv_buchungsexport() }, 2, 5;
161
@data_csv    = sort { $a->[0] <=> $b->[0] } @data_csv;
171
my ($datev_ref3, $warnings_ref3) = SL::DATEV::CSV->new(datev_lines  => $datev2->generate_datev_lines,
172
                                                       from         => $startdate,
173
                                                       to           => $enddate,
174
                                                       locked       => $datev2->locked,
175
                                                      );
162 176

  
177
my @data_csv = splice @{ $datev_ref3 }, 2, 5;
178
@data_csv    = sort { $a->[0] cmp $b->[0] } @data_csv;
163 179

  
164 180
my $cp1252_posting_text   = SL::Iconv::convert("UTF-8", "CP1252", 'Reisekosten März 2018');
165 181
cmp_bag($data_csv[0], [ 100, 'H', 'EUR', undef, undef, undef, '4660', '1000', 9, '1703', 'Reisekosten ',

Auch abrufbar als: Unified diff