1 package SL::Template::Plugin::LxERP;
3 use base qw( Template::Plugin );
6 use List::Util qw(min);
18 my ($self, $var, $places, $skip_zero, $dash) = @_;
20 return $main::form->format_amount(\%main::myconfig, $var * 1, $places, $dash) unless $skip_zero && $var == 0;
24 sub format_amount_units {
25 my ($self, $amount, $amount_unit, $part_unit) = @_;
27 return $main::form->format_amount_units('amount' => $amount,
28 'part_unit' => $part_unit,
29 'amount_unit' => $amount_unit,
30 'conv_units' => 'convertible_not_smaller');
34 my ($self, $var, $places, $skip_zero) = @_;
36 return $self->format_amount($var * 100, $places, $skip_zero);
40 my ($self, $var) = @_;
52 return $main::form->format_string($string, @_);
58 return $main::form->numtextrows(@_);
63 my $word = shift || "";
65 return join '<br>', map { $main::locale->quote_special_chars('HTML', $_) } split(m//, $word);
76 $args->{split_by} ||= 'chars';
77 $args->{class} = " class=\"$args->{class}\"" if ($args->{class});
79 if ($args->{split_by} eq 'words') {
80 my @words = split m/\s+/, $word;
82 if (1 >= scalar @words) {
83 return $self->_turn90_word($words[0]);
86 return qq|<table><tr>| . join('', map { '<td valign="bottom"' . $args->{class} . '>' . $self->_turn90_word($_) . '</td>' } @words) . qq|</tr></table>|;
89 return $self->_turn90_word($word);
97 return $var < 0 ? $var * -1 : $var;