From eeb560af5b33f700fa0cefd5feeadfa6a1c61f1e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 28 Nov 2008 17:36:38 +0000 Subject: [PATCH] =?utf8?q?Bei=20verschachtelten=20Schleifen=20in=20der=20i?= =?utf8?q?nneren=20Schleife=20eine=20andere=20Schleifenvariable=20als=20in?= =?utf8?q?=20der=20=C3=A4u=C3=9Feren=20Schleife=20benutzen.=20Bei=20Perl?= =?utf8?q?=205.10=20wird=20ansonsten=20unter=20der=20Bedingung=20"=C3=A4u?= =?utf8?q?=C3=9Fere=20Schleifenvariable=20mit=20my=20deklariert,=20innere?= =?utf8?q?=20hingegen=20ohne=20my"=20Speicher=20korrumpiert,=20und=20es=20?= =?utf8?q?tr=C3=A4gt=20zum=20einfacheren=20Verst=C3=A4ndnis=20bei.=20Fix?= =?utf8?q?=20f=C3=BCr=20Bug=20839.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/IS.pm | 26 +++++++++++--------------- SL/OE.pm | 6 +++--- 2 files changed, 14 insertions(+), 18 deletions(-) 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; } } -- 2.20.1