diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index eda8b600b24..9e0ed827ba8 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014-2016 Ferran Marcet * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Jean-François Ferry * @@ -1643,9 +1643,11 @@ else { $tmpaction='activateline'; if ($objp->statut == 4) $tmpaction='unactivateline'; - print ''; - print img_edit(); - print ''; + if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->unactiver)) { + print ''; + print img_edit(); + print ''; + } } } print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5d4ba4398a4..57fbcd01257 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, rowid DESC"; + $sql.= " ORDER BY date_price DESC, 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, 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 c26da58f040..73064859297 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, 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);