1 package SL::Template::Plugin::LxERP;
3 use base qw( Template::Plugin );
6 use List::Util qw(min);
20 my ($self, $var, $places, $skip_zero, $dash) = @_;
22 return $main::form->format_amount(\%main::myconfig, $var * 1, $places, $dash) unless $skip_zero && $var == 0;
27 my ($self, $var, $places, $skip_zero) = @_;
29 return $main::form->round_amount($var * 1, $places) unless $skip_zero && $var == 0;
33 sub format_amount_units {
34 my ($self, $amount, $amount_unit, $part_unit) = @_;
36 return $main::form->format_amount_units('amount' => $amount,
37 'part_unit' => $part_unit,
38 'amount_unit' => $amount_unit,
39 'conv_units' => 'convertible_not_smaller');
43 my ($self, $var, $places, $skip_zero) = @_;
47 return $self->format_amount($var * 100, $places, $skip_zero);
51 my ($self, $var) = @_;
63 return $main::form->format_string($string, @_);
69 return $main::form->numtextrows(@_);
74 my $word = shift || "";
76 return join '<br>', map { $main::locale->quote_special_chars('HTML', $_) } split(m//, $word);
87 $args->{split_by} ||= 'chars';
88 $args->{class} = " class=\"$args->{class}\"" if ($args->{class});
90 if ($args->{split_by} eq 'words') {
91 my @words = split m/\s+/, $word;
93 if (1 >= scalar @words) {
94 return $self->_turn90_word($words[0]);
97 return qq|<table><tr>| . join('', map { '<td valign="bottom"' . $args->{class} . '>' . $self->_turn90_word($_) . '</td>' } @words) . qq|</tr></table>|;
100 return $self->_turn90_word($word);
108 return $var < 0 ? $var * -1 : $var;
112 my ($self, $text, @args) = @_;
113 return $::locale->text($text, @args) || $text;