diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4b931d15222939bead66357056966927e27b63a3..dd3e8bd237b4eb9bb8662f219532c0c8198fa502 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1515,7 +1515,7 @@ class Product extends CommonObject $sql.= " WHERE entity IN (".getEntity('productprice', 1).")"; $sql.= " AND price_level=".$i; $sql.= " AND fk_product = '".$this->id."'"; - $sql.= " ORDER BY date_price, rowid DESC"; + $sql.= " ORDER BY date_price DESC, rowid DESC"; $sql.= " LIMIT 1"; $resql = $this->db->query($sql); if ($resql) @@ -1576,7 +1576,7 @@ class Product extends CommonObject $sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product_price"; $sql.= " WHERE fk_product = '".$this->id."'"; - $sql.= " ORDER BY date_price, rowid DESC"; + $sql.= " ORDER BY date_price DESC, rowid DESC"; $sql.= " LIMIT 1"; $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f84008df7f7f8f3366eaa4b7048c3b971ad5d6e2..033f998355b273bf0e00aafa6e6ad99b012be12a 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -749,7 +749,7 @@ $sql .= " WHERE fk_product = " . $object->id; $sql .= " AND p.entity IN (" . getEntity('productprice', 1) . ")"; $sql .= " AND p.fk_user_author = u.rowid"; if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql .= " AND p.price_level = " . $soc->price_level; -$sql .= " ORDER BY p.date_price, p.rowid DESC, p.price_level ASC"; +$sql .= " ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC"; // $sql .= $db->plimit(); $result = $db->query($sql);