Skip to content

Commit

Permalink
Merge pull request #3503 from fappels/3.7-dispatch-rounding
Browse files Browse the repository at this point in the history
Fix #3471 3.7 Rounding issue when dispatching non-integer
  • Loading branch information
eldy committed Sep 12, 2015
2 parents 8c1760f + c290840 commit a83b3ae
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions htdocs/fourn/commande/dispatch.php
Expand Up @@ -264,9 +264,17 @@
$resql = $db->query($sql);
if ($resql)
{
while ( $row = $db->fetch_row($resql) )
$num = $db->num_rows($resql);
$i = 0;

if ($num)
{
$products_dispatched[$row[0]] = $row[2];
while ($i < $num)
{
$objd = $db->fetch_object($resql);
$products_dispatched[$objd->rowid] = price2num($objd->qty, 5);
$i++;
}
}
$db->free($resql);
}
Expand Down Expand Up @@ -322,7 +330,7 @@
}
else
{
$remaintodispatch=($objp->qty - $products_dispatched[$objp->rowid]); // Calculation of dispatched
$remaintodispatch=(price2num($objp->qty, 5) - $products_dispatched[$objp->rowid]); // Calculation of dispatched
if ($remaintodispatch < 0) $remaintodispatch=0;
if ($remaintodispatch)
{
Expand Down

0 comments on commit a83b3ae

Please sign in to comment.