X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate%2FPlugin%2FLxERP.pm;h=40bf195f205f2569b422ed92448fcf621e6c3f7b;hb=46b4927562b9679deec973e1b2d6dbdc7b4e755c;hp=acb3f4d2e207cec9bccbf16c0f6dde19e9acdecc;hpb=eb0c10b0a09da8ff4590c3043a9fa6dd10775ee4;p=kivitendo-erp.git diff --git a/SL/Template/Plugin/LxERP.pm b/SL/Template/Plugin/LxERP.pm index acb3f4d2e..40bf195f2 100644 --- a/SL/Template/Plugin/LxERP.pm +++ b/SL/Template/Plugin/LxERP.pm @@ -7,6 +7,8 @@ use List::Util qw(min); use SL::AM; +use strict; + sub new { my $class = shift; my $context = shift; @@ -21,6 +23,13 @@ sub format_amount { return ''; } +sub round_amount { + my ($self, $var, $places, $skip_zero) = @_; + + return $main::form->round_amount($var * 1, $places) unless $skip_zero && $var == 0; + return ''; +} + sub format_amount_units { my ($self, $amount, $amount_unit, $part_unit) = @_; @@ -33,6 +42,8 @@ sub format_amount_units { sub format_percent { my ($self, $var, $places, $skip_zero) = @_; + $places ||= 2; + return $self->format_amount($var * 100, $places, $skip_zero); } @@ -97,4 +108,9 @@ sub abs { return $var < 0 ? $var * -1 : $var; } +sub t8 { + my ($self, $text, @args) = @_; + return $::locale->text($text, @args) || $text; +} + 1;