diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 627dbb96aa0..24f7299ea16 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1398,12 +1398,17 @@ class Propal extends CommonObject /** - * \brief Renvoi la liste des propal (eventuellement filtree sur un user) dans un tableau - * \param draft 0=not draft, 1=draft - * \param notcurrentuser 0=current user, 1=not current user - * \return int -1 si erreur, tableau resultat si ok + * \brief Return list of proposal (eventually filtered on user) into an array + * \param shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref) + * \param draft 0=not draft, 1=draft + * \param notcurrentuser 0=current user, 1=not current user + * \param socid Id third pary + * \param limit For pagination + * \param offset For pagination + * \param sortfield Sort criteria + * \param sortorder Sort order + * \return int -1 if KO, array with result if OK */ - function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') { global $conf,$user; @@ -1419,14 +1424,13 @@ class Propal extends CommonObject if ($socid) $sql.= " AND s.rowid = ".$socid; if ($draft) $sql.= " AND p.fk_statut = 0"; if ($notcurrentuser) $sql.= " AND p.fk_user_author <> ".$user->id; - $sql.= " ORDER BY $sortfield $sortorder"; + $sql.= $this->db->order($sortfield,$sortorder); $sql.= $this->db->plimit($limit,$offset); $result=$this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); - if ($num) { $i = 0; @@ -1451,6 +1455,7 @@ class Propal extends CommonObject } else { + dol_print_error($this->db); return -1; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7f7c2994287..5bb94d3f604 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1663,38 +1663,29 @@ class Commande extends CommonObject } /** - * \brief Renvoi la liste des commandes (eventuellement filtree sur un user) dans un tableau + * \brief Return list of orders (eventuelly filtered on a user) into an array * \param brouillon 0=non brouillon, 1=brouillon * \param user Objet user de filtre - * \return int -1 si erreur, tableau resultat si ok + * \return int -1 if KO, array with result if OK */ - function liste_array ($brouillon=0, $user='') + function liste_array($brouillon=0, $user='') { global $conf; $ga = array(); - $sql = "SELECT rowid, ref"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande"; - $sql.= " WHERE entity = ".$conf->entity; - - if ($brouillon) - { - $sql.= " AND fk_statut = 0"; - if ($user) $sql.= " AND fk_user_author".$user; - } - else - { - if ($user) $sql.= " AND fk_user_author".$user; - } - - $sql .= " ORDER BY date_commande DESC"; + $sql = "SELECT s.nom, s.rowid, c.rowid, c.ref"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; + $sql.= " WHERE c.entity = ".$conf->entity; + $sql.= " AND c.fk_soc = s.rowid"; + if ($brouillon) $sql.= " AND c.fk_statut = 0"; + if ($user) $sql.= " AND c.fk_user_author <> ".$user->id; + $sql .= " ORDER BY c.date_commande DESC"; $result=$this->db->query($sql); if ($result) { $numc = $this->db->num_rows($result); - if ($numc) { $i = 0; @@ -1710,6 +1701,7 @@ class Commande extends CommonObject } else { + dol_print_error($this->db); return -1; } } diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index bfb2d5ced3b..47f60fb8a80 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -829,10 +829,9 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ } /** - * - * Fiche produit - * + * Product card */ + if ($_GET["id"] || $_GET["ref"]) { $product=new Product($db); @@ -1283,7 +1282,7 @@ if ($product->id && $_GET["action"] == '' && $product->status) print ''; // Liste de "Mes propals" - print '