Revision d2e545ba
Von Tamino Steinert vor mehr als 2 Jahren hinzugefügt
| SL/Controller/DeliveryOrder.pm | ||
|---|---|---|
|
|
||
|
require SL::DB::Reclamation;
|
||
|
my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load;
|
||
|
my ($delivery_order, $error) = $reclamation->convert_to_delivery_order();
|
||
|
if($error) {
|
||
|
croak("Error while converting: " . $error);
|
||
|
}
|
||
|
|
||
|
my $delivery_order = SL::DB::DeliveryOrder->new_from($reclamation);
|
||
|
$self->{converted_from_reclamation_id} = $::form->{from_id};
|
||
|
$self->order($delivery_order);
|
||
|
|
||
|
$self->action_add;
|
||
| ... | ... | |
|
$self->js
|
||
|
->val('#id', $self->order->id)
|
||
|
->val('#converted_from_oe_id', '')
|
||
|
->val('#converted_from_reclamation_id', '')
|
||
|
->val('#order_' . $self->nr_key(), $self->order->number);
|
||
|
|
||
|
my $idx = 0;
|
||
| ... | ... | |
|
$idx++;
|
||
|
}
|
||
|
$self->js->val('[name="converted_from_orderitems_ids[+]"]', '');
|
||
|
$self->js->val('[name="converted_from_reclamation_items_ids[+]"]', '');
|
||
|
}
|
||
|
|
||
|
#
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
}
|
||
|
if ($::form->{converted_from_reclamation_id}) {
|
||
|
my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id};
|
||
|
foreach my $converted_from_reclamation_id (@converted_from_reclamation_ids) {
|
||
|
my $src = SL::DB::Reclamation->new(id => $converted_from_reclamation_id)->load;
|
||
|
$src->link_to_record($self->order);
|
||
|
}
|
||
|
if (scalar @{ $::form->{converted_from_reclamation_items_ids} || [] }) {
|
||
|
my $idx = 0;
|
||
|
foreach (@{ $self->order->items_sorted }) {
|
||
|
my $from_id = $::form->{converted_from_reclamation_items_ids}->[$idx];
|
||
|
next if !$from_id;
|
||
|
SL::DB::RecordLink->new(from_table => 'reclamation_items',
|
||
|
from_id => $from_id,
|
||
|
to_table => 'orderitems',
|
||
|
to_id => $_->id
|
||
|
)->save;
|
||
|
$idx++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$self->save_history('SAVED');
|
||
|
|
||
| templates/webpages/delivery_order/form.html | ||
|---|---|---|
|
[% L.hidden_tag('type', FORM.type) %]
|
||
|
[% L.hidden_tag('id', SELF.order.id) %]
|
||
|
[% L.hidden_tag('converted_from_oe_id', SELF.converted_from_oe_id) %]
|
||
|
[% L.hidden_tag('converted_from_reclamation_id', SELF.converted_from_reclamation_id) %]
|
||
|
|
||
|
[%- INCLUDE 'common/flash.html' %]
|
||
|
|
||
| templates/webpages/delivery_order/tabs/_row.html | ||
|---|---|---|
|
[%- END %]
|
||
|
[% L.hidden_tag("orderitem_ids[+]", ID) %]
|
||
|
[% L.hidden_tag("converted_from_orderitems_ids[+]", ITEM.converted_from_orderitems_id) %]
|
||
|
[% L.hidden_tag("converted_from_reclamation_items_ids[+]", ITEM.converted_from_reclamation_items_id) %]
|
||
|
[% L.hidden_tag("order.orderitems[+].id", ITEM.id, id='item_' _ ID) %]
|
||
|
[% L.hidden_tag("order.orderitems[].stock_info", ITEM.stock_info, class="data-stock-info") %]
|
||
|
[% L.hidden_tag("order.orderitems[].parts_id", ITEM.parts_id) %]
|
||
Auch abrufbar als: Unified diff
Reclamation: don't save delivery_order after converting