DeliveryOrder: type roundtrip safety
authorSven Schöling <s.schoeling@googlemail.com>
Fri, 1 Oct 2021 15:50:48 +0000 (17:50 +0200)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 13:53:49 +0000 (14:53 +0100)
SL/Controller/DeliveryOrder.pm

index feeff1c..2d93289 100644 (file)
@@ -1161,7 +1161,7 @@ sub make_order {
   # order here solves this problem.
   my $order;
   $order   = SL::DB::DeliveryOrder->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
-  $order ||= SL::DB::DeliveryOrder->new(orderitems  => [], currency_id => $::instance_conf->get_currency_id(),);
+  $order ||= SL::DB::DeliveryOrder->new(orderitems  => [], currency_id => $::instance_conf->get_currency_id(), order_type => $self->type_data->validate_type($::form->{type}));
 
   my $cv_id_method = $self->cv . '_id';
   if (!$::form->{id} && $::form->{$cv_id_method}) {