DeliveryOrder: _make_record für den alten Controller
authorSven Schöling <s.schoeling@googlemail.com>
Mon, 31 Jan 2022 21:42:50 +0000 (22:42 +0100)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 14:04:13 +0000 (15:04 +0100)
bin/mozilla/io.pl

index 2f0fb95..4b6cf26 100644 (file)
@@ -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 *