From be8ddae1a3c78fcc43c040037657a4db67f67c9d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 27 Jan 2022 12:26:35 +0100 Subject: [PATCH] =?utf8?q?Testfall=20f=C3=BCr=20Inventory-Import=20deutsch?= =?utf8?q?es=20Zahlenformat?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- t/controllers/csvimport/inventory.t | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/t/controllers/csvimport/inventory.t b/t/controllers/csvimport/inventory.t index 346b2dcd5..14923234b 100644 --- a/t/controllers/csvimport/inventory.t +++ b/t/controllers/csvimport/inventory.t @@ -307,6 +307,27 @@ is ref $tt, 'SL::DB::TransferType', "Valid TransferType, no undef"; is $tt->direction, 'out', "Transfer direction correct"; is $tt->description, 'correction', "Transfer description correct"; +# add some stuff with a different numberformat + +$::myconfig{numberformat} = '1.000,00'; +$file = \<[0]; +is scalar @{ $entry->{errors} }, 0, "No error for valid data occurred"; +is $entry->{object}->qty, "31.2", "Valid qty accepted"; # evals to text qty = target_qty - actual_qty +is(SL::Helper::Inventory::get_stock(part => $part1), "31.20000", 'simple add (stock) qty works'); +is(SL::Helper::Inventory::get_onhand(part => $part1), "31.20000", 'simple add (onhand) qty works'); + +# now check the real Inventory entry +$trans_id = $entry->{object}->trans_id; +$inv_obj = SL::DB::Manager::Inventory->find_by(trans_id => $trans_id); + +# we expect one entry for one trans_id +is ref $inv_obj, "SL::DB::Inventory", "One inventory object, no array or undef"; +is $inv_obj->qty == 31.2, 1, "Valid qty calculated"; -- 2.20.1