diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7db437150ca..af919f3ff7d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1814,7 +1814,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.'', LOG_DEBUG); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index d0d32cf237c..92d066702ce 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2006 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2016 Regis Houssin * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Marcos GarcĂ­a @@ -707,7 +707,16 @@ if (empty($reshook)) $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); if ($result > 0) { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0e853e084f8..5d4ba4398a4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1649,7 +1649,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) @@ -1710,7 +1710,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) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 49f4779d4e4..c26da58f040 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -858,7 +858,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(); $result = $db->query($sql);