Revision 3d7017ef
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
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; |
Auch abrufbar als: Unified diff
S:C:Record: Hole Typen aus Datenbankobjekt wenn ID gegeben