vclimit-Vergleich korrigiert
[kivitendo-erp.git] / bin / mozilla / oe.pl
index 640fb37..0a2c93d 100644 (file)
@@ -436,10 +436,11 @@ sub form_header {
   }
 
   my $vc = qq|
+      <input type="hidden" name="old$form->{vc}" value="| . H($form->{"old$form->{vc}"}) . qq|">
       <th align="right">| . $locale->text(ucfirst($form->{vc})) . qq|</th>
       <td>| . 
-        (($myconfig{vclimit} == 1 
-              ? qq|<input type="text" value="$form->{old$form->{vc}}" name="$form->{vc}">| 
+        (($myconfig{vclimit} <=  scalar(@values)
+              ? qq|<input type="text" value="| . H($form->{"old$form->{vc}"}) . qq|" name="$form->{vc}">| 
               : (NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"}, 
                              '-onChange' => 'document.getElementById(\'update_button\').click();',
                              '-values' => \@values, '-labels' => \%labels)))) . qq|
@@ -1927,6 +1928,10 @@ sub save_and_close {
     $form->isblank("transdate", $locale->text('Quotation Date missing!'));
   }
 
+  my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+  $form->{$idx} =~ s/^\s*//g;
+  $form->{$idx} =~ s/\s*$//g;
+
   $msg = ucfirst $form->{vc};
   $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
 
@@ -2018,6 +2023,10 @@ sub save {
     $form->isblank("transdate", $locale->text('Quotation Date missing!'));
   }
 
+  my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+  $form->{$idx} =~ s/^\s*//g;
+  $form->{$idx} =~ s/\s*$//g;
+
   $msg = ucfirst $form->{vc};
   $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
 
@@ -2495,6 +2504,8 @@ sub save_as_new {
   # Let Lx-Office assign a new order number if the user hasn't changed the
   # previous one. If it has been changed manually then use it as-is.
   my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+  $form->{$idx} =~ s/^\s*//g;
+  $form->{$idx} =~ s/\s*$//g;
   if ($form->{saved_xyznumber} &&
       ($form->{saved_xyznumber} eq $form->{$idx})) {
     delete($form->{$idx});