From: Moritz Bunkus Date: Tue, 24 Jul 2007 09:01:23 +0000 (+0000) Subject: Vermeiden, dass versucht wird, durch 0 zu teilen. X-Git-Tag: release-2.6.0beta1~556 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3505ff1bb654d331bd384461d471fa895635e7b4;p=kivitendo-erp.git Vermeiden, dass versucht wird, durch 0 zu teilen. --- diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 161dde9a0..11a12e440 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1532,8 +1532,8 @@ sub ar_transactions { map { $subtotals{$_} += $ar->{$_}; $totals{$_} += $ar->{$_} } @subtotal_columns; - $subtotals{marge_percent} = $subtotals{marge_total} / $subtotals{netamount} * 100; - $totals{marge_percent} = $totals{marge_total} / $totals{netamount} * 100; + $subtotals{marge_percent} = $subtotals{netamount} ? ($subtotals{marge_total} * 100 / $subtotals{netamount}) : 0; + $totals{marge_percent} = $totals{netamount} ? ($totals{marge_total} * 100 / $totals{netamount} ) : 0; map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(netamount tax amount paid due marge_total marge_percent); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index c64edef77..43357a876 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1779,8 +1779,9 @@ sub orders { map { $subtotals{$_} += $oe->{$_}; $totals{$_} += $oe->{$_} } @subtotal_columns; - $subtotals{marge_percent} = $subtotals{marge_total} / $subtotals{netamount} * 100; - $totals{marge_percent} = $totals{marge_total} / $totals{netamount} * 100; + + $subtotals{marge_percent} = $subtotals{netamount} ? ($subtotals{marge_total} * 100 / $subtotals{netamount}) : 0; + $totals{marge_percent} = $totals{netamount} ? ($totals{marge_total} * 100 / $totals{netamount} ) : 0; map { $oe->{$_} = $form->format_amount(\%myconfig, $oe->{$_}, 2) } qw(netamount tax amount marge_total marge_percent);