From 7e253963da955750b76c06278fcb9ba6a7ec5ccd Mon Sep 17 00:00:00 2001 From: einhverfr Date: Mon, 25 Aug 2008 23:54:38 +0000 Subject: Correcting double free bug on Perl 5.10.0 git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@2303 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/IS.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm index b577f72c..910bceb7 100755 --- a/LedgerSMB/IS.pm +++ b/LedgerSMB/IS.pm @@ -36,10 +36,10 @@ use LedgerSMB::Tax; use LedgerSMB::PriceMatrix; use LedgerSMB::Sysconfig; + sub invoice_details { use LedgerSMB::CP; my ( $self, $myconfig, $form ) = @_; - $form->{duedate} = $form->{transdate} unless ( $form->{duedate} ); # connect to database @@ -53,7 +53,6 @@ sub invoice_details { my $sth = $dbh->prepare($query); $sth->execute( $form->{duedate}, $form->{transdate} ) || $form->dberror($query); - ( $form->{terms}, $form->{weightunit} ) = $sth->fetchrow_array; $sth->finish; @@ -376,15 +375,14 @@ sub invoice_details { Tax::calculate_taxes( \@taxaccounts, $form, $linetotal, 0 ); $tax += Tax::apply_taxes( \@taxaccounts, $form, $linetotal ); } - - foreach $item (@taxaccounts) { - push @taxrates, 100 * $item->rate; - $taxaccounts{ $item->account } += $item->value; + for my $taxitem (@taxaccounts) { + push @taxrates, 100 * $taxitem->rate; + $taxaccounts{ $taxitem->account } += $taxitem->value; if ( $form->{taxincluded} ) { - $taxbase{ $item->account } += $taxbase; + $taxbase{ $taxitem->account } += $taxbase; } else { - $taxbase{ $item->account } += $linetotal; + $taxbase{ $taxitem->account } += $linetotal; } } -- cgit v1.2.3