Merge von 829,831 aus unstable: Bugfix 270
authorStephan Köhler <s.koehler@linet-services.de>
Thu, 26 Jan 2006 14:37:26 +0000 (14:37 +0000)
committerStephan Köhler <s.koehler@linet-services.de>
Thu, 26 Jan 2006 14:37:26 +0000 (14:37 +0000)
Rabatt wurde fehlerhaft uebernommen beim Umwandeln von Angebot in Auftrag. Fixes Bug#270
Bei der Umwandlung von Angeboten/Anfragen in Auftraege wurden verschiedene Felder beschnitten/flasch formatiert

bin/mozilla/oe.pl

index e05d013..f9907cb 100644 (file)
@@ -229,11 +229,14 @@ sub prepare_order {
 
       map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
     }
-    
     for my $i (1 .. $form->{rowcount}) {
-       $form->{"discount_$i"} =
-        $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
-
+      if ($form->{id}) {
+        $form->{"discount_$i"} =
+          $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
+      } else {
+        $form->{"discount_$i"} =
+          $form->format_amount(\%myconfig, $form->{"discount_$i"});
+      }
       ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);    
       $dec           = length $dec;
       $decimalplaces = ($dec > 2) ? $dec : 2;
@@ -243,7 +246,7 @@ sub prepare_order {
 
       $form->{"sellprice_$i"} =
         $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
-                             $decimalplaces);
+                            $decimalplaces);
       
       (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
       $dec_qty      = length $dec_qty;
@@ -831,10 +834,15 @@ Bearbeiten des $form->{heading}<br>
       . $locale->text('Save as new') . qq|">
 <input class=submit type=submit name=action value="|
       . $locale->text('Delete') . qq|">|;
-    if ($form->{type} =~ /quotation$/) {
+    if ($form->{type} =~ /sales_quotation$/) {
       print qq|
 <input class=submit type=submit name=action value="|
-        . $locale->text('Order') . qq|">|;
+        . $locale->text('Sales Order') . qq|">|;
+    }
+    if ($form->{type} =~ /request_quotation$/) {
+      print qq|
+<input class=submit type=submit name=action value="|
+        . $locale->text('Purchase Order') . qq|">|;
     }
     print qq|
 <input class=submit type=submit name=action value="|
@@ -2100,6 +2108,15 @@ sub save_as_new {
 sub purchase_order {
   $lxdebug->enter_sub();
 
+  if (   $form->{type} eq 'sales_quotation'
+      || $form->{type} eq 'request_quotation') {
+    $form->{closed} = 1;
+    OE->save(\%myconfig, \%$form);
+  }
+
+  ($null, $form->{cp_id}) = split /--/, $form->{contact};
+  $form->{cp_id} *= 1;
+
   $form->{title} = $locale->text('Add Purchase Order');
   $form->{vc}    = "vendor";
   $form->{type}  = "purchase_order";