Revision 08fe8308
Von Sven Schöling vor mehr als 1 Jahr 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 | ||
---|---|---|
2172 | 2172 |
$self->order->add_phone_notes($phone_note) if $is_new; |
2173 | 2173 |
} |
2174 | 2174 |
|
2175 |
my @converted_from_oe_ids; |
|
2176 |
if ($::form->{converted_from_oe_id}) { |
|
2177 |
@converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id}; |
|
2178 |
set_record_link_conversions( |
|
2179 |
$self->order, |
|
2180 |
'SL::DB::Order' => \@converted_from_oe_ids, |
|
2181 |
'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids}, |
|
2182 |
); |
|
2183 |
} |
|
2184 |
if ($::form->{converted_from_reclamation_id}) { |
|
2185 |
my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id}; |
|
2186 |
set_record_links_conversions( |
|
2187 |
$self->order, |
|
2188 |
'SL::DB::Reclamation' => \@converted_from_reclamation_ids, |
|
2189 |
'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids}, |
|
2190 |
); |
|
2191 |
} |
|
2192 |
|
|
2175 | 2193 |
$db->with_transaction(sub { |
2176 | 2194 |
my $validity_token; |
2177 | 2195 |
if (!$self->order->id) { |
... | ... | |
2195 | 2213 |
SL::DB::OrderVersion->new(oe_id => $self->order->id, version => 1)->save unless scalar @{ $self->order->order_version }; |
2196 | 2214 |
|
2197 | 2215 |
# link records |
2198 |
if ($::form->{converted_from_oe_id}) { |
|
2199 |
my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id}; |
|
2200 |
set_record_link_conversions( |
|
2201 |
$self->order, |
|
2202 |
'SL::DB::Order' => \@converted_from_oe_ids, |
|
2203 |
'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids}, |
|
2204 |
); |
|
2205 |
|
|
2216 |
if (@converted_from_oe_ids) { |
|
2206 | 2217 |
$self->link_requirement_specs_linking_to_created_from_objects(@converted_from_oe_ids); |
2207 | 2218 |
} |
2208 |
if ($::form->{converted_from_reclamation_id}) { |
|
2209 |
my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id}; |
|
2210 |
set_record_links_conversions( |
|
2211 |
$self->order, |
|
2212 |
'SL::DB::Reclamation' => \@converted_from_reclamation_ids, |
|
2213 |
'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids}, |
|
2214 |
); |
|
2215 |
} |
|
2216 | 2219 |
|
2217 | 2220 |
$self->set_project_in_linked_requirement_specs if $self->order->globalproject_id; |
2218 | 2221 |
|
Auch abrufbar als: Unified diff
RecordLink: in controller vor dem Speichern und ausserhalb der TX behandeln