1 package SL::DB::Helpers::AttrPercent;
10 my $attribute = shift;
13 $params{places} = 2 if !defined($params{places});
16 *{ $package . '::' . $attribute . '_as_percent' } = sub {
17 my ($self, $string) = @_;
19 $self->$attribute($::form->parse_amount(\%::myconfig, $string) / 100) if @_ > 1;
21 return $::form->format_amount(\%::myconfig, 100 * $self->$attribute, $params{places});