From e3232a588c178c3ab92cf95fcb422e201a077eb1 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Thu, 4 Oct 2007 10:14:08 +0000 Subject: [PATCH] 1. Fieser Bug der in format_amount auftritt, wenn eine sehr kleine Zahl in Exponentialschreibweise uebergeben wird wie bspw. 1.13686837721616e-13. BITTE UNBEDINGT PRUEFEN, TESTEN UND VERBESSERN. Siehe auch Forenbeitrag: http://lx-office.org/forum/forum_entry.php?id=5315 2. co_ustid in allen Dokumenten zur Verfuegung gestellt. --- SL/Form.pm | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 2d6ba266a..48afe6305 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -726,18 +726,23 @@ sub format_amount { if ($amount eq "") { $amount = 0; } - my $neg = ($amount =~ s/-//); - + + # Hey watch out! The amount can be an exponential term like 1.13686837721616e-13 + + my $neg = ($amount =~ s/^-//); + my $exp = ($amount =~ m/[e]/) ? 1 : 0; + if (defined($places) && ($places ne '')) { - if ($places < 0) { - $amount *= 1; - $places *= -1; - - my ($actual_places) = ($amount =~ /\.(\d+)/); - $actual_places = length($actual_places); - $places = $actual_places > $places ? $actual_places : $places; + if (not $exp) { + if ($places < 0) { + $amount *= 1; + $places *= -1; + + my ($actual_places) = ($amount =~ /\.(\d+)/); + $actual_places = length($actual_places); + $places = $actual_places > $places ? $actual_places : $places; + } } - $amount = $self->round_amount($amount, $places); } @@ -863,6 +868,10 @@ sub parse_template { qw(company address signature)); map({ $self->{$_} =~ s/\\n/\n/g; } qw(company address signature)); + map({ $self->{"${_}"} = $myconfig->{$_}; } + qw(co_ustid)); + + $self->{copies} = 1 if (($self->{copies} *= 1) <= 0); # OUT is used for the media, screen, printer, email -- 2.20.1