From: Sven Schöling Date: Fri, 17 Dec 2021 18:22:54 +0000 (+0100) Subject: DeliveryOrder: in/out weiche in transfer_stock X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~216^2~19 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=82ef3a7267760e4c2508fa53f1ba819c34605395;p=kivitendo-erp.git DeliveryOrder: in/out weiche in transfer_stock --- 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; };