]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Merge von 711 aus unstable: Bugfix 233 + format_amount
authorStephan Köhler <s.koehler@linet-services.de>
Fri, 30 Dec 2005 12:47:55 +0000 (12:47 +0000)
committerStephan Köhler <s.koehler@linet-services.de>
Fri, 30 Dec 2005 12:47:55 +0000 (12:47 +0000)
Bug 233: Neues Zahlenformat für die Eingabe eingefuehrt.
Es ist nun moeglich das Eingabezahlenformat getrennt anzugeben.
Entweder Eingabeformat wie bisher (default) oder '1000.00 oder 1000,00'.
Die zweite Option verhindert bei der Eingabe die Verwechselung von ',' und '.'.
Es ist nun egal welchen Dezimaltrenner man benutzt, der erste Punkt oder Komma
von rechts jedenfalls wird als Dezimaltrenner verwendet, alle anderen Punkte oder
Kommas werden einfach ignoriert, bzw. entfernt

SL/Form.pm
SL/User.pm
bin/mozilla/am.pl

index c5a30bf781fd2e6ba2f8bf854587b1a627dd322f..5fbed0d753ac360ad599d1bec60b4ba5f87a45c6 100644 (file)
@@ -590,19 +590,44 @@ sub parse_amount {
   $main::lxdebug->enter_sub();
 
   my ($self, $myconfig, $amount) = @_;
   $main::lxdebug->enter_sub();
 
   my ($self, $myconfig, $amount) = @_;
-
-  if (!(substr($amount, -3, 1) eq ".")) {
-    if (   ($myconfig->{numberformat} eq '1.000,00')
-        || ($myconfig->{numberformat} eq '1000,00')) {
-      $amount =~ s/\.//g;
-      $amount =~ s/,/\./;
-    }
-
-    $amount =~ s/,//g;
-  }
-
+  $main::lxdebug->message(LXDebug::DEBUG2, "Start amount: $amount");  
+  if ($myconfig->{in_numberformat} == 1){
+    # Extra input number format 1000.00 or 1000,00
+    $main::lxdebug->message(LXDebug::DEBUG2, "in_numberformat: " . $main::locale->text('1000,00 or 1000.00'));
+    $amount =~ s/,/\./g;
+    #$main::lxdebug->message(LXDebug::DEBUG2, "1.Parsed Number: $amount") if ($amount);
+    $amount = scalar reverse $amount;
+    #$main::lxdebug->message(LXDebug::DEBUG2, "2.Parsed Number: $amount") if ($amount);
+    $amount =~ s/\./DOT/;
+    #$main::lxdebug->message(LXDebug::DEBUG2, "3.Parsed Number: $amount") if ($amount);
+    $amount =~ s/\.//g;
+    #$main::lxdebug->message(LXDebug::DEBUG2, "4.Parsed Number: $amount") if ($amount);
+    $amount =~ s/DOT/\./;
+    #$main::lxdebug->message(LXDebug::DEBUG2, "5.Parsed Number:" . $amount) if ($amount);
+    $amount = scalar reverse $amount ;
+    $main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount . "\n");
+
+    return ($amount * 1);
+
+  }
+  $main::lxdebug->message(LXDebug::DEBUG2, "in_numberformat: " . $main::locale->text('equal Outputformat'));
+  $main::lxdebug->message(LXDebug::DEBUG2, " = numberformat: $myconfig->{numberformat}");
+  if (   ($myconfig->{numberformat} eq '1.000,00')
+      || ($myconfig->{numberformat} eq '1000,00')) {
+    $amount =~ s/\.//g;
+    $amount =~ s/,/\./;
+  }
+
+  if ($myconfig->{numberformat} eq "1'000.00") {
+      $amount =~ s/'//g;
+  }
+
+  $amount =~ s/,//g;
+  
+  $main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount. "\n") if ($amount);
   $main::lxdebug->leave_sub();
   $main::lxdebug->leave_sub();
-
+  
   return ($amount * 1);
 }
 
   return ($amount * 1);
 }
 
index 9fa0035c65678a89b6aeac48a1b69c62a4d2f2a2..bf649c8cd432664ad3b827d2b727cfb8fe260ae6 100644 (file)
@@ -839,7 +839,7 @@ sub config_vars {
 
   my @conf = qw(acs address admin businessnumber charset company countrycode
     currency dateformat dbconnect dbdriver dbhost dbport dboptions
 
   my @conf = qw(acs address admin businessnumber charset company countrycode
     currency dateformat dbconnect dbdriver dbhost dbport dboptions
-    dbname dbuser dbpasswd email fax name numberformat password
+    dbname dbuser dbpasswd email fax name numberformat in_numberformat password
     printer role sid signature stylesheet tel templates vclimit angebote bestellungen rechnungen
     anfragen lieferantenbestellungen einkaufsrechnungen steuernummer ustid duns menustyle);
 
     printer role sid signature stylesheet tel templates vclimit angebote bestellungen rechnungen
     anfragen lieferantenbestellungen einkaufsrechnungen steuernummer ustid duns menustyle);
 
index ab334edcf6969772e8302ce08c2ddf64b8bde916..48b875a577ddda58c4813fbc0134437967da9f9f 100644 (file)
@@ -1575,7 +1575,7 @@ sub config {
       ? "<option selected>$item\n"
       : "<option>$item\n";
   }
       ? "<option selected>$item\n"
       : "<option>$item\n";
   }
-
+  
   foreach $item (qw(name company address signature)) {
     $myconfig{$item} =~ s/\"/&quot;/g;
   }
   foreach $item (qw(name company address signature)) {
     $myconfig{$item} =~ s/\"/&quot;/g;
   }
@@ -1595,7 +1595,22 @@ sub config {
       : "<option value=$key>$countrycodes{$key}\n";
   }
   $countrycodes = "<option>American English\n$countrycodes";
       : "<option value=$key>$countrycodes{$key}\n";
   }
   $countrycodes = "<option>American English\n$countrycodes";
+  
+  # use an other input number format than output numberformat
+  # look at Form.pm, sub parse_amount
+  my $ in_numberformat = '';
+  $text1 = qq|value="0">| . $locale->text('equal Outputformat');
+  $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
+  @in_nf = ($text1, $text2);
+  foreach $item ( @in_nf ) {
+    $in_numberformat .=
+      ( substr($item, 7, 1) eq $myconfig{in_numberformat})
+      ? "<option selected $item\n"
+      : "<option $item\n";
+  }
+
 
 
+  
   foreach $key (keys %{ $form->{IC} }) {
     foreach $accno (sort keys %{ $form->{IC}{$key} }) {
       $myconfig{$key} .=
   foreach $key (keys %{ $form->{IC} }) {
     foreach $accno (sort keys %{ $form->{IC}{$key} }) {
       $myconfig{$key} .=
@@ -1676,9 +1691,14 @@ sub config {
          <td><select name=dateformat>$dateformat</select></td>
        </tr>
        <tr>
          <td><select name=dateformat>$dateformat</select></td>
        </tr>
        <tr>
-         <th align=right>| . $locale->text('Number Format') . qq|</th>
+         <th align=right>| . $locale->text('Output Number Format') . qq|</th>
          <td><select name=numberformat>$numberformat</select></td>
        </tr>
          <td><select name=numberformat>$numberformat</select></td>
        </tr>
+       <tr>
+         <th align=right>| . $locale->text('Input Number Format') . qq|</th>
+         <td><select name=in_numberformat>$in_numberformat</select></td>
+       </tr>
+
        <tr>
          <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
          <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
        <tr>
          <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
          <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>