FlattenToForm: Preis- und Rabatt-Quellen berücksichtigen.
[kivitendo-erp.git] / SL / DB / Helper / FlattenToForm.pm
index aea1a0d..6a0bdc2 100644 (file)
@@ -63,7 +63,8 @@ sub flatten_to_form {
     _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));
+                                                                           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));
@@ -94,10 +95,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}"} =                $::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;
-  map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 1, -2) : 0  } @columns if  $format_amounts == 4;
+  map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 1,  -2) : 0 } @columns if  $format_amounts == 4;
 
   return $src;
 }