ic.pl auf use strict umgeschrieben (experimentell)
[kivitendo-erp.git] / bin / mozilla / oe.pl
index 10152d7..6ee8520 100644 (file)
@@ -324,6 +324,13 @@ sub form_header {
   my $checkedclosed = $form->{"closed"} ? "checked" : "";
   my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
 
+  if ($form->{old_employee_id}) {
+    $form->{employee_id} = $form->{old_employee_id};
+  }
+  if ($form->{old_salesman_id}) {
+    $form->{salesman_id} = $form->{old_salesman_id};
+  }
+
   map { $form->{$_} =~ s/\"/"/g }
     qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
        shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
@@ -1386,7 +1393,7 @@ sub search {
 
   $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
                                    "all" => 1 },
-                   "employees" => "ALL_EMPLOYEES",          
+                   "employees" => "ALL_EMPLOYEES",
                    $vc => "ALL_" . uc($vc));
 
   my %labels = ();
@@ -1401,18 +1408,19 @@ sub search {
 
   #employees
   %labels = ();
-  @values = ();
+  @values = ("");
   foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) {
     push(@values, $item->{"id"});
     $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"};
   }
 
-  my $employee = qq|
+  my $employee_block = qq|
     <tr>
       <th align="right">| . $locale->text('Employee') . qq|</th>
       <td>| .
-        NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
-                             '-values' => \@values, '-labels' => \%labels)) . qq|
+        NTI($cgi->popup_menu('-name'   => 'employee_id',
+                             '-values' => \@values,
+                             '-labels' => \%labels)) . qq|
       </td>
     </tr>|;
 
@@ -1457,7 +1465,7 @@ sub search {
           <th align=right>$ordlabel</th>
           <td colspan=3><input name="$ordnumber" size=20></td>
         </tr>
-  $employee
+  $employee_block
         <tr>
           <th align="right">| . $locale->text('Transaction description') . qq|</th>
           <td colspan="3"><input name="transaction_description" size=20></td>
@@ -1494,7 +1502,7 @@ sub search {
     . $locale->text('Required by') . qq|</td>
              </tr>
              <tr>
-               <td><input name="l_name" class=checkbox type=checkbox value=Y checked> ucfirst($form->{vc})</td>
+               <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vc_label</td>
                <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
                <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
     . $locale->text('Ship via') . qq|</td>
@@ -2179,6 +2187,9 @@ sub delete_order_quotation {
 sub invoice {
   $lxdebug->enter_sub();
 
+  $form->{old_employee_id} = $form->{employee_id};
+  $form->{old_salesman_id} = $form->{salesman_id};
+
   if ($form->{type} =~ /_order$/) {
 
     # these checks only apply if the items don't bring their own ordnumbers/transdates.
@@ -2230,6 +2241,7 @@ sub invoice {
     $exchangerate =
       $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
                                 $buysell);
+    print(STDERR "CURRENCY $form->{currency} DEFAULT: $form->{defaultcurrency} EXCHANGE $exchangerate\n");
 
     if (!$exchangerate) {
       &backorder_exchangerate($orddate, $buysell);
@@ -2620,6 +2632,9 @@ sub poso {
 
   $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);