Vorlagenname werden in Zukunft nicht mehr _master.html als Postfix haben
[kivitendo-erp.git] / bin / mozilla / do.pl
index dd4d2d0..f7e859e 100644 (file)
@@ -235,6 +235,7 @@ sub prepare_order {
     $form->{"reqdate_$i"} = $form->{"deliverydate_$i"} unless $form->{"reqdate_$i"};
 
     $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
+    $form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces);
 
     (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
     $dec_qty = length $dec_qty;
@@ -374,6 +375,7 @@ sub update_delivery_order {
 
         $form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor};
         $form->{"sellprice_$i"}          = $form->format_amount(\%myconfig, $form->{"sellprice_$i"});
+        $form->{"lastcost_$i"}          = $form->format_amount(\%myconfig, $form->{"lastcost_$i"});
         $form->{"qty_$i"}                = $form->format_amount(\%myconfig, $form->{"qty_$i"});
       }
 
@@ -736,7 +738,7 @@ sub invoice {
       # und keinen anderen discount wert an $i ...
       $form->{"discount_$i"} ||= $form->{discount}*100; # ... nehmen wir den kundenrabatt
     }
-    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice basefactor);
+    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice lastcost basefactor);
   }
 
   $form->{type} = "invoice";
@@ -769,10 +771,15 @@ sub invoice {
     $form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
       unless $form->{"deliverydate_$i"};
 
+
     $form->{"sellprice_$i"} =
       $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
                            $decimalplaces);
 
+    $form->{"lastcost_$i"} =
+      $form->format_amount(\%myconfig, $form->{"lastcost_$i"},
+                           $decimalplaces);
+
     (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
     $dec_qty = length $dec_qty;
     $form->{"qty_$i"} =
@@ -1310,13 +1317,26 @@ sub transfer_out {
         my $pinfo = $part_info_map{$request->{parts_id}};
         my $binfo = $bin_info_map{$request->{bin_id}};
 
-        push @{ $form->{ERRORS} }, $locale->text("There is not enough available of '#1' at warehouse '#2', bin '#3', #4, #5, for the transfer of #6.",
-                                                 $pinfo->{description}, $binfo->{warehouse_description}, $binfo->{bin_description},
-                                                 $request->{chargenumber} ? $locale->text('chargenumber #1', $request->{chargenumber}) : $locale->text('no chargenumber'),
-                                                 $request->{bestbefore} ? $locale->text('bestbefore #1', $request->{bestbefore}) : $locale->text('no bestbefore'),
-                                                 $form->format_amount_units('amount'      => $request->{sum_base_qty},
-                                                                            'part_unit'   => $pinfo->{unit},
-                                                                            'conv_units'  => 'convertible_not_smaller'));
+        if ($main::show_best_before) {
+            push @{ $form->{ERRORS} }, $locale->text("There is not enough available of '#1' at warehouse '#2', bin '#3', #4, #5, for the transfer of #6.",
+                                                     $pinfo->{description},
+                                                     $binfo->{warehouse_description},
+                                                     $binfo->{bin_description},
+                                                     $request->{chargenumber} ? $locale->text('chargenumber #1', $request->{chargenumber}) : $locale->text('no chargenumber'),
+                                                     $request->{bestbefore} ? $locale->text('bestbefore #1', $request->{bestbefore}) : $locale->text('no bestbefore'),
+                                                     $form->format_amount_units('amount'      => $request->{sum_base_qty},
+                                                                                'part_unit'   => $pinfo->{unit},
+                                                                                'conv_units'  => 'convertible_not_smaller'));
+        } else {
+            push @{ $form->{ERRORS} }, $locale->text("There is not enough available of '#1' at warehouse '#2', bin '#3', #4, for the transfer of #5.",
+                                                     $pinfo->{description},
+                                                     $binfo->{warehouse_description},
+                                                     $binfo->{bin_description},
+                                                     $request->{chargenumber} ? $locale->text('chargenumber #1', $request->{chargenumber}) : $locale->text('no chargenumber'),
+                                                     $form->format_amount_units('amount'      => $request->{sum_base_qty},
+                                                                                'part_unit'   => $pinfo->{unit},
+                                                                                'conv_units'  => 'convertible_not_smaller'));
+        }
       }
     }