From: Moritz Bunkus Date: Mon, 16 May 2011 14:30:22 +0000 (+0200) Subject: _as_percent-Helper: Zwei Nachkommastellen anzeigen X-Git-Tag: release-2.6.3~25^2~27^2~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3782216af1ff4f28e79fae256a28d07a9399920d;p=kivitendo-erp.git _as_percent-Helper: Zwei Nachkommastellen anzeigen --- diff --git a/SL/DB/Helper/Attr.pm b/SL/DB/Helper/Attr.pm index 463bfd654..94b53dd7f 100644 --- a/SL/DB/Helper/Attr.pm +++ b/SL/DB/Helper/Attr.pm @@ -30,7 +30,7 @@ sub make { sub _make_by_type { my ($package, $name, $type) = @_; _as_number ($package, $name, places => -2) if $type =~ /numeric | real | float/xi; - _as_percent($package, $name, places => 0) if $type =~ /numeric | real | float/xi; + _as_percent($package, $name, places => 2) if $type =~ /numeric | real | float/xi; _as_number ($package, $name, places => 0) if $type =~ /int/xi; _as_date ($package, $name) if $type =~ /date | timestamp/xi; } diff --git a/t/helper/attr.t b/t/helper/attr.t index 4de1a53ff..cad0a0f9c 100644 --- a/t/helper/attr.t +++ b/t/helper/attr.t @@ -34,7 +34,7 @@ is($o->reqdate_as_date, '12.04.2010'); is($o->marge_percent_as_percent('40'), '40'); is($o->marge_percent, 0.40); is($o->marge_percent_as_percent, '40'); -is($o->marge_percent_as_percent('22,4'), '22'); +is($o->marge_percent_as_percent('22,4'), '22,40'); is($o->marge_percent, 0.224); is($o->marge_percent_as_percent, '22'); is($o->marge_percent(0.231), 0.231);