Revision c0e77bf9
Von Bernd Bleßmann vor etwa 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
30 | 30 |
use SL::DB::Language; |
31 | 31 |
use SL::DB::Reclamation; |
32 | 32 |
use SL::DB::RecordLink; |
33 |
use SL::DB::RequirementSpec; |
|
34 | 33 |
use SL::DB::Shipto; |
35 | 34 |
use SL::DB::Translation; |
36 | 35 |
use SL::DB::ValidityToken; |
... | ... | |
2160 | 2159 |
delete_custom_shipto => $self->is_custom_shipto_to_delete || $self->order->custom_shipto->is_empty, |
2161 | 2160 |
items_to_delete => $items_to_delete, |
2162 | 2161 |
history => { snumbers => $self->get_history_snumbers() }, |
2162 |
link_requirement_specs_linking_to_created_from_objects => \@converted_from_oe_ids, |
|
2163 |
set_project_in_linked_requirement_specs => 1, |
|
2163 | 2164 |
); |
2164 | 2165 |
|
2165 | 2166 |
if ($is_new && $self->order->is_sales) { |
... | ... | |
2877 | 2878 |
return @errors; |
2878 | 2879 |
} |
2879 | 2880 |
|
2880 |
sub link_requirement_specs_linking_to_created_from_objects { |
|
2881 |
my ($self, @converted_from_oe_ids) = @_; |
|
2882 |
|
|
2883 |
return unless @converted_from_oe_ids; |
|
2884 |
|
|
2885 |
my $rs_orders = SL::DB::Manager::RequirementSpecOrder->get_all(where => [ order_id => \@converted_from_oe_ids ]); |
|
2886 |
foreach my $rs_order (@{ $rs_orders }) { |
|
2887 |
SL::DB::RequirementSpecOrder->new( |
|
2888 |
order_id => $self->order->id, |
|
2889 |
requirement_spec_id => $rs_order->requirement_spec_id, |
|
2890 |
version_id => $rs_order->version_id, |
|
2891 |
)->save; |
|
2892 |
} |
|
2893 |
} |
|
2894 |
|
|
2895 |
sub set_project_in_linked_requirement_specs { |
|
2896 |
my ($self) = @_; |
|
2897 |
|
|
2898 |
my $rs_orders = SL::DB::Manager::RequirementSpecOrder->get_all(where => [ order_id => $self->order->id ]); |
|
2899 |
foreach my $rs_order (@{ $rs_orders }) { |
|
2900 |
next if $rs_order->requirement_spec->project_id == $self->order->globalproject_id; |
|
2901 |
|
|
2902 |
$rs_order->requirement_spec->update_attributes(project_id => $self->order->globalproject_id); |
|
2903 |
} |
|
2904 |
} |
|
2905 |
|
|
2906 | 2881 |
1; |
2907 | 2882 |
|
2908 | 2883 |
__END__ |
Auch abrufbar als: Unified diff
Order-Controller: Pflichtenheft: Verknüpfungen und Projekt setzen
über Model::Record