]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Listenpreis in Belegen u. Ausdruck richtig formatieren und nicht mehr parsen.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Sun, 24 May 2015 10:04:10 +0000 (12:04 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 25 May 2015 13:34:40 +0000 (15:34 +0200)
listprice wird in den Belegen nur angezeigt. Man kann ihn nicht eingeben und
auch nicht speichern. Deshalb wird er jetzt nur zur Ausgabe formatiert
(io.pl:display_row, OE.pm:order_details, IS.pm:invoice_details), aber nicht
formatiert gespeichert.
io.pl:display_row schreibt ihn auch unformatiert als hidden in die Form.

Das war wohl so gedacht, aber nicht konsequent eingehalten und auch von mir an
einigen Stellen "verschlimmbessert" worden.

Evtl. sollte der listprice gar nicht als hidden mitgeschliffen werden, sondern
immer aus der DB gelesen werden.

behebt #46 (redmine)

SL/DB/Helper/FlattenToForm.pm
SL/IS.pm
SL/OE.pm
bin/mozilla/do.pl
bin/mozilla/io.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl

index 4dca557f903ecc51e57d2e5f4cf1a3061674c3dd..9c34958c86d46daca56adc45e3c4fff208289966 100644 (file)
@@ -62,7 +62,7 @@ sub flatten_to_form {
 
     $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}", $format_amounts, qw(listprice));
+    _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_amounts, qw(qty sellprice marge_total marge_percent lastcost));
index 7bc724b90408998fce6e5a6dcc8d7d5461b48b85..fda5070d34031b71122107a269fdda16d7a67ff4 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -220,7 +220,8 @@ sub invoice_details {
       push @{ $form->{TEMPLATE_ARRAYS}->{price_factor_name} }, $price_factor->{description};
       push @{ $form->{TEMPLATE_ARRAYS}->{partsgroup} },        $form->{"partsgroup_$i"};
       push @{ $form->{TEMPLATE_ARRAYS}->{reqdate} },           $form->{"reqdate_$i"};
-      push(@{ $form->{TEMPLATE_ARRAYS}->{listprice} },         $form->{"listprice_$i"});
+      push @{ $form->{TEMPLATE_ARRAYS}->{listprice} },         $form->format_amount($myconfig, $form->{"listprice_$i"}, 2);
+      push(@{ $form->{TEMPLATE_ARRAYS}->{listprice_nofmt} },   $form->{"listprice_$i"});
 
       my $sellprice     = $form->parse_amount($myconfig, $form->{"sellprice_$i"});
       my ($dec)         = ($sellprice =~ /\.(\d+)/);
index 8430e2aa472a310fb4bf007f733cefff34295da9..dc21c51ef0a0f4d16a92a0408825bb8bc206e2b0 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -1295,7 +1295,8 @@ sub order_details {
       push @{ $form->{TEMPLATE_ARRAYS}->{reqdate} },           $form->{"reqdate_$i"};
       push @{ $form->{TEMPLATE_ARRAYS}->{sellprice} },         $form->{"sellprice_$i"};
       push @{ $form->{TEMPLATE_ARRAYS}->{sellprice_nofmt} },   $form->parse_amount($myconfig, $form->{"sellprice_$i"});
-      push @{ $form->{TEMPLATE_ARRAYS}->{listprice} },         $form->{"listprice_$i"};
+      push @{ $form->{TEMPLATE_ARRAYS}->{listprice} },         $form->format_amount($myconfig, $form->{"listprice_$i"}, 2);
+      push @{ $form->{TEMPLATE_ARRAYS}->{listprice_nofmt} },   $form->{"listprice_$i"};
       push @{ $form->{TEMPLATE_ARRAYS}->{price_factor} },      $price_factor->{formatted_factor};
       push @{ $form->{TEMPLATE_ARRAYS}->{price_factor_name} }, $price_factor->{description};
       push @{ $form->{TEMPLATE_ARRAYS}->{partsgroup} },        $form->{"partsgroup_$i"};
index 33ab98c016dfef0b4abf671e430f7c8b7ce5657a..764a84d71192b8c5be97301084986eac53c6bed6 100644 (file)
@@ -820,7 +820,7 @@ sub invoice {
         }
       }
     }
-    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice lastcost basefactor);
+    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice lastcost basefactor);
     $form->{"donumber_$i"} = $form->{donumber};
     $form->{"converted_from_delivery_order_items_id_$i"} = delete $form->{"delivery_order_items_id_$i"};
   }
index 12bc4ae6ce44f13a2899fbc3c2dd9436a9ca21e0..c511893304926bd3650cb18400491732edb496d4 100644 (file)
@@ -420,8 +420,6 @@ sub display_row {
                    $locale->text('EK'), $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces) }
       if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ ||  $form->{type} =~ /invoice/ || $form->{type} =~ /^credit_note$/ ) && !$is_delivery_order;
 
-    $form->{"listprice_$i"} = $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2)
-      if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ ||  $form->{type} =~ /invoice/) ;
 # / marge calculations ending
 
 # Calculate total weight
@@ -557,7 +555,7 @@ sub item_selected {
   }
 
   map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
-    qw(sellprice listprice weight);
+    qw(sellprice weight);
 
   if ( $mode eq 'IC' ) {
     # assembly mode:
@@ -667,7 +665,7 @@ sub item_selected {
     map {
       $form->{"${_}_$i"} =
           $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces)
-    } qw(sellprice listprice lastcost qty) if $form->{item} ne 'assembly';
+    } qw(sellprice lastcost qty) if $form->{item} ne 'assembly';
     $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100.0) if $form->{item} ne 'assembly';
 
     delete $form->{nextsub};
@@ -728,7 +726,7 @@ sub check_form {
     #$form->{sellprice} = 0;
     $form->{weight}    = 0;
     map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
-      qw(listprice sellprice rop stock);
+      qw(sellprice rop stock);
 
     my @flds = qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost);
 
@@ -934,7 +932,7 @@ sub order {
   for my $i (1 .. $form->{rowcount}) {
     map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"})
             if ($form->{"${_}_${i}"}) }
-        qw(ship qty sellprice listprice basefactor discount));
+        qw(ship qty sellprice basefactor discount));
     $form->{"converted_from_invoice_id_$i"} = delete $form->{"invoice_id_$i"};
   }
 
@@ -1002,7 +1000,7 @@ sub quotation {
     map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
                                                      $form->{"${_}_${i}"})
             if ($form->{"${_}_${i}"}) }
-        qw(ship qty sellprice listprice basefactor discount lastcost));
+        qw(ship qty sellprice basefactor discount lastcost));
   }
 
   &prepare_order;
index a4f9e85b9d7415cb52c85ea316121eb85ffdc0cc..a83f7718082ced86e42c65d66d04669604cb9e09 100644 (file)
@@ -1019,11 +1019,6 @@ sub credit_note {
 #  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
 #    qw(creditlimit creditremaining);
 
-  for my $i (1 .. $form->{rowcount}) {
-    for (qw(listprice)) {
-      $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"};
-    }
-  }
   # set new persistent ids for credit note and link previous invoice id
   $form->{"converted_from_invoice_id_$_"} = delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
 
index 9d297b8ae5be8aafd95fffb0aa7f7bcf2f9ac565..5984c859a403217c36a85e41df2e7ba5eb6c3fd6 100644 (file)
@@ -1445,7 +1445,7 @@ sub invoice {
   $form->{cp_id} *= 1;
 
   for my $i (1 .. $form->{rowcount}) {
-    for (qw(ship qty sellprice listprice basefactor)) {
+    for (qw(ship qty sellprice basefactor)) {
       $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"};
     }
     $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"};
@@ -1847,7 +1847,7 @@ sub poso {
   };
 
   for my $i (1 .. $form->{rowcount}) {
-    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount lastcost);
+    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice basefactor discount lastcost);
   }
 
   my %saved_vars = map { $_ => $form->{$_} } grep { $form->{$_} } qw(currency);
@@ -1909,7 +1909,7 @@ sub delivery_order {
   delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)};
 
   for my $i (1 .. $form->{rowcount}) {
-    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice lastcost basefactor discount);
+    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice lastcost basefactor discount);
     $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"};
   }