diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 10ee5503995..cace21f67eb 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -1134,19 +1134,6 @@ class Facture extends CommonObject if (! $error && $facref == 'PROV') { // La vérif qu'une remise n'est pas utilisée 2 fois est faite au moment de l'insertion de ligne - - // On met a jour table des ventes - // On crée ici une denormalisation pas forcement utilisé !!! - // TODO Virer utilisation du champ nbvente si utilisation non justifié - foreach($this->lignes as $i => $line) - { - if ($line->fk_product) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'product SET nbvente=nbvente+1 WHERE rowid = '.$line->rowid; - $resql2 = $this->db->query($sql); - $i++; - } - } } if (! $error) diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 6ae829bbcf4..0e7fc76d2e6 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1011,7 +1011,7 @@ class Form } if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype; if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND (p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%')"; - $sql.= " ORDER BY p.nbvente DESC"; + $sql.= " ORDER BY p.ref"; if ($limit) $sql.= " LIMIT $limit"; dolibarr_syslog("Form::select_produits_do sql=".$sql, LOG_DEBUG); @@ -1024,7 +1024,7 @@ class Form $sqld = "SELECT d.fk_product, d.label"; $sqld.= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_det as d "; $sqld.= " WHERE d.fk_product=p.rowid AND p.envente=1 AND d.lang='". $langs->getDefaultLang() ."'"; - $sqld.= " ORDER BY p.nbvente DESC"; + $sqld.= " ORDER BY p.ref"; dolibarr_syslog("Form::select_produits_do sql=".$sql, LOG_DEBUG); $resultd = $this->db->query($sqld); diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 8c18949f0d1..67a61f8329d 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -911,7 +911,7 @@ class Product extends CommonObject } $sql = "SELECT rowid, ref, label, description, note, price, price_ttc, price_min, price_min_ttc, price_base_type, tva_tx, envente,"; - $sql.= " nbvente, fk_product_type, duration, seuil_stock_alerte,canvas,"; + $sql.= " fk_product_type, duration, seuil_stock_alerte,canvas,"; $sql.= " stock_commande, stock_loc, weight, weight_units, volume, volume_units, barcode, fk_barcode_type"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) $sql.= " WHERE rowid = '".$id."'"; @@ -935,7 +935,6 @@ class Product extends CommonObject $this->price_base_type = $result["price_base_type"]; $this->tva_tx = $result["tva_tx"]; $this->type = $result["fk_product_type"]; - $this->nbvente = $result["nbvente"]; $this->status = $result["envente"]; $this->duration = $result["duration"]; $this->duration_value = substr($result["duration"],0,strlen($result["duration"])-1);