X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0af0977dd85c7d47942f7d3aee7e18fd86f09e7a..c0713b66e59e458d4966b8954ec1c835e2bc0c5b:/SL/Controller/CsvImport/Inventory.pm diff --git a/SL/Controller/CsvImport/Inventory.pm b/SL/Controller/CsvImport/Inventory.pm index 16debc093..c1406d059 100644 --- a/SL/Controller/CsvImport/Inventory.pm +++ b/SL/Controller/CsvImport/Inventory.pm @@ -28,6 +28,9 @@ sub init_class { $self->class('SL::DB::Inventory'); } +sub set_profile_defaults { +}; + sub init_profile { my ($self) = @_; @@ -208,7 +211,7 @@ sub check_bin { push @{ $entry->{errors} }, $::locale->text('Error: Invalid bin'); return 0; } - + # Map description to ID if given. if (!$object->bin_id && $entry->{raw_data}->{bin}) { my $bin = $self->bins_by->{_wh_id_and_description_ident()}->{ _wh_id_and_description_maker($object->warehouse_id, $entry->{raw_data}->{bin}) }; @@ -286,15 +289,17 @@ sub check_qty{ } # Actual quantity is read from stock or is the result of transfers for the - # same part, warehouse and bin done before. - my $key = join '+', $object->parts_id, $object->warehouse_id, $object->bin_id; + # same part, warehouse, bin and chargenumber done before. + my $key = join '+', $object->parts_id, $object->warehouse_id, $object->bin_id, $object->chargenumber; if (!exists $self->{resulting_quantities}->{$key}) { - my $stock = $object->part->get_simple_stock; - my @stocked = grep { $_->{warehouse_id} == $object->warehouse_id && $_->{bin_id} == $object->bin_id } @$stock; - my $stocked_qty = 0; - foreach (@stocked) { - $stocked_qty += $stocked[0]->{sum} * 1; - } + my $query = <get_standard_dbh, $query, + $object->parts_id, $object->warehouse_id, $object->bin_id, $object->chargenumber); $self->{resulting_quantities}->{$key} = $stocked_qty; } my $actual_qty = $self->{resulting_quantities}->{$key};