From: Sven Schöling Date: Fri, 14 Nov 2014 10:40:56 +0000 (+0100) Subject: FlattenToForm: Rabatte richtig formatieren X-Git-Tag: release-3.2.0beta~252 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fb742b355ca83bb1d7d9318faa500265f27fde3b;p=kivitendo-erp.git FlattenToForm: Rabatte richtig formatieren --- diff --git a/SL/DB/Helper/FlattenToForm.pm b/SL/DB/Helper/FlattenToForm.pm index 570724b64..1e6ab9bc6 100644 --- a/SL/DB/Helper/FlattenToForm.pm +++ b/SL/DB/Helper/FlattenToForm.pm @@ -54,6 +54,7 @@ sub flatten_to_form { my $idx = 0; my $format_amounts = $params{format_amounts} ? 1 : 0; my $format_notnull = $params{format_amounts} ? 2 : 0; + my $format_percent = $params{format_amounts} ? 3 : 0; foreach my $item (@{ $self->items_sorted }) { next if _has($item, 'assemblyitem'); @@ -65,7 +66,7 @@ sub flatten_to_form { _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_amounts, qw(qty sellprice marge_total marge_percent lastcost)); - _copy($item, $form, '', "_${idx}", $format_notnull, qw(discount)); + _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}"); @@ -86,9 +87,10 @@ sub _copy { @columns = grep { $src->can($_) } @columns; - map { $form->{"${prefix}${_}${postfix}"} = ref($src->$_) eq 'DateTime' ? $src->$_->to_lxoffice : $src->$_ } @columns if !$format_amounts; - map { $form->{"${prefix}${_}${postfix}"} = $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) } @columns if $format_amounts == 1; - map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) : 0 } @columns if $format_amounts == 2; + map { $form->{"${prefix}${_}${postfix}"} = ref($src->$_) eq 'DateTime' ? $src->$_->to_lxoffice : $src->$_ } @columns if !$format_amounts; + map { $form->{"${prefix}${_}${postfix}"} = $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) } @columns if $format_amounts == 1; + map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) : 0 } @columns if $format_amounts == 2; + map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 100, 2) : 0 } @columns if $format_amounts == 3; return $src; }