Revision be8ddae1
Von Jan Büren vor fast 3 Jahren hinzugefügt
t/controllers/csvimport/inventory.t | ||
---|---|---|
307 | 307 |
is $tt->direction, 'out', "Transfer direction correct"; |
308 | 308 |
is $tt->description, 'correction', "Transfer description correct"; |
309 | 309 |
|
310 |
# add some stuff with a different numberformat |
|
311 |
|
|
312 |
$::myconfig{numberformat} = '1.000,00'; |
|
313 |
$file = \<<EOL; |
|
314 |
warehouse,bin,partnumber,target_qty,comment |
|
315 |
Warehouse,"Bin 1","ap 1","31,2","Jetzt wirklich" |
|
316 |
EOL |
|
317 |
$entries = test_import($file, $settings1); |
|
318 |
$entry = $entries->[0]; |
|
319 |
is scalar @{ $entry->{errors} }, 0, "No error for valid data occurred"; |
|
320 |
is $entry->{object}->qty, "31.2", "Valid qty accepted"; # evals to text qty = target_qty - actual_qty |
|
321 |
is(SL::Helper::Inventory::get_stock(part => $part1), "31.20000", 'simple add (stock) qty works'); |
|
322 |
is(SL::Helper::Inventory::get_onhand(part => $part1), "31.20000", 'simple add (onhand) qty works'); |
|
323 |
|
|
324 |
# now check the real Inventory entry |
|
325 |
$trans_id = $entry->{object}->trans_id; |
|
326 |
$inv_obj = SL::DB::Manager::Inventory->find_by(trans_id => $trans_id); |
|
327 |
|
|
328 |
# we expect one entry for one trans_id |
|
329 |
is ref $inv_obj, "SL::DB::Inventory", "One inventory object, no array or undef"; |
|
330 |
is $inv_obj->qty == 31.2, 1, "Valid qty calculated"; |
|
310 | 331 |
|
311 | 332 |
|
312 | 333 |
|
Auch abrufbar als: Unified diff
Testfall für Inventory-Import deutsches Zahlenformat