From: Sven Schöling Date: Wed, 11 Mar 2009 13:43:14 +0000 (+0000) Subject: Potentieller Fix für Bug 879. IS::cogs hatte unsicheres basefactor Handling. X-Git-Tag: release-2.6.0beta2~145 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c2f2c60ea875a6946476c4959ee5c033e88dac3e;p=kivitendo-erp.git Potentieller Fix für Bug 879. IS::cogs hatte unsicheres basefactor Handling. --- diff --git a/SL/IS.pm b/SL/IS.pm index c1ab0b644..98f283711 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1212,6 +1212,9 @@ sub cogs { $main::lxdebug->enter_sub(); my ($dbh, $form, $id, $totalqty, $basefactor, $row) = @_; + + $basefactor ||= 1; + $form->{taxzone_id} *=1; my $transdate = $form->{invdate} ? $dbh->quote($form->{invdate}) : "current_date"; my $taxzone_id = $form->{"taxzone_id"} * 1; @@ -1242,7 +1245,7 @@ sub cogs { # total expenses and inventory # sellprice is the cost of the item - my $linetotal = $form->round_amount(($ref->{sellprice} * $qty) / $basefactor, 2); + my $linetotal = $form->round_amount(($ref->{sellprice} * $qty) / ( $basefactor || 1 ), 2); if (!$main::eur) { $ref->{expense_accno} = ($form->{"expense_accno_$row"}) ? $form->{"expense_accno_$row"} : $ref->{expense_accno};