From 58fcb69f65a255c0db6741ca7aed0a695cae68c8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20K=C3=B6hler?= Date: Fri, 30 Dec 2005 12:47:55 +0000 Subject: [PATCH] =?utf8?q?Merge=20von=20711=20aus=20unstable:=20Bugfix=202?= =?utf8?q?33=20+=20format=5Famount=20Bug=20233:=20Neues=20Zahlenformat=20f?= =?utf8?q?=C3=BCr=20die=20Eingabe=20eingefuehrt.=20Es=20ist=20nun=20moegli?= =?utf8?q?ch=20das=20Eingabezahlenformat=20getrennt=20anzugeben.=20Entwede?= =?utf8?q?r=20Eingabeformat=20wie=20bisher=20(default)=20oder=20'1000.00?= =?utf8?q?=20oder=201000,00'.=20Die=20zweite=20Option=20verhindert=20bei?= =?utf8?q?=20der=20Eingabe=20die=20Verwechselung=20von=20','=20und=20'.'.?= =?utf8?q?=20Es=20ist=20nun=20egal=20welchen=20Dezimaltrenner=20man=20benu?= =?utf8?q?tzt,=20der=20erste=20Punkt=20oder=20Komma=20von=20rechts=20jeden?= =?utf8?q?falls=20wird=20als=20Dezimaltrenner=20verwendet,=20alle=20andere?= =?utf8?q?n=20Punkte=20oder=20Kommas=20werden=20einfach=20ignoriert,=20bzw?= =?utf8?q?.=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 ab334edcf..48b875a57 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1575,7 +1575,7 @@ sub config { ? "