From f15ebd7da4e55d14e1f436034ac4723ba543b765 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 10 Dec 2021 13:54:41 +0100 Subject: [PATCH] DeliveryPlan: Bei Umwandlung Typ an new_from geben --- SL/Controller/DeliveryOrder.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SL/Controller/DeliveryOrder.pm b/SL/Controller/DeliveryOrder.pm index d7a0c90b3..a0d9c19d6 100644 --- a/SL/Controller/DeliveryOrder.pm +++ b/SL/Controller/DeliveryOrder.pm @@ -18,6 +18,7 @@ use SL::DB::History; use SL::DB::Order; use SL::DB::Default; use SL::DB::Unit; +use SL::DB::Order; use SL::DB::Part; use SL::DB::PartClassification; use SL::DB::PartsGroup; @@ -85,7 +86,11 @@ sub action_add_from_order { # this interfers with init_order $self->{converted_from_oe_id} = delete $::form->{id}; - # TODO copy data and remember to link them on save + $self->type_data->validate($::form->{type}); + + my $order = SL::DB::Order->new(id => $self->{converted_from_oe_id})->load; + + $self->order(SL::DB::DeliveryOrder->new_from($order, type => $::form->{type})); $self->action_add; } -- 2.20.1