diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 68f8cb44c53..f12fe80f5f5 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -41,12 +41,13 @@ $user->getrights('fichinter'); $user->getrights('commande'); $user->getrights('projet'); - if ($user->societe_id > 0) { $socidp = $user->societe_id; } +$max=4; + llxHeader(); @@ -153,6 +154,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) } } + /* * Commandes à valider */ @@ -235,9 +237,52 @@ if ( $db->query($sql) ) print ''; +/* + * Derniers clients enregsitrés + */ +$sql = "SELECT s.idp,s.nom,".$db->pdate("datec")." as datec"; +$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; +$sql.= " WHERE s.client = 1"; +if ($user->societe_id > 0) +{ + $sql .= " AND s.idp = $user->societe_id"; +} +$sql .= " ORDER BY s.datec DESC "; +$sql .= $db->plimit($max, 0); + +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + if ($num) + { + $langs->load("boxes"); + + print ''; + print ''; + print ''; + + $i = 0; + $var=false; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + print ""; + print ""; + print '"; + print ''; + $i++; + $var=!$var; + + } + print "
'.$langs->trans("BoxTitleLastCustomers",$max).'
idp."\">".img_object($langs->trans("ShowCustomer"),"company")." ".$objp->nom."'.dolibarr_print_date($objp->datec)."

"; + + $db->free($resql); + } +} + /* * Dernières actions commerciales effectuées - * */ $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, s.nom as sname, s.idp";