From: Moritz Bunkus Date: Fri, 28 Nov 2008 17:36:38 +0000 (+0000) Subject: Bei verschachtelten Schleifen in der inneren Schleife eine andere Schleifenvariable... X-Git-Tag: release-2.6.0beta2~227 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=eeb560af5b33f700fa0cefd5feeadfa6a1c61f1e;p=kivitendo-erp.git Bei verschachtelten Schleifen in der inneren Schleife eine andere Schleifenvariable als in der äußeren Schleife benutzen. Bei Perl 5.10 wird ansonsten unter der Bedingung "äußere Schleifenvariable mit my deklariert, innere hingegen ohne my" Speicher korrumpiert, und es trägt zum einfacheren Verständnis bei. Fix für Bug 839. --- diff --git a/SL/IS.pm b/SL/IS.pm index af47ca7d0..2363771a4 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -279,29 +279,25 @@ sub invoice_details { if ($form->round_amount($taxrate, 7) == 0) { if ($form->{taxincluded}) { - foreach $item (@taxaccounts) { - $taxamount = - $form->round_amount($linetotal * $form->{"${item}_rate"} / - (1 + abs($form->{"${item}_rate"})), - 2); + foreach my $accno (@taxaccounts) { + $taxamount = $form->round_amount($linetotal * $form->{"${accno}_rate"} / (1 + abs($form->{"${accno}_rate"})), 2); - $taxaccounts{$item} += $taxamount; - $taxdiff += $taxamount; + $taxaccounts{$accno} += $taxamount; + $taxdiff += $taxamount; - $taxbase{$item} += $taxbase; + $taxbase{$accno} += $taxbase; } $taxaccounts{ $taxaccounts[0] } += $taxdiff; } else { - foreach $item (@taxaccounts) { - $taxaccounts{$item} += $linetotal * $form->{"${item}_rate"}; - $taxbase{$item} += $taxbase; + foreach my $accno (@taxaccounts) { + $taxaccounts{$accno} += $linetotal * $form->{"${accno}_rate"}; + $taxbase{$accno} += $taxbase; } } } else { - foreach $item (@taxaccounts) { - $taxaccounts{$item} += - $taxamount * $form->{"${item}_rate"} / $taxrate; - $taxbase{$item} += $taxbase; + foreach my $accno (@taxaccounts) { + $taxaccounts{$accno} += $taxamount * $form->{"${accno}_rate"} / $taxrate; + $taxbase{$accno} += $taxbase; } } $tax_rate = $taxrate * 100; diff --git a/SL/OE.pm b/SL/OE.pm index 3afd46262..95d60c36f 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1075,9 +1075,9 @@ sub order_details { } if ($taxamount != 0) { - foreach my $item (split / /, $form->{"taxaccounts_$i"}) { - $taxaccounts{$item} += $taxamount * $form->{"${item}_rate"} / $taxrate; - $taxbase{$item} += $taxbase; + foreach my $accno (split / /, $form->{"taxaccounts_$i"}) { + $taxaccounts{$accno} += $taxamount * $form->{"${accno}_rate"} / $taxrate; + $taxbase{$accno} += $taxbase; } }