Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d0b6af4d

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

  • ID d0b6af4dcb0e4b0ff1c34fa6e07e6a8a926ec366
  • Vorgänger 4b1d7057
  • Nachfolger 9e778942

DATEV::CSV Testfall um Feld ustid ergänzt

In Ergänzung zum vorherigen Commit

Unterschiede anzeigen:

t/datev/datev_format_2018.t
23 23
my $date            = DateTime->new(year => 2017, month =>  7, day => 19);
24 24
my $department      = create_department(description => 'Kästchenweiße heiße Preise');
25 25
my $project         = create_project(projectnumber => 2017, description => '299');
26

  
26
my $customer        = new_customer(name => 'Test customer', ustid => 'DE12345678')->save();
27 27
my $part1 = new_part(partnumber => '19', description => 'Part 19%')->save;
28 28
my $part2 = new_part(
29 29
  partnumber         => '7',
......
42 42
                  ],
43 43
  department_id    => $department->id,
44 44
  globalproject_id => $project->id,
45
  customer_id      => $customer->id,
45 46
);
46 47

  
47 48
# lets make a boom
......
112 113
# redefine invnumber, we have mixed encodings, should still fail
113 114
ok($die_message2 =~ m/Falscher Feldwert 'ݗݘݰݶmuh' für Feld 'belegfeld1' bei der Transaktion mit dem Umsatz von/, 'mixed_wrong_encoding');
114 115

  
116
# check with good number
117
$invoice->invnumber('meine muh');
118
$invoice->save();
119

  
120
my $datev4 = SL::DATEV->new(
121
  dbh        => $dbh,
122
  trans_id   => $invoice->id,
123
);
124

  
125
$datev4->from($startdate);
126
$datev4->to($enddate);
127
$datev4->generate_datev_data;
128
$datev4->generate_datev_lines;
129
my ($datev_csv4, $die_message3, $lines_aref);
130
eval {
131
  $datev_csv4 = SL::DATEV::CSV->new(datev_lines  => $datev4->generate_datev_lines,
132
                                    from         => $startdate,
133
                                    to           => $enddate,
134
                                    locked       => $datev4->locked,
135
                                   );
136
  $lines_aref = $datev_csv4->lines; # dies only if we assign (do stuff with the data)
137

  
138
  1;
139
} or do {
140
  $die_message3 = $@;
141
};
142
ok(!($die_message3), 'no die message');
143
ok(scalar @{ $datev_csv4->warnings } == 0, 'no warnings');
144

  
145
my @sorted =  sort { $a->[0] cmp $b->[0] } @{ $lines_aref };
146
cmp_deeply $sorted[0],    [ '1963,5', 'S', 'EUR', '', '', '',
147
                            '1400', '8400', '', '1907', 'meine muh',
148
                            '', '', '', '', '', '', '', '', '',
149
                            '', '', '', '', '', '', '', '', '',
150
                            '', '', '', '', '', '', '', "K\x{e4}stchen",
151
                            '299', '','DE12345678', '', '', '',
152
                            '', '', '', '', '', '', '', '', '',
153
                            '', '', '', '', '', '', '', '', '',
154
                            '', '', '', '', '', '', '', '', '',
155
                            '', '', '', '', '', '', '', '', '',
156
                            '', '', '', '', '', '', '', '', '',
157
                            '', '', '', '', '', '', '', '', '',
158
                            '', '', '', '', '', '', '', '', '',
159
                            '', '', '', '', '', '', '', '', '',
160
                            '',
161
                          ];
162
cmp_deeply $sorted[1],     [ '535', 'S', 'EUR', '', '', '',
163
                             '1400', '8300', '', '1907','meine muh',
164
                            '', '', '', '', '', '', '', '', '',
165
                            '', '', '', '', '', '', '', '', '',
166
                            '', '', '', '', '', '', '', "K\x{e4}stchen",
167
                            '299', '','DE12345678', '', '', '',
168
                            '', '', '', '', '', '', '', '', '',
169
                            '', '', '', '', '', '', '', '', '',
170
                            '', '', '', '', '', '', '', '', '',
171
                            '', '', '', '', '', '', '', '', '',
172
                            '', '', '', '', '', '', '', '', '',
173
                            '', '', '', '', '', '', '', '', '',
174
                            '', '', '', '', '', '', '', '', '',
175
                            '', '', '', '', '', '', '', '', '',
176
                            '',
177
                          ];
115 178
# create one haben buchung with GLTransaction today
116 179

  
117 180
my $expense_chart = SL::DB::Manager::Chart->find_by(accno => '4660'); # Reisekosten
......
180 243
                                      locked       => $datev2->locked,
181 244
                                     );
182 245

  
183
my @data_csv = $datev_csv3->lines;
184
@data_csv    = sort { $a->[0] cmp $b->[0] } @{ $datev_csv3->lines };
246
my @data_csv    = sort { $a->[0] cmp $b->[0] } @{ $datev_csv3->lines };
185 247
cmp_deeply($data_csv[0], [ 100, 'H', 'EUR', '', '', '', '4660', '1000', 9, '1703', 'Reise März 2',
186 248
                     '', '', '', '', '', '', '', '', '', '', '',
187 249
                     '', '', '', '', '', '', '', '', '', '', '', '', '',

Auch abrufbar als: Unified diff