From a32fcad2cf3fabf15c9dd10ddc83ce703db66ad8 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Sven=20Sch=C3=B6ling?= <s.schoeling@googlemail.com>
Date: Mon, 31 Jan 2022 22:42:50 +0100
Subject: [PATCH] =?utf8?q?DeliveryOrder:=20=5Fmake=5Frecord=20f=C3=BCr=20d?=
 =?utf8?q?en=20alten=20Controller?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 bin/mozilla/io.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl
index 2f0fb95cd..4b6cf26c7 100644
--- a/bin/mozilla/io.pl
+++ b/bin/mozilla/io.pl
@@ -60,6 +60,7 @@ use SL::DB::AuthUser;
 use SL::DB::Contact;
 use SL::DB::Currency;
 use SL::DB::Customer;
+use SL::DB::DeliveryOrder::TypeData qw();
 use SL::DB::Default;
 use SL::DB::Language;
 use SL::DB::Printer;
@@ -2018,7 +2019,10 @@ sub _make_record {
   }
 
   $obj->items(@items) if @items;
-  $obj->is_sales(!!$obj->customer_id) if $class eq 'SL::DB::DeliveryOrder';
+
+  if ($class eq 'SL::DB::DeliveryOrder' && !$obj->order_type) {
+    $obj->order_type(SL::DB::DeliveryOrder::TypeData::validate_type($::form->{type}));
+  }
 
   if ($class eq 'SL::DB::Invoice') {
     my $paid = $factor *
-- 
2.20.1