From 0f743db7bdbc3e6ecea2597877b683707b852823 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 24 Jul 2017 16:25:59 +0200 Subject: [PATCH] Helper::ShippedQty: orderitems korrekt in calculate behandeln --- SL/Helper/ShippedQty.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SL/Helper/ShippedQty.pm b/SL/Helper/ShippedQty.pm index 2054513de..1712ffbb0 100644 --- a/SL/Helper/ShippedQty.pm +++ b/SL/Helper/ShippedQty.pm @@ -7,7 +7,7 @@ use SL::AM; use Scalar::Util qw(blessed); use SL::DBUtils qw(selectall_hashref_query selectall_as_map); use List::Util qw(min); -use List::MoreUtils qw(any all); +use List::MoreUtils qw(any all uniq); use List::UtilsBy qw(partition_by); use SL::Locale::String qw(t8); @@ -262,8 +262,9 @@ sub init_oe_ids { die 'oe_ids not initialized in id mode' if !$self->objects_or_ids; die 'objects not initialized before accessing ids' if $self->objects_or_ids && !defined $self->objects; + die 'objects need to be Order or OrderItem' if any { ref($_) !~ /^SL::DB::Order(?:Item)?$/ } @{ $self->objects }; - [ map { $_->id } @{ $self->objects } ] + [ uniq map { ref($_) =~ /Item/ ? $_->trans_id : $_->id } @{ $self->objects } ] } sub init_dbh { SL::DB->client->dbh } @@ -308,6 +309,8 @@ SL::Helper::ShippedQty - Algorithmic module for calculating shipped qty $helper->calculate($order_object); $helper->calculate(\@order_objects); + $helper->calculate($orderitem_object); + $helper->calculate(\@orderitem_objects); $helper->calculate($oe_id); $helper->calculate(\@oe_ids); -- 2.20.1