1 package SL::Template::Plugin::LxERP;
3 use base qw( Template::Plugin );
7 use List::Util qw(min);
21 my ($self, $obj, $wanted_class) = @_;
23 $wanted_class = !$wanted_class ? 'Rose::DB::Object'
24 : $wanted_class =~ m{::} ? $wanted_class
25 : "SL::DB::${wanted_class}";
27 return Scalar::Util::blessed($obj) ? $obj->isa($wanted_class) : 0;
31 my ($self, $var, $places, $skip_zero, $dash) = @_;
33 return $main::form->format_amount(\%main::myconfig, $var * 1, $places, $dash) unless $skip_zero && $var == 0;
38 my ($self, $var, $places, $skip_zero) = @_;
40 return $main::form->round_amount($var * 1, $places) unless $skip_zero && $var == 0;
45 my ($self, $var, $places, $skip_zero) = @_;
49 return $self->format_amount($var * 100, $places, $skip_zero);
53 my ($self, $var) = @_;
65 return $main::form->format_string($string, @_);
71 return $main::form->numtextrows(@_);
76 my $word = shift || "";
78 return join '<br>', map { $main::locale->quote_special_chars('HTML', $_) } split(m//, $word);
89 $args->{split_by} ||= 'chars';
90 $args->{class} = " class=\"$args->{class}\"" if ($args->{class});
92 if ($args->{split_by} eq 'words') {
93 my @words = split m/\s+/, $word;
95 if (1 >= scalar @words) {
96 return $self->_turn90_word($words[0]);
99 return qq|<table><tr>| . join('', map { '<td valign="bottom"' . $args->{class} . '>' . $self->_turn90_word($_) . '</td>' } @words) . qq|</tr></table>|;
102 return $self->_turn90_word($word);
110 return $var < 0 ? $var * -1 : $var;
114 my ($self, $text, @args) = @_;
115 return $::locale->text($text, @args) || $text;