diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 50d30a217f0..f16cb126e87 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -158,7 +158,7 @@ print ''; $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref,"; $sql.= " d.fk_product,"; $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,"; -$sql.= " f.datef, f.paye, f.fk_statut as statut"; +$sql.= " f.datef, f.paye, f.fk_statut as statut,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= " sum(".$db->ifsql('d.total_ht <=0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht <=0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index a5754cf10b4..788bd8fee09 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -215,7 +215,7 @@ $sql.= ' GROUP BY p.rowid, p.ref, p.label, p.price'; $sql.= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms'; $sql.= ', p.duration, p.tobuy, p.seuil_stock_alerte'; $sql.= ', p.desiredstock, s.fk_product'; -$sql.= ' HAVING p.desiredstock > SUM('.$db->ifsql("s.reel IS NULL", "s.reel", "0").')'; +$sql.= ' HAVING p.desiredstock > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; $sql.= ' AND p.desiredstock > 0'; if ($salert == 'on') // Option to see when stock is lower than alert { diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 968b1a30065..d186467ee04 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -92,7 +92,7 @@ $filter=GETPOST('filter'); $statut=GETPOST('statut'); if (! $sortorder) { $sortorder="ASC"; } -if (! $sortfield) { $sortfield="nom"; } +if (! $sortfield) { $sortfield="lastname"; } /*