Revision a16a5999
Von Sven Schöling vor fast 3 Jahren hinzugefügt
SL/DB/DeliveryOrder.pm | ||
---|---|---|
153 | 153 |
} |
154 | 154 |
|
155 | 155 |
# infer type from legacy fields if not given |
156 |
$params{order_type} //= $source->customer_id ? 'sales_delivery_order'
|
|
157 |
: $source->vendor_id ? 'purchase_delivery_order'
|
|
158 |
: $source->is_sales ? 'sales_delivery_order'
|
|
159 |
: croak "need some way to set delivery order type from source";
|
|
156 |
$args{order_type} //= $source->customer_id ? 'sales_delivery_order'
|
|
157 |
: $source->vendor_id ? 'purchase_delivery_order' |
|
158 |
: $source->is_sales ? 'sales_delivery_order' |
|
159 |
: croak "need some way to set delivery order type from source"; |
|
160 | 160 |
|
161 | 161 |
# overwrite legacy is_sales from type_data |
162 |
$args{is_sales} = SL::Controller::DeliveryOrder::TypeData::get3($params{order_type}, "properties", "is_customer");
|
|
162 |
$args{is_sales} = SL::Controller::DeliveryOrder::TypeData::get3($args{order_type}, "properties", "is_customer");
|
|
163 | 163 |
|
164 | 164 |
my $delivery_order = $class->new(%args); |
165 | 165 |
$delivery_order->assign_attributes(%{ $params{attributes} }) if $params{attributes}; |
... | ... | |
321 | 321 |
# legacy for compatibility |
322 | 322 |
# use type_data cusomtervendor and transfer direction instead |
323 | 323 |
sub is_sales { |
324 |
SL::Controller::DeliveryOrder::TypeData::get3($_[0]->order_type, "properties", "is_customer"); |
|
324 |
if ($_[0]->order_type) { |
|
325 |
return SL::Controller::DeliveryOrder::TypeData::get3($_[0]->order_type, "properties", "is_customer"); |
|
326 |
} |
|
327 |
return $_[0]{is_sales}; |
|
325 | 328 |
} |
326 | 329 |
|
327 | 330 |
sub customervendor { |
Auch abrufbar als: Unified diff
DeliveryOrder: Konvertierung von is_sales bugs