DeliveryOrder: new_from - fix für Quellobjekte die keine Kunden/Lieferanten haben
authorSven Schöling <s.schoeling@googlemail.com>
Fri, 8 Oct 2021 16:02:49 +0000 (18:02 +0200)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 13:58:19 +0000 (14:58 +0100)
SL/DB/DeliveryOrder.pm

index a7c20cb..068d6c4 100644 (file)
@@ -155,7 +155,8 @@ sub new_from {
   # infer type from legacy fields if not given
   $params{order_type} //= $source->customer_id ? 'sales_delivery_order'
                         : $source->vendor_id   ? 'purchase_delivery_order'
-                        : undef;
+                        : $source->is_sales    ? 'sales_delivery_order'
+                        : croak "need some way to set delivery order type from source";
 
   # overwrite legacy is_sales from type_data
   $args{is_sales} = SL::Controller::DeliveryOrder::TypeData::get3($params{order_type}, "properties", "is_customer");