diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 29317af118e..4379d4525cc 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -223,7 +223,7 @@ $sql = "SELECT e.rowid, e.ref"; $sql.= ", s.nom, s.rowid as socid"; $sql.= ", c.ref as commande_ref, c.rowid as commande_id"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.sourcetype in ('commande')"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; if (!$user->rights->societe->client->voir && !$socid) @@ -235,7 +235,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= $clause." e.fk_statut = 1"; $sql.= " AND e.entity = ".$conf->entity; if ($socid) $sql.= " AND c.fk_soc = ".$socid; -$sql.= " ORDER BY e.date_expedition DESC"; +$sql.= " ORDER BY e.date_delivery DESC"; $sql.= $db->plimit(5, 0); $resql = $db->query($sql);