diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php
index f5de7c45a86..c1d06a40299 100644
--- a/htdocs/expedition/index.php
+++ b/htdocs/expedition/index.php
@@ -105,7 +105,7 @@ if ( $db->query($sql) )
{
$var=!$var;
$obj = $db->fetch_object();
- print "
| ";
+ print " |
| ";
print "rowid\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.' | ';
print ''.$obj->nom.' |
';
$i++;
@@ -159,11 +159,13 @@ if ( $resql )
$sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
$sql.= " WHERE e.fk_commande = c.rowid AND c.fk_soc = s.idp AND e.fk_statut = 1";
+$sql .= " ORDER BY e.date_expedition DESC";
$sql .= $db->plimit(5, 0);
-if ( $db->query($sql) )
+$resql = $db->query($sql);
+if ($resql)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($resql);
if ($num)
{
$i = 0;
@@ -174,7 +176,7 @@ if ( $db->query($sql) )
while ($i < $num)
{
$var=!$var;
- $obj = $db->fetch_object();
+ $obj = $db->fetch_object($resql);
print "| rowid\">".img_object($langs->trans("ShowSending"),"sending").' ';
print $obj->ref.' | ';
print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.' | ';
@@ -183,6 +185,7 @@ if ( $db->query($sql) )
}
print "
";
}
+ $db->free($resql);
}
print '
';