From: Sven Schöling Date: Fri, 15 Oct 2021 15:32:42 +0000 (+0200) Subject: DeliveryOrder: Konvertierung von is_sales bugs X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~216^2~68 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a16a599942f621e9d27b13a2e2183b9aa44757a7;p=kivitendo-erp.git DeliveryOrder: Konvertierung von is_sales bugs --- diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm index 068d6c419..5f6056dbc 100644 --- a/SL/DB/DeliveryOrder.pm +++ b/SL/DB/DeliveryOrder.pm @@ -153,13 +153,13 @@ 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' - : $source->is_sales ? 'sales_delivery_order' - : croak "need some way to set delivery order type from source"; + $args{order_type} //= $source->customer_id ? 'sales_delivery_order' + : $source->vendor_id ? 'purchase_delivery_order' + : $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"); + $args{is_sales} = SL::Controller::DeliveryOrder::TypeData::get3($args{order_type}, "properties", "is_customer"); my $delivery_order = $class->new(%args); $delivery_order->assign_attributes(%{ $params{attributes} }) if $params{attributes}; @@ -321,7 +321,10 @@ sub new_from_time_recordings { # legacy for compatibility # use type_data cusomtervendor and transfer direction instead sub is_sales { - SL::Controller::DeliveryOrder::TypeData::get3($_[0]->order_type, "properties", "is_customer"); + if ($_[0]->order_type) { + return SL::Controller::DeliveryOrder::TypeData::get3($_[0]->order_type, "properties", "is_customer"); + } + return $_[0]{is_sales}; } sub customervendor {