From abc941da2860a2ad1cb3f13c083dcd19fe435883 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Fri, 23 Dec 2005 11:48:38 +0000 Subject: [PATCH] =?utf8?q?Bug=20233:=20Neues=20Zahlenformat=20f=C3=BCr=20d?= =?utf8?q?ie=20Eingabe=20eingefuehrt.=20Es=20ist=20nun=20moeglich=20das=20?= =?utf8?q?Eingabezahlenformat=20getrennt=20anzugeben.=20Entweder=20Eingabe?= =?utf8?q?format=20wie=20bisher=20(default)=20oder=20'1000.00=20oder=20100?= =?utf8?q?0,00'.=20Die=20zweite=20Option=20verhindert=20bei=20der=20Eingab?= =?utf8?q?e=20die=20Verwechselung=20von=20','=20und=20'.'.=20Es=20ist=20nu?= =?utf8?q?n=20egal=20welchen=20Dezimaltrenner=20man=20benutzt,=20der=20ers?= =?utf8?q?te=20Punkt=20oder=20Komma=20von=20rechts=20jedenfalls=20wird=20a?= =?utf8?q?ls=20Dezimaltrenner=20verwendet,=20alle=20anderen=20Punkte=20ode?= =?utf8?q?r=20Kommas=20werden=20einfach=20ignoriert,=20bzw.=20entfernt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 49 +++++++++++++++++++++++++++++++++++------------ SL/User.pm | 2 +- bin/mozilla/am.pl | 24 +++++++++++++++++++++-- 3 files changed, 60 insertions(+), 15 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index c5a30bf78..5fbed0d75 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -590,19 +590,44 @@ sub parse_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(); - + return ($amount * 1); } diff --git a/SL/User.pm b/SL/User.pm index 9fa0035c6..bf649c8cd 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -839,7 +839,7 @@ sub config_vars { 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); diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 1f94d9e99..c936bc19b 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1607,7 +1607,7 @@ sub config { ? "