X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FDB%2FHelpers%2FAttrPercent.pm;h=e4c44ae905b598e4adc583490c8d2e86b869a002;hb=cbbcefbbb1b2b58752bd9dd9d374c6092323ef27;hp=24f8164043f9453e2d76957e1df2bdd8f89e39ca;hpb=82515b2d93dc5632f24d6e0b6f8f05f3fd19fbb0;p=kivitendo-erp.git diff --git a/SL/DB/Helpers/AttrPercent.pm b/SL/DB/Helpers/AttrPercent.pm index 24f816404..e4c44ae90 100644 --- a/SL/DB/Helpers/AttrPercent.pm +++ b/SL/DB/Helpers/AttrPercent.pm @@ -12,24 +12,14 @@ sub define { $params{places} = 2 if !defined($params{places}); - my $code = <$attribute($::form->parse_amount(\%::myconfig, $string) / 100) if @_ > 1; - if (scalar \@_) { - \$self->${attribute}(\$::form->parse_amount(\\\%::myconfig, \$_[0]) / 100); - } - - return \$::form->format_amount(\\\%::myconfig, 100 * \$self->${attribute}, $params{places}); -} - -1; -CODE - - eval $code; - croak "Defining '${attribute}_as_number' failed: $EVAL_ERROR" if $EVAL_ERROR; + return $::form->format_amount(\%::myconfig, 100 * $self->$attribute, $params{places}); + }; return 1; }