diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index f88e1c56e3d..76882371b55 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,31 +154,33 @@ if ( $db->query($sql) ) /* * Commandes à traiter */ -$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; -$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut > 2 "; -if ($socidp) +$max=5; + +$sql = "SELECT c.rowid, c.ref, s.nom, s.idp"; +$sql.= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; +$sql.= " WHERE c.fk_soc = s.idp AND c.fk_statut > 2"; +if ($socidp) $sql .= " AND c.fk_soc = $socidp"; +$sql.= " ORDER BY c.rowid DESC"; +$sql.= $db->plimit($max, 0); + +$resql=$db->query($sql); +if ($resql) { - $sql .= " AND c.fk_soc = $socidp"; -} -$sql .= " ORDER BY c.rowid DESC"; -$sql .= $db->plimit(5, 0); -if ( $db->query($sql) ) -{ - $num = $db->num_rows(); + $num = $db->num_rows($resql); if ($num) { $i = 0; print ''; print ''; - print ''; + print ''; $var = True; while ($i < $num) { $var=!$var; - $obj = $db->fetch_object(); - print ""; - print ''; + $obj = $db->fetch_object($resql); + print "'; + print ''; $i++; } print "
5 dernières commandes
'.$langs->trans("LastOrders",$max).'
rowid\">".img_file()." "; - print "rowid\">$obj->ref'.$obj->nom.'
rowid\">".img_object($langs->trans("ShowOrders"),"order").' '; + print $obj->ref.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'

"; @@ -192,5 +194,6 @@ print ''; $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); + ?>