X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FHelper%2FFlattenToForm.pm;h=969d6daf1a2ab298a35da36c5aa402d5377b20b7;hb=0310ce713a5de3a825e8e8f7b3a9a0476d9ee7f1;hp=83f36cde346488520324be44cef1bbf0d5925aaf;hpb=d0b6041775e664944a6228f2c99cb470dd69bb1f;p=kivitendo-erp.git diff --git a/SL/DB/Helper/FlattenToForm.pm b/SL/DB/Helper/FlattenToForm.pm index 83f36cde3..969d6daf1 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,14 +65,16 @@ sub flatten_to_form { $idx++; $form->{"partsgroup_${idx}"} = $item->part->partsgroup->partsgroup if _has($item->part, 'partsgroup_id'); - _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 - subtotal longdescription price_factor_id marge_price_factor approved_sellprice reqdate transdate)); - _copy($item, $form, '', "_${idx}", $format_noround, qw(qty sellprice)); - _copy($item, $form, '', "_${idx}", $format_amounts, qw(marge_total marge_percent lastcost)); - _copy($item, $form, '', "_${idx}", $format_percent, qw(discount)); - _copy($item->project, $form, 'project', "_${idx}", 0, qw(number description)) if _has($item, 'project_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 + subtotal longdescription price_factor_id marge_price_factor approved_sellprice reqdate transdate + active_price_source active_discount_source)); + _copy($item, $form, '', "_${idx}", $format_noround, qw(qty sellprice)); + _copy($item, $form, '', "_${idx}", $format_amounts, qw(marge_total marge_percent lastcost)); + _copy($item, $form, '', "_${idx}", $format_percent, qw(discount)); + _copy($item->project, $form, 'project', "_${idx}", 0, qw(number description)) if _has($item, 'project_id'); _copy_custom_variables($item, $form, 'ic_cvar_', "_${idx}");