Ajout des calculs de stats produits lors de la validation d'une facture

This commit is contained in:
Rodolphe Quiedeville 2003-07-10 18:10:14 +00:00
parent 8c891a60d3
commit f6812904d2

View File

@ -290,6 +290,29 @@ class Facture
$notify = New Notify($this->db);
$notify->send($action_notify, $this->socidp, $mesg, "facture", $rowid, $filepdf);
/*
* Update Stats
*
*/
$sql = "SELECT fk_product FROM llx_facturedet WHERE fk_facture = ".$this->id;
$sql .= " AND fk_product IS NOT NULL";
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows();
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($i);
$sql = "UPDATE llx_product SET nbvente=nbvente+1 WHERE rowid = ".$obj->fk_product;
$db2 = $this->db->clone();
$result = $db2->query($sql);
$i++;
}
}
return $result;
}