Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 58fcb69f

Von Stephan Köhler vor etwa 19 Jahren hinzugefügt

  • ID 58fcb69f65a255c0db6741ca7aed0a695cae68c8
  • Vorgänger a827857e
  • Nachfolger f2cdf023

Merge von 711 aus unstable: Bugfix 233 + format_amount
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

Unterschiede anzeigen:

SL/Form.pm
$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();
return ($amount * 1);
}
SL/User.pm
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);
bin/mozilla/am.pl
? "<option selected>$item\n"
: "<option>$item\n";
}
foreach $item (qw(name company address signature)) {
$myconfig{$item} =~ s/\"/&quot;/g;
}
......
: "<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} .=
......
<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>
<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>

Auch abrufbar als: Unified diff