Revision dbf2d709
Von Sven Schöling vor fast 2 Jahren hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
1642 | 1642 |
my $errors = []; |
1643 | 1643 |
my $db = $self->order->db; |
1644 | 1644 |
|
1645 |
# link records |
|
1646 |
if ($::form->{converted_from_oe_id}) { |
|
1647 |
my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id}; |
|
1648 |
set_record_link_conversions( |
|
1649 |
$self->order, |
|
1650 |
'SL::DB::Order' => \@converted_from_oe_ids, |
|
1651 |
'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids}, |
|
1652 |
); |
|
1653 |
} |
|
1654 |
if ($::form->{converted_from_reclamation_id}) { |
|
1655 |
my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id}; |
|
1656 |
set_record_link_conversions( |
|
1657 |
$self->order, |
|
1658 |
'SL::DB::Reclamation' => \@converted_from_reclamation_ids, |
|
1659 |
'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids}, |
|
1660 |
); |
|
1661 |
} |
|
1662 |
|
|
1645 | 1663 |
$db->with_transaction(sub { |
1646 | 1664 |
my $validity_token; |
1647 | 1665 |
if (!$self->order->id) { |
... | ... | |
1662 | 1680 |
SL::DB::DeliveryOrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete || []}; |
1663 | 1681 |
$self->order->save(cascade => 1); |
1664 | 1682 |
|
1665 |
# link records |
|
1666 |
if ($::form->{converted_from_oe_id}) { |
|
1667 |
my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id}; |
|
1668 |
set_record_link_conversions( |
|
1669 |
$self->order, |
|
1670 |
'SL::DB::Order' => \@converted_from_oe_ids, |
|
1671 |
'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids}, |
|
1672 |
); |
|
1673 |
} |
|
1674 |
if ($::form->{converted_from_reclamation_id}) { |
|
1675 |
my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id}; |
|
1676 |
set_record_link_conversions( |
|
1677 |
$self->order, |
|
1678 |
'SL::DB::Reclamation' => \@converted_from_reclamation_ids, |
|
1679 |
'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids}, |
|
1680 |
); |
|
1681 |
} |
|
1682 |
|
|
1683 | 1683 |
$self->save_history('SAVED'); |
1684 | 1684 |
|
1685 | 1685 |
$validity_token->delete if $validity_token; |
SL/Controller/Order.pm | ||
---|---|---|
2132 | 2132 |
$self->order->add_phone_notes($phone_note) if $is_new; |
2133 | 2133 |
} |
2134 | 2134 |
|
2135 |
my @converted_from_oe_ids; |
|
2136 |
if ($::form->{converted_from_oe_id}) { |
|
2137 |
@converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id}; |
|
2138 |
set_record_link_conversions( |
|
2139 |
$self->order, |
|
2140 |
'SL::DB::Order' => \@converted_from_oe_ids, |
|
2141 |
'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids}, |
|
2142 |
); |
|
2143 |
} |
|
2144 |
if ($::form->{converted_from_reclamation_id}) { |
|
2145 |
my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id}; |
|
2146 |
set_record_links_conversions( |
|
2147 |
$self->order, |
|
2148 |
'SL::DB::Reclamation' => \@converted_from_reclamation_ids, |
|
2149 |
'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids}, |
|
2150 |
); |
|
2151 |
} |
|
2152 |
|
|
2135 | 2153 |
$db->with_transaction(sub { |
2136 | 2154 |
my $validity_token; |
2137 | 2155 |
if (!$self->order->id) { |
... | ... | |
2155 | 2173 |
SL::DB::OrderVersion->new(oe_id => $self->order->id, version => 1)->save unless scalar @{ $self->order->order_version }; |
2156 | 2174 |
|
2157 | 2175 |
# link records |
2158 |
if ($::form->{converted_from_oe_id}) { |
|
2159 |
my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id}; |
|
2160 |
set_record_link_conversions( |
|
2161 |
$self->order, |
|
2162 |
'SL::DB::Order' => \@converted_from_oe_ids, |
|
2163 |
'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids}, |
|
2164 |
); |
|
2165 |
|
|
2176 |
if (@converted_from_oe_ids) { |
|
2166 | 2177 |
$self->link_requirement_specs_linking_to_created_from_objects(@converted_from_oe_ids); |
2167 | 2178 |
} |
2168 |
if ($::form->{converted_from_reclamation_id}) { |
|
2169 |
my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id}; |
|
2170 |
set_record_links_conversions( |
|
2171 |
$self->order, |
|
2172 |
'SL::DB::Reclamation' => \@converted_from_reclamation_ids, |
|
2173 |
'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids}, |
|
2174 |
); |
|
2175 |
} |
|
2176 | 2179 |
|
2177 | 2180 |
$self->set_project_in_linked_requirement_specs if $self->order->globalproject_id; |
2178 | 2181 |
|
Auch abrufbar als: Unified diff
RecordLink: in controller vor dem Speichern und ausserhalb der TX behandeln