Upgradescripte für auth.* nur ausführen, wenn Authentifizierungstabellen bereits...
[kivitendo-erp.git] / bin / mozilla / is.pl
index a94a720..7ac9f4d 100644 (file)
@@ -155,14 +155,6 @@ sub invoice_links {
     $ref->{name} = $form->quote($ref->{name});
   }
 
-  # Load data for a specific order and update form fields
-  my $order_data = OE->get_order_data_by_ordnumber(%$form) if $form->{ordnumber};
-
-  # Copy the fields we need to %form
-  for my $key (qw(payment_id salesman_id orddate taxzone_id quonumber)) {
-    $form->{$key} = $order_data->{$key};
-  }
-
   $form->restore_vars(qw(id));
 
   IS->retrieve_invoice(\%myconfig, \%$form);
@@ -266,6 +258,8 @@ sub prepare_invoice {
 
       $form->{"qty_$i"}        = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
 
+      $form->{"sellprice_pg_$i"} = join ('--', $form->{"sellprice_$i"}, $form->{"pricegroup_id_$i"});
+
       $form->{rowcount}        = $i;
 
     }
@@ -511,7 +505,11 @@ sub update {
 
     my $rows = scalar @{ $form->{item_list} };
 
-    $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{customer_discount} * 100);
+    # Falls kein Kundenrabatt vorhanden ist, den aktuellen Rabatt nicht mit 0% überschreiben,
+    # da hier der Anwender schon manual einen Wert eingetragen haben könnte (analog zu qty) Bugfix: 1412
+    if ($form->{customer_discount}){
+      $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{customer_discount} * 100);
+    }
 
     if ($rows) {
       $form->{"qty_$i"} = ($form->{"qty_$i"} * 1) ? $form->{"qty_$i"} : 1;