From: Sven Schöling Date: Fri, 16 Oct 2020 16:07:34 +0000 (+0200) Subject: Inventory: with_objects cleanup X-Git-Tag: kivitendo-mebil_0.1-0~9^2~596 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1d96e96182f306f5f4eba8861960e772578d564a;p=kivitendo-erp.git Inventory: with_objects cleanup --- diff --git a/SL/Helper/Inventory.pm b/SL/Helper/Inventory.pm index 8e18a6a91..69338622e 100644 --- a/SL/Helper/Inventory.pm +++ b/SL/Helper/Inventory.pm @@ -116,16 +116,13 @@ sub _get_stock_onhand { for my $with_object (listify($params{with_objects})) { Carp::croak("unknown with_object $with_object") if !exists $with_objects{$with_object}; - if (my $manager = $with_objects{$with_object}) { - my $slot = $slots{$with_object}; - next if !(my @ids = map { $_->{$slot} } @$results); - my $objects = $manager->get_all(query => [ id => \@ids ]); - my %objects_by_id = map { $_->id => $_ } @$objects; - - $_->{$with_object} = $objects_by_id{$_->{$slot}} for @$results; - } else { - # need to fetch all partitions - } + my $manager = $with_objects{$with_object}; + my $slot = $slots{$with_object}; + next if !(my @ids = map { $_->{$slot} } @$results); + my $objects = $manager->get_all(query => [ id => \@ids ]); + my %objects_by_id = map { $_->id => $_ } @$objects; + + $_->{$with_object} = $objects_by_id{$_->{$slot}} for @$results; } }