Revision 35fd4233
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
32 | 32 |
use SL::DB::TransferType; |
33 | 33 |
use SL::DB::ValidityToken; |
34 | 34 |
use SL::DB::Warehouse; |
35 |
use SL::DB::Helper::RecordLink qw(set_record_link_conversions RECORD_ID RECORD_ITEM_ID);
|
|
35 |
use SL::DB::Helper::RecordLink qw(set_record_link_conversions RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
|
|
36 | 36 |
use SL::DB::Helper::TypeDataProxy; |
37 | 37 |
use SL::DB::Helper::Record qw(get_object_name_from_type get_class_from_type); |
38 | 38 |
use SL::DB::DeliveryOrder; |
... | ... | |
132 | 132 |
my $delivery_order = SL::Model::Record->new_from_workflow($record, $self->type, %flags); |
133 | 133 |
$self->order($delivery_order); |
134 | 134 |
|
135 |
if (ref($record) eq 'SL::DB::Reclamation') { |
|
136 |
$self->{converted_from_reclamation_id} = $delivery_order->{ RECORD_ID() }; |
|
137 |
$_ ->{converted_from_reclamation_items_id} = $_ ->{ RECORD_ITEM_ID() } for @{ $delivery_order->items_sorted }; |
|
138 |
} |
|
139 |
if (ref($record) eq 'SL::DB::Order') { |
|
140 |
$self->{converted_from_oe_id} = $delivery_order->{ RECORD_ID() }; |
|
141 |
$_ ->{converted_from_oe_items_id} = $_ ->{ RECORD_ITEM_ID() } for @{ $delivery_order->items_sorted }; |
|
142 |
} |
|
143 |
|
|
144 | 135 |
$self->action_add; |
145 | 136 |
} |
146 | 137 |
|
... | ... | |
1239 | 1230 |
|
1240 | 1231 |
$self->js |
1241 | 1232 |
->val('#id', $self->order->id) |
1242 |
->val('#converted_from_oe_id', '')
|
|
1243 |
->val('#converted_from_reclamation_id', '')
|
|
1233 |
->val('#converted_from_record_type_ref', '')
|
|
1234 |
->val('#converted_from_record_id', '')
|
|
1244 | 1235 |
->val('#order_' . $self->nr_key(), $self->order->number); |
1245 | 1236 |
|
1246 | 1237 |
my $idx = 0; |
... | ... | |
1257 | 1248 |
} continue { |
1258 | 1249 |
$idx++; |
1259 | 1250 |
} |
1260 |
$self->js->val('[name="converted_from_orderitems_ids[+]"]', '');
|
|
1261 |
$self->js->val('[name="converted_from_reclamation_items_ids[+]"]', '');
|
|
1251 |
$self->js->val('[name="converted_from_record_item_type_refs[+]"]', '');
|
|
1252 |
$self->js->val('[name="converted_from_record_item_ids[+]"]', '');
|
|
1262 | 1253 |
} |
1263 | 1254 |
|
1264 | 1255 |
# |
... | ... | |
1650 | 1641 |
sub save { |
1651 | 1642 |
my ($self) = @_; |
1652 | 1643 |
|
1653 |
# link records |
|
1654 |
if ($::form->{converted_from_oe_id}) { |
|
1655 |
my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id}; |
|
1656 |
set_record_link_conversions( |
|
1657 |
$self->order, |
|
1658 |
'SL::DB::Order' => \@converted_from_oe_ids, |
|
1659 |
'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids}, |
|
1660 |
); |
|
1661 |
} |
|
1662 |
if ($::form->{converted_from_reclamation_id}) { |
|
1663 |
my @converted_from_reclamation_ids = |
|
1664 |
split ' ', $::form->{converted_from_reclamation_id}; |
|
1665 |
set_record_link_conversions( |
|
1666 |
$self->order, |
|
1667 |
'SL::DB::Reclamation' => \@converted_from_reclamation_ids, |
|
1668 |
'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids}, |
|
1669 |
); |
|
1670 |
} |
|
1644 |
set_record_link_conversions($self->order, |
|
1645 |
delete $::form->{RECORD_TYPE_REF()} |
|
1646 |
=> delete $::form->{RECORD_ID()}, |
|
1647 |
delete $::form->{RECORD_ITEM_TYPE_REF()} |
|
1648 |
=> delete $::form->{RECORD_ITEM_ID()}, |
|
1649 |
); |
|
1671 | 1650 |
|
1672 | 1651 |
my $items_to_delete = scalar @{ $self->item_ids_to_delete || [] } |
1673 | 1652 |
? SL::DB::Manager::DeliveryOrderItem->get_all(where => [id => $self->item_ids_to_delete]) |
Auch abrufbar als: Unified diff
DeliveryOrder: Nutze Type und ID zum Erstellen von verknüpften Belegen