Noch ein Fallback, falls $language wirklich nicht definiert sein sollte.
[kivitendo-erp.git] / bin / mozilla / is.pl
index 8c12493..459e1b9 100644 (file)
@@ -172,13 +172,13 @@ sub invoice_links {
   chomp $curr[0];
   $form->{defaultcurrency} = $curr[0];
 
-  map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
+  map { $form->{selectcurrency} .= "<option>$_</option>\n" } @curr;
 
   $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
 
   if (@{ $form->{all_customer} }) {
     $form->{customer} = "$form->{customer}--$form->{customer_id}";
-    map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
+    map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}</option>\n" }
       (@{ $form->{all_customer} });
   }
 
@@ -189,7 +189,7 @@ sub invoice_links {
 
     map {
       $form->{selectdepartment} .=
-        "<option>$_->{description}--$_->{id}\n"
+        "<option>$_->{description}--$_->{id}</option>\n"
     } (@{ $form->{all_departments} });
   }
 
@@ -198,7 +198,7 @@ sub invoice_links {
   # sales staff
   if ($form->{all_employees}) {
     $form->{selectemployee} = "";
-    map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
+    map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}</option>\n" }
       (@{ $form->{all_employees} });
   }
 
@@ -208,7 +208,8 @@ sub invoice_links {
 
   foreach $key (keys %{ $form->{AR_links} }) {
     foreach $ref (@{ $form->{AR_links}{$key} }) {
-      $form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}\n";
+      $form->{"select$key"} .=
+"<option>$ref->{accno}--$ref->{description}</option>\n";
     }
 
     if ($key eq "AR_paid") {
@@ -371,7 +372,8 @@ sub form_header {
                                    "old_id" => \@old_project_ids },
                    "employees" => "ALL_SALESMEN");
 
-  my (%labels, @values);
+  my %labels;
+  my @values = (undef);
   foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
     push(@values, $item->{"cp_id"});
     $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
@@ -432,6 +434,9 @@ sub form_header {
 
   #quote customer Bug 133
   $form->{selectcustomer} = $form->quote($form->{selectcustomer});
+
+  #substitute \n and \r to \s (bug 543)
+  $form->{selectcustomer} =~ s/[\n\r]/&nbsp;/g;
   
   if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
     $creditwarning = 1;
@@ -467,7 +472,10 @@ sub form_header {
 
   $customer =
     ($form->{selectcustomer})
-    ? qq|<select name="customer">$form->{selectcustomer}</select>\n<input type="hidden" name="selectcustomer" value="$form->{selectcustomer}">|
+    ? qq|<select name="customer"
+onchange="document.getElementById('update_button').click();">| .
+    qq|$form->{selectcustomer}</select>\n<input type="hidden" name="selectcustomer" value="| .
+    Q($form->{selectcustomer}) . qq|">|
     : qq|<input name="customer" value="$form->{customer}" size="35">|;
 
   $department = qq|
@@ -783,8 +791,7 @@ $jsscript
 <!-- shipto are in hidden variables -->
 | ;
 map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } 
-       qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry 
-          shiptocontact shiptophone shiptofax shiptoemail));
+       qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry  shiptocontact shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2));
 print qq|<!-- email variables --> |;
 map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } 
     qw(message email subject cc bcc taxaccounts));
@@ -1064,7 +1071,7 @@ if ($form->{type} eq "credit_note") {
     <td>
 |;
 
-  &print_options;
+  print_options();
 
   print qq|
     </td>
@@ -1617,11 +1624,20 @@ sub yes {
 sub e_mail {
   $lxdebug->enter_sub();
 
-  $print_post = 1;
+  if (!$form->{id}) {
+    $print_post = 1;
+
+    my $saved_form = save_form();
 
-  &post;
+    post();
+
+    my %saved_vars;
+    map({ $saved_vars{$_} = $form->{$_}; } qw(id invnumber));
+    restore_form($saved_form);
+    map({ $form->{$_} = $saved_vars{$_}; } qw(id invnumber));
+  }
 
-  &edit_e_mail;
+  edit_e_mail();
 
   $lxdebug->leave_sub();
 }