From 3782216af1ff4f28e79fae256a28d07a9399920d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 16 May 2011 16:30:22 +0200 Subject: [PATCH] _as_percent-Helper: Zwei Nachkommastellen anzeigen --- SL/DB/Helper/Attr.pm | 2 +- t/helper/attr.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); -- 2.20.1