diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php
index 7a2978b9922..ed48d19e10e 100644
--- a/htdocs/comm/fiche.php
+++ b/htdocs/comm/fiche.php
@@ -355,9 +355,55 @@ if ($_socid > 0)
}
$db->free($resql);
}
+ else {
+ dolibarr_print_error($db);
+ }
print "";
}
+ /*
+ * Derniers contrats
+ */
+ if($conf->contrat->enabled)
+ {
+ print '
';
+
+ $sql = "SELECT s.nom, s.idp, c.rowid as id, c.rowid as ref, ".$db->pdate("c.datec")." as dc";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
+ $sql .= " WHERE c.fk_soc = s.idp ";
+ $sql .= " AND s.idp = $objsoc->id";
+ $sql .= " ORDER BY c.datec DESC";
+
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $var=true;
+ $num = $db->num_rows($resql);
+ if ($num >0 )
+ {
+ print '';
+ print ' | ';
+ print '
';
+ }
+ $i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
+ while ($i < $num && $i < $MAXLIST)
+ {
+ $objp = $db->fetch_object($resql);
+ $var=!$var;
+ print "";
+ print '| '.img_object($langs->trans("ShowContract"),"contract").' '.$objp->ref."\n";
+ print " | ".dolibarr_print_date($objp->dc)." | \n";
+ print '
';
+ $i++;
+ }
+ $db->free($resql);
+ }
+ else {
+ dolibarr_print_error($db);
+ }
+ print "
";
+ }
+
/*
* Dernieres interventions
*/
@@ -458,21 +504,16 @@ if ($_socid > 0)
print ''.$langs->trans("AddProp").'';
}
- if ($user->rights->contrat->creer)
- {
- $langs->load("contracts");
- print ''.$langs->trans("AddContract").'';
- }
-
if ($conf->commande->enabled && $user->rights->commande->creer)
{
$langs->load("orders");
print ''.$langs->trans("AddOrder").'';
}
- if ($conf->projet->enabled && $user->rights->projet->creer)
+ if ($user->rights->contrat->creer)
{
- print ''.$langs->trans("AddProject").'';
+ $langs->load("contracts");
+ print ''.$langs->trans("AddContract").'';
}
if ($conf->fichinter->enabled)
@@ -481,6 +522,12 @@ if ($_socid > 0)
print ''.$langs->trans("AddIntervention").'';
}
+ if ($conf->projet->enabled && $user->rights->projet->creer)
+ {
+ print ''.$langs->trans("AddProject").'';
+ }
+
+
print ''.$langs->trans("AddContact").'';
print '';