1 package SL::DB::Helpers::AttrPercent;
10 my $attribute = shift;
13 $params{places} = 2 if !defined($params{places});
18 sub ${attribute}_as_percent {
22 \$self->${attribute}(\$::form->parse_amount(\\\%::myconfig, \$_[0]) / 100);
25 return \$::form->format_amount(\\\%::myconfig, 100 * \$self->${attribute}, $params{places});
32 croak "Defining '${attribute}_as_number' failed: $EVAL_ERROR" if $EVAL_ERROR;