X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/91ab1ef646193de9359076a876a33a74d7691145..34366eda748e1198b8b2ead0c3fffd8edba9f23d:/SL/Template/Plugin/LxERP.pm
diff --git a/SL/Template/Plugin/LxERP.pm b/SL/Template/Plugin/LxERP.pm
index 7c5ad94ff..d1d93d13c 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;
@@ -12,12 +15,21 @@ sub new {
 }
 
 sub format_amount {
-  my ($self, $var, $places, $skip_zero) = @_;
+  my ($self, $var, $places, $skip_zero, $dash) = @_;
 
-  return $main::form->format_amount(\%main::myconfig, $var * 1, $places) unless $skip_zero && $var == 0;
+  return $main::form->format_amount(\%main::myconfig, $var * 1, $places, $dash) unless $skip_zero && $var == 0;
   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::locale->quote_special_chars('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|
| {class} . '>' . $self->_turn90_word($_) . ' | ' } @words) . qq|