diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 9388f9102b8..b1be1505c14 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -284,6 +284,7 @@ print ''; * Liste des 10 derniers saisis * */ +$max=10; $sql = "SELECT s.rowid as socid, s.nom, s.ville,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm"; $sql.= " , code_fournisseur, code_compta_fournisseur"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; @@ -292,42 +293,42 @@ if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PR $sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur=1"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql .= " AND s.rowid = ".$socid; - -$sql .= " ORDER BY s.datec DESC LIMIT 10; "; +$sql.= " ORDER BY s.datec DESC"; +$sql .= $db->plimit($max, 0); $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - print "\n"; - print "\n"; - print '\n"; - print "\n"; + $langs->load("boxes"); + $num = $db->num_rows($resql); + $i = 0; - $var=True; + print '
".$langs->trans("Company")."".$langs->trans("SupplierCode")."'.$langs->trans("DateCreation")."
'; + print ''; + print '\n"; + print '\n"; + print "\n"; - while ($obj = $db->fetch_object($resql) ) - { - $var=!$var; + $var=True; - print ""; - print '\n"; - print ''; - print ''; - print "\n"; - } - print "
'.$langs->trans("BoxTitleLastSuppliers",min($max,$num))."'.$langs->trans("DateCreation")."
'.img_object($langs->trans("ShowSupplier"),"company").''; - print " socid."\">".$obj->nom."'.$obj->code_fournisseur.' '.dolibarr_print_date($obj->datec,'day').'
\n"; + while ($obj = $db->fetch_object($resql) ) + { + $var=!$var; - $db->free($resql); + print ""; + print ''.img_object($langs->trans("ShowSupplier"),"company").''; + print " socid."\">".$obj->nom."\n"; + print ''.$obj->code_fournisseur.' '; + print ''.dolibarr_print_date($obj->datec,'day').''; + print "\n"; + } + print "\n"; + + $db->free($resql); } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } print "\n";