Fix: [ bug #1238 ] When creating accompte with a %, free product are

used for calculation.
This commit is contained in:
Laurent Destailleur 2014-03-01 19:11:13 +01:00
parent 7db903e671
commit c6fb7996ba
2 changed files with 6 additions and 2 deletions

View File

@ -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:

View File

@ -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:'');