X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/3ced230b9d35b6f2665162d6789af124431f23aa..8c7e44938a661e035f62840e1e177353240ace5d:/SL/Template/Plugin/LxERP.pm diff --git a/SL/Template/Plugin/LxERP.pm b/SL/Template/Plugin/LxERP.pm index 7c5ad94ff..a6bd06a80 100644 --- a/SL/Template/Plugin/LxERP.pm +++ b/SL/Template/Plugin/LxERP.pm @@ -2,7 +2,10 @@ package SL::Template::Plugin::LxERP; use base qw( Template::Plugin ); use Template::Plugin; -use List::Util qw(first); + +use List::Util qw(min); + +use SL::AM; sub new { my $class = shift; @@ -18,6 +21,15 @@ sub format_amount { return ''; } +sub format_amount_units { + my ($self, $amount, $amount_unit, $part_unit) = @_; + + return $main::form->format_amount_units('amount' => $amount, + 'part_unit' => $part_unit, + 'amount_unit' => $amount_unit, + 'conv_units' => 'convertible_not_smaller'); +} + sub format_percent { my ($self, $var, $places, $skip_zero) = @_; @@ -33,5 +45,49 @@ sub escape_br { return $var; } -1; +sub format_string { + my $self = shift; + my $string = shift; + + return $main::form->format_string($string, @_); +} + +sub numtextrows { + my $self = shift; + + return $main::form->numtextrows(@_); +} + +sub _turn90_word { + my $self = shift; + my $word = shift || ""; + return join '
', map { $main::form->quote_html($_) } split(m//, $word); +} + +sub turn90 { + my $self = shift; + my $word = shift; + my $args = shift; + + $args ||= { }; + $word ||= ""; + + $args->{split_by} ||= 'chars'; + $args->{class} = " class=\"$args->{class}\"" if ($args->{class}); + + if ($args->{split_by} eq 'words') { + my @words = split m/\s+/, $word; + + if (1 >= scalar @words) { + return $self->_turn90_word($words[0]); + } + + return qq|| . join('', map { '' } @words) . qq|
{class} . '>' . $self->_turn90_word($_) . '
|; + + } else { + return $self->_turn90_word($word); + } +} + +1;