From: Sven Schöling Date: Sat, 13 Nov 2021 17:03:00 +0000 (+0100) Subject: DeliveryOrder: fix array conversion in calculate_stock_in_out X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~216^2~58 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c6a97f5876750da1b731580c1011a985c4744013;p=kivitendo-erp.git DeliveryOrder: fix array conversion in calculate_stock_in_out --- 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);