From 55f4154b938745ccf6c51802aa0ddf62f2ddf5cc Mon Sep 17 00:00:00 2001 From: Philip Reetz Date: Thu, 7 Dec 2006 16:53:28 +0000 Subject: [PATCH] Fehler in format_amount. Wenn die uebergebene Variable leer ist, wurde ein Punkt zurueckgeliefert --- SL/Form.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 82962803c..cbfc81f32 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -654,6 +654,10 @@ sub format_amount { $main::lxdebug->enter_sub(2); my ($self, $myconfig, $amount, $places, $dash) = @_; + + if ($amount eq "") { + $amount = 0; + } my $neg = ($amount =~ s/-//); $amount = $self->round_amount($amount, $places) if ($places =~ /\d/); @@ -665,13 +669,14 @@ sub format_amount { $amount = $p[0]; $amount .= $d[0].$p[1].(0 x ($places - length $p[1])) if ($places || $p[1] ne ''); - + $amount = do { ($dash =~ /-/) ? ($neg ? "($amount)" : "$amount" ) : ($dash =~ /DRCR/) ? ($neg ? "$amount DR" : "$amount CR" ) : ($neg ? "-$amount" : "$amount" ) ; }; - + + $main::lxdebug->leave_sub(2); return $amount; } -- 2.20.1