Überbleibsel von der Unterstützung für html2ps entfernt.
[kivitendo-erp.git] / bin / mozilla / oe.pl
index a70ab23..93f28f0 100644 (file)
@@ -171,11 +171,20 @@ sub edit {
   set_headings("edit");
 
   &order_links;
+
+  $form->{rowcount} = 0;
+  foreach $ref (@{ $form->{form_details} }) {
+    $form->{rowcount}++;
+    map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{$ref};
+  }
+
   &prepare_order;
+
   if ($form->{print_and_save}) {
     $form->{language_id} = $language_id;
     $form->{printer_id} = $printer_id;
   }
+
   &display_form;
 
   $lxdebug->leave_sub();
@@ -220,8 +229,11 @@ sub order_links {
   $form->{employee}    = "$form->{employee}--$form->{employee_id}";
 
   # build vendor/customer drop down comatibility... don't ask
-  $form->{"old$form->{vc}"} = $form->{vc};
-  $form->{"select$form->{vc}"} = 1;
+  if (@{ $form->{"all_$form->{vc}"} }) {
+    $form->{"select$form->{vc}"} = 1;
+    $form->{$form->{vc}}         = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
+  }
+  $form->{"old$form->{vc}"}    = $form->{$form->{vc}};
 
   $lxdebug->leave_sub();
 }
@@ -233,11 +245,6 @@ sub prepare_order {
 
   $form->{formname} ||= $form->{type};
 
-  $form->{rowcount} = 0;
-  foreach $ref (@{ $form->{form_details} }) {
-    $form->{rowcount}++;
-    map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{$ref};
-  }
   for my $i (1 .. $form->{rowcount}) {
     $form->{"reqdate_$i"} ||= $form->{"deliverydate_$i"};
     $form->{"discount_$i"}  = $form->format_amount(\%myconfig, $form->{"discount_$i"} * ($form->{id} ? 100 : 1));
@@ -388,7 +395,7 @@ sub form_header {
         max_dunning_level dunning_amount shiptoname shiptostreet shiptozipcode
         shiptocity shiptocountry shiptocontact shiptophone shiptofax
         shiptodepartment_1 shiptodepartment_2 shiptoemail
-        message email subject cc bcc taxpart taxservice taxaccounts),
+        message email subject cc bcc taxpart taxservice taxaccounts cursor_fokus),
         @custom_hiddens,
         map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} ];  # deleted: discount
 
@@ -1826,30 +1833,29 @@ sub poso {
   $form->{transdate} = $form->current_date(\%myconfig);
   delete $form->{duedate};
 
-  $form->{closed} = 0;
+  $form->{closed}          = 0;
 
   $form->{old_employee_id} = $form->{employee_id};
   $form->{old_salesman_id} = $form->{salesman_id};
 
   # reset
-  map { delete $form->{$_} }
-    qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
+  map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
 
   for $i (1 .. $form->{rowcount}) {
-    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 basefactor);
   }
 
+  my %saved_vars = map { $_ => $form->{$_} } grep { $form->{$_} } qw(currency);
+
   &order_links;
 
+  map { $form->{$_} = $saved_vars{$_} } keys %saved_vars;
+
   &prepare_order;
 
   # format amounts
   for $i (1 .. $form->{rowcount} - 1) {
-    map { $form->{"${_}_$i"} =~ s/\"/"/g }
-      qw(partnumber description unit);
+    map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit);
   }
 
   &update;