From 82ef3a7267760e4c2508fa53f1ba819c34605395 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 17 Dec 2021 19:22:54 +0100 Subject: [PATCH] DeliveryOrder: in/out weiche in transfer_stock --- SL/Controller/DeliveryOrder.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SL/Controller/DeliveryOrder.pm b/SL/Controller/DeliveryOrder.pm index b6c720945..80a0d2eb8 100644 --- a/SL/Controller/DeliveryOrder.pm +++ b/SL/Controller/DeliveryOrder.pm @@ -1040,6 +1040,8 @@ sub action_transfer_stock { return $self->js->flash("error", t8('The parts for this order have already been transferred'))->render; } + my $inout = $self->type_data->properties('transfer'); + my $errors = $self->save; if (@$errors) { @@ -1050,7 +1052,7 @@ sub action_transfer_stock { my $order = $self->order; # TODO move to type data - my $trans_type = $self->type_data->properties('transfer') eq 'in' + my $trans_type = $inout eq 'in' ? SL::DB::Manager::TransferType->find_by(direction => "id", description => "stock") : SL::DB::Manager::TransferType->find_by(direction => "out", description => "shipped"); @@ -1060,6 +1062,7 @@ sub action_transfer_stock { for my $stock (@{ $item->delivery_order_stock_entries }) { my $transfer = SL::DB::Inventory->new_from($stock); $transfer->trans_type($trans_type); + $transfer->qty($transfer->qty * -1) if $inout eq 'out'; push @transfer_requests, $transfer if defined $transfer->qty && $transfer->qty != 0; }; -- 2.20.1