diff --git a/ChangeLog b/ChangeLog index 61c3b67f7fd..3a4c465c3e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,7 @@ Fix: Corrected project contact types translation. Fix: [ bug #1206 ] PMP price is bad calculated. Fix: [ bug #520 ] Product statistics and detailed lists are wrong. Fix: [ bug #1240 ] traduction. +Fix: [ bug #1238 ] When creating accompte with a %, free product are used for calculation. ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9a665578c28..059d8dffd4a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -900,10 +900,14 @@ else if ($action == 'add' && $user->rights->facture->creer) { $totalamount=0; $lines = $srcobject->lines; + $numlines=count($lines); for ($i=0; $i<$numlines; $i++) { - $totalamount += $lines[$i]->total_ht; + $qualified=1; + if (empty($lines[$i]->qty)) $qualified=0; // We discard qty=0, it is an option + if (! empty($lines[$i]->special_code)) $qualified=0; // We discard special_code (frais port, ecotaxe, option, ...) + if ($qualified) $totalamount += $lines[$i]->total_ht; } if ($totalamount!=0) @@ -963,7 +967,6 @@ else if ($action == 'add' && $user->rights->facture->creer) $fk_parent_line=0; $num=count($lines); - for ($i=0;$i<$num;$i++) { $label=(! empty($lines[$i]->label)?$lines[$i]->label:'');