From c6a97f5876750da1b731580c1011a985c4744013 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Sat, 13 Nov 2021 18:03:00 +0100 Subject: [PATCH] DeliveryOrder: fix array conversion in calculate_stock_in_out --- SL/Controller/DeliveryOrder.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SL/Controller/DeliveryOrder.pm b/SL/Controller/DeliveryOrder.pm index de8247e7e..547e3e2a0 100644 --- a/SL/Controller/DeliveryOrder.pm +++ b/SL/Controller/DeliveryOrder.pm @@ -2005,12 +2005,14 @@ sub store_pdf_to_webdav_and_filemanagement { sub calculate_stock_in_out { my ($self, $item) = @_; - return "" if !$item->part || !$item->part->unit; + return "" if !$item->part || !$item->part->unit || !$item->unit; my $in_out = $self->type_data->properties("transfer"); my $do_qty = $item->qty; - my $sum = sum0 map { $_->unit_obj->convert_to($_->qty, $item->unit_obj) } @{ $item->delivery_order_stock_entries }; + my $sum = sum0 map { + $_->unit_obj->convert_to($_->qty, $item->unit_obj) + } $item->delivery_order_stock_entries; my $matches = $do_qty == $sum; my $content = _format_number_units($sum, 2, $item->unit_obj, $item->part->unit_obj); -- 2.20.1