FIX #4440 Wrong price is filled by Product::fetch into multiprices arrays

This commit is contained in:
Marcos García de La Fuente 2016-01-18 10:13:58 +01:00
parent 5414cb6f12
commit da637db162
3 changed files with 4 additions and 4 deletions

View File

@ -1551,7 +1551,7 @@ class Form
$sql.= " WHERE fk_product='".$objp->rowid."'";
$sql.= " AND entity IN (".getEntity('productprice', 1).")";
$sql.= " AND price_level=".$price_level;
$sql.= " ORDER BY date_price";
$sql.= " ORDER BY date_price, rowid";
$sql.= " DESC LIMIT 1";
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.' sql='.$sql);

View File

@ -1510,7 +1510,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 DESC";
$sql.= " ORDER BY date_price, rowid DESC";
$sql.= " LIMIT 1";
$resql = $this->db->query($sql);
if ($resql)
@ -1571,7 +1571,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 DESC";
$sql.= " ORDER BY date_price, rowid DESC";
$sql.= " LIMIT 1";
$resql = $this->db->query($sql);
if ($resql)

View File

@ -687,7 +687,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 DESC, p.price_level ASC, p.rowid DESC";
$sql .= " ORDER BY p.date_price, p.rowid DESC, p.price_level ASC";
// $sql .= $db->plimit();
dol_syslog("sql=" . $sql);