From 995e58424f9ed6d45ce5cd03ec8120f98c06df1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 7 Dec 2015 12:45:38 +0100 Subject: [PATCH] =?utf8?q?FlattenToForm:=20item=5Fids=20ber=C3=BCcksichtig?= =?utf8?q?en.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Helper/FlattenToForm.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SL/DB/Helper/FlattenToForm.pm b/SL/DB/Helper/FlattenToForm.pm index 6a0bdc232..8beccf22e 100644 --- a/SL/DB/Helper/FlattenToForm.pm +++ b/SL/DB/Helper/FlattenToForm.pm @@ -49,6 +49,11 @@ sub flatten_to_form { $form->{department} = $self->department->description if _has($self, 'department_id'); $form->{rowcount} = scalar(@{ $self->items }); + my $items_name = ref($self) eq 'SL::DB::Order' ? 'orderitems' + : ref($self) eq 'SL::DB::DeliveryOrder' ? 'delivery_order_items' + : ref($self) eq 'SL::DB::Invoice' ? 'invoice' + : ''; + my $idx = 0; my $format_amounts = $params{format_amounts} ? 1 : 0; my $format_notnull = $params{format_amounts} ? 2 : 0; @@ -60,6 +65,7 @@ sub flatten_to_form { $idx++; $form->{"partsgroup_${idx}"} = $item->part->partsgroup->partsgroup if _has($item->part, 'partsgroup_id'); + _copy($item, $form, "${items_name}_", "_${idx}", 0, qw(id)) if $items_name; _copy($item->part, $form, '', "_${idx}", 0, qw(id partnumber weight)); _copy($item->part, $form, '', "_${idx}", 0, qw(listprice)); _copy($item, $form, '', "_${idx}", 0, qw(description project_id ship serialnumber pricegroup_id ordnumber donumber cusordnumber unit -- 2.20.1