Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2a8b6a74

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 2a8b6a74f3e8cbeeef1acc3f7292696db8096582
  • Vorgänger 22d2337c
  • Nachfolger 64b180ac

S:C:Record: Hole Typen aus Datenbankobjekt wenn ID gegeben

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1268 1268
sub init_type {
1269 1269
  my ($self) = @_;
1270 1270

  
1271
  if (none { $::form->{type} eq $_ } @{$self->valid_types}) {
1271
  my $type = $self->order->record_type;
1272
  if (none { $type eq $_ } @{$self->valid_types}) {
1272 1273
    die "Not a valid type for delivery order";
1273 1274
  }
1274 1275

  
1275
  $self->type($::form->{type});
1276
  $self->type($type);
1276 1277
}
1277 1278

  
1278 1279
sub init_cv {
......
1422 1423
    $order = SL::DB::DeliveryOrder->new(
1423 1424
      orderitems  => [],
1424 1425
      currency_id => $::instance_conf->get_currency_id(),
1425
      record_type => $self->type
1426
      record_type => $::form->{type}
1426 1427
    );
1427 1428
  }
1428 1429

  
1429
  my $cv_id_method = $self->cv . '_id';
1430
  my $cv_id_method = $order->type_data->properties('customervendor'). '_id';
1430 1431
  if (!$::form->{id} && $::form->{$cv_id_method}) {
1431 1432
    $order->$cv_id_method($::form->{$cv_id_method});
1432 1433
    $order = SL::Model::Record->update_after_customer_vendor_change($order);
......
2220 2221
}
2221 2222

  
2222 2223
sub init_type_data {
2223
  SL::DB::Helper::TypeDataProxy->new('SL::DB::DeliveryOrder', $::form->{type});
2224
  my ($self) = @_;
2225
  SL::DB::Helper::TypeDataProxy->new('SL::DB::DeliveryOrder', $self->order->record_type);
2224 2226
}
2225 2227

  
2226 2228
sub init_valid_types {
SL/Controller/Order.pm
1633 1633
sub init_type {
1634 1634
  my ($self) = @_;
1635 1635

  
1636
  if (none { $::form->{type} eq $_ } @{$self->valid_types}) {
1636
  my $type = $self->order->record_type;
1637
  if (none { $type eq $_ } @{$self->valid_types}) {
1637 1638
    die "Not a valid type for order";
1638 1639
  }
1639 1640

  
1640
  $self->type($::form->{type});
1641
  $self->type($type);
1641 1642
}
1642 1643

  
1643 1644
sub init_cv {
......
1848 1849
  my $order;
1849 1850
  $order   = SL::DB::Order->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
1850 1851
  $order ||= SL::DB::Order->new(orderitems  => [],
1851
                                record_type => $self->type,
1852
                                record_type => $::form->{type},
1852 1853
                                currency_id => $::instance_conf->get_currency_id(),);
1853 1854

  
1854
  my $cv_id_method = $self->cv . '_id';
1855
  my $cv_id_method = $order->type_data->properties('customervendor'). '_id';
1855 1856
  if (!$::form->{id} && $::form->{$cv_id_method}) {
1856 1857
    $order->$cv_id_method($::form->{$cv_id_method});
1857 1858
    $order = SL::Model::Record->update_after_customer_vendor_change($order);
......
2798 2799
}
2799 2800

  
2800 2801
sub init_type_data {
2801
  SL::DB::Helper::TypeDataProxy->new('SL::DB::Order', $::form->{type});
2802
  my ($self) = @_;
2803
  SL::DB::Helper::TypeDataProxy->new('SL::DB::Order', $self->order->record_type);
2802 2804
}
2803 2805

  
2804 2806
1;
SL/Controller/Reclamation.pm
1110 1110
sub init_type {
1111 1111
  my ($self) = @_;
1112 1112

  
1113
  if (none { $::form->{type} eq $_ } @{$self->valid_types}) {
1113
  my $type = $self->reclamation->record_type : $::form->{type};
1114
  if (none { $type eq $_ } @{$self->valid_types}) {
1114 1115
    die "Not a valid type for reclamation";
1115 1116
  }
1116 1117

  
1117
  $self->type($::form->{type});
1118
  $self->type($type);
1118 1119
}
1119 1120

  
1120 1121
sub init_cv {
......
1362 1363
    $reclamation = SL::DB::Reclamation->new(id => $::form->{id})->load();
1363 1364
  } else {
1364 1365
    $reclamation = SL::DB::Reclamation->new(
1365
                     record_type        => $self->type,
1366
                     record_type        => $::form->{type},
1366 1367
                     reclamation_items  => [],
1367 1368
                     currency_id => $::instance_conf->get_currency_id(),
1368 1369
                   );
1369 1370
  }
1370 1371

  
1371
  my $cv_id_method = $self->cv . '_id';
1372
  my $cv_id_method = $reclamation->type_data->properties('customervendor'). '_id';
1372 1373
  if (!$::form->{id} && $::form->{$cv_id_method}) {
1373 1374
    $reclamation->$cv_id_method($::form->{$cv_id_method});
1374 1375
    $reclamation = SL::Model::Record->update_after_customer_vendor_change($reclamation);
......
2365 2366
}
2366 2367

  
2367 2368
sub init_type_data {
2368
  SL::DB::Helper::TypeDataProxy->new('SL::DB::Reclamation', $::form->{type});
2369
  my ($self) = @_;
2370
  SL::DB::Helper::TypeDataProxy->new('SL::DB::Reclamation', $self->reclamation->record_type);
2369 2371
}
2370 2372

  
2371 2373
1;

Auch abrufbar als: Unified diff