Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fd32682e

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID fd32682e006eb46999cd06295f2e26ba3038efcd
  • Vorgänger 354bb11b
  • Nachfolger 310df8d8

DB::DeliveryOrder: Nutze record_type

anstelle order_type

Unterschiede anzeigen:

SL/DB/DeliveryOrder.pm
169 169
    employee => SL::DB::Manager::Employee->current,
170 170
    closed    => 0,
171 171
    delivered => 0,
172
    order_type => $params{destination_type},
172
    record_type => $params{destination_type},
173 173
    transdate => DateTime->today_local,
174 174
  );
175 175

  
......
238 238
  }
239 239

  
240 240
  # infer type from legacy fields if not given
241
  $record_args{order_type} //= $source->customer_id ? SALES_DELIVERY_ORDER_TYPE()
242
                      : $source->vendor_id   ? PURCHASE_DELIVERY_ORDER_TYPE()
243
                      : $source->is_sales    ? SALES_DELIVERY_ORDER_TYPE()
244
                      : croak "need some way to set delivery order type from source";
241
  $record_args{record_type} //= $source->customer_id ? SALES_DELIVERY_ORDER_TYPE()
242
                              : $source->vendor_id   ? PURCHASE_DELIVERY_ORDER_TYPE()
243
                              : $source->is_sales    ? SALES_DELIVERY_ORDER_TYPE()
244
                              : croak "need some way to set delivery order type from source";
245 245

  
246 246
  my $delivery_order = $class->new(%record_args);
247 247
  $delivery_order->assign_attributes(%{ $params{attributes} }) if $params{attributes};
......
372 372

  
373 373
  } else {
374 374
    my %args = (
375
      order_type  => SALES_DELIVERY_ORDER_TYPE,
375
      record_type => SALES_DELIVERY_ORDER_TYPE,
376 376
      delivered   => 0,
377 377
      customer_id => $sources->[0]->customer_id,
378 378
      taxzone_id  => $sources->[0]->customer->taxzone_id,
......
391 391
# legacy for compatibility
392 392
# use type_data cusomtervendor and transfer direction instead
393 393
sub is_sales {
394
  if ($_[0]->order_type) {
395
   return SL::DB::DeliveryOrder::TypeData::get3($_[0]->order_type, "properties", "is_customer");
394
  if ($_[0]->record_type) {
395
   return SL::DB::DeliveryOrder::TypeData::get3($_[0]->record_type, "properties", "is_customer");
396 396
  }
397 397
  return $_[0]{is_sales};
398 398
}
399 399

  
400 400
sub customervendor {
401
  SL::DB::DeliveryOrder::TypeData::get3($_[0]->order_type, "properties", "is_customer") ? $_[0]->customer : $_[0]->vendor;
401
  SL::DB::DeliveryOrder::TypeData::get3($_[0]->record_type, "properties", "is_customer") ? $_[0]->customer : $_[0]->vendor;
402 402
}
403 403

  
404 404
sub convert_to_invoice {

Auch abrufbar als: Unified diff