diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 9d0d9f1befc..11accdb3f0a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -497,6 +497,50 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU } } + +/* + * Draft interventionals + */ +if (!empty($conf->ficheinter->enabled)) { + $sql = "SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid"; + $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; + $sql .= ", ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= " WHERE f.entity IN (".getEntity('intervention').")"; + $sql .= " AND f.fk_soc = s.rowid"; + $sql .= " AND f.fk_statut = 0"; + if ($socid) { + $sql .= " AND f.fk_soc = ".((int) $socid); + } + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + + $resql = $db->query($sql); + if ($resql) { + print '
'; + print ''; + print ''; + print ''; + $langs->load("fichinter"); + $num = $db->num_rows($resql); + if ($num) { + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + print ''; + print '"; + print ''; + $i++; + } + } + print "
'.$langs->trans("DraftFichinter").'
'; + print "rowid."\">".img_object($langs->trans("ShowFichinter"), "intervention").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($obj->name, 24).'
"; + } +} + print '
'; print '
';