29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
34if (!$user->rights->ficheinter->lire) {
41$hookmanager->initHooks(array(
'interventionindex'));
44$langs->load(
"interventions");
47$socid =
GETPOST(
'socid',
'int');
48if ($user->socid > 0) {
50 $socid = $user->socid;
63$help_url =
"EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones";
65llxHeader(
"", $langs->trans(
"Interventions"), $help_url);
67print
load_fiche_titre($langs->trans(
"InterventionsArea"),
'',
'intervention');
69print
'<div class="fichecenter"><div class="fichethirdleft">';
75$sql =
"SELECT count(f.rowid), f.fk_statut";
76$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
77$sql .=
", ".MAIN_DB_PREFIX.
"fichinter as f";
78if (empty($user->rights->societe->client->voir) && !$socid) {
79 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
81$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
82$sql .=
" AND f.fk_soc = s.rowid";
84 $sql .=
' AND f.fk_soc = '.((int) $user->socid);
86if (empty($user->rights->societe->client->voir) && !$socid) {
87 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
89$sql .=
" GROUP BY f.fk_statut";
90$resql = $db->query($sql);
92 $num = $db->num_rows($resql);
96 $dataseries = array();
101 while ($row = $db->fetch_row($resql)) {
102 if (!isset($vals[$row[1]])) {
105 $vals[$row[1]] += $row[0];
106 $totalinprocess += $row[0];
112 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
114 print
'<div class="div-table-responsive-no-min">';
115 print
'<table class="noborder nohover centpercent">';
116 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Interventions").
'</th></tr>'.
"\n";
120 foreach ($listofstatus as $status) {
121 $dataseries[] = array($fichinterstatic->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
124 $colorseries[$status] =
'-'.$badgeStatus0;
127 $colorseries[$status] = $badgeStatus1;
130 $colorseries[$status] = $badgeStatus4;
134 if ($conf->use_javascript_ajax) {
135 print
'<tr class="impair"><td class="center" colspan="2">';
137 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
139 $dolgraph->SetData($dataseries);
140 $dolgraph->SetDataColor(array_values($colorseries));
141 $dolgraph->setShowLegend(2);
142 $dolgraph->setShowPercent(1);
143 $dolgraph->SetType(array(
'pie'));
144 $dolgraph->setHeight(
'200');
145 $dolgraph->draw(
'idgraphstatus');
146 print $dolgraph->show($total ? 0 : 1);
150 foreach ($listofstatus as $status) {
151 if (!$conf->use_javascript_ajax) {
152 print
'<tr class="oddeven">';
153 print
'<td>'.$fichinterstatic->LibStatut($status, 0).
'</td>';
154 print
'<td class="right"><a href="list.php?search_status='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
' ';
155 print $fichinterstatic->LibStatut($status, 3);
163 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
164 print
"</table></div><br>";
173if (isModEnabled(
'ficheinter')) {
174 $sql =
"SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid";
175 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
176 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
177 if (empty($user->rights->societe->client->voir) && !$socid) {
178 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
180 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
181 $sql .=
" AND f.fk_soc = s.rowid";
182 $sql .=
" AND f.fk_statut = 0";
184 $sql .=
" AND f.fk_soc = ".((int) $socid);
186 if (empty($user->rights->societe->client->voir) && !$socid) {
187 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
190 $resql = $db->query($sql);
192 print
'<div class="div-table-responsive-no-min">';
193 print
'<table class="noborder centpercent">';
194 print
'<tr class="liste_titre">';
195 print
'<th colspan="2">'.$langs->trans(
"DraftFichinter").
'</th></tr>';
196 $langs->load(
"fichinter");
197 $num = $db->num_rows($resql);
201 $obj = $db->fetch_object($resql);
202 print
'<tr class="oddeven">';
203 print
'<td class="nowrap">';
204 print
"<a href=\"card.php?id=".$obj->rowid.
"\">".
img_object($langs->trans(
"ShowFichinter"),
"intervention").
' '.$obj->ref.
"</a></td>";
205 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.
dol_trunc($obj->name, 24).
'</a></td></tr>';
209 print
"</table></div><br>";
214print
'</div><div class="fichetwothirdright">';
223$sql =
"SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,";
224$sql .=
" s.nom as name, s.rowid as socid";
225$sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f,";
226$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
227if (empty($user->rights->societe->client->voir) && !$socid) {
228 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
230$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
231$sql .=
" AND f.fk_soc = s.rowid";
234 $sql .=
" AND f.fk_soc = ".((int) $socid);
236if (empty($user->rights->societe->client->voir) && !$socid) {
237 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
239$sql .=
" ORDER BY f.tms DESC";
240$sql .= $db->plimit($max, 0);
242$resql = $db->query($sql);
244 print
'<div class="div-table-responsive-no-min">';
245 print
'<table class="noborder centpercent">';
246 print
'<tr class="liste_titre">';
247 print
'<th colspan="4">'.$langs->trans(
"LastModifiedInterventions", $max).
'</th></tr>';
249 $num = $db->num_rows($resql);
253 $obj = $db->fetch_object($resql);
255 print
'<tr class="oddeven">';
256 print
'<td width="20%" class="nowrap">';
258 $fichinterstatic->id = $obj->rowid;
259 $fichinterstatic->ref = $obj->ref;
261 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
262 print
'<td width="96" class="nobordernopadding nowrap">';
263 print $fichinterstatic->getNomUrl(1);
266 print
'<td width="16" class="nobordernopadding nowrap">';
270 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
273 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
274 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
275 print
'</td></tr></table>';
279 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.$obj->name.
'</a></td>';
280 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'day').
'</td>';
281 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
286 print
"</table></div><br>";
296if (isModEnabled(
'ficheinter')) {
297 $sql =
"SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid";
298 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
299 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
300 if (empty($user->rights->societe->client->voir) && !$socid) {
301 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
303 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
304 $sql .=
" AND f.fk_soc = s.rowid";
305 $sql .=
" AND f.fk_statut = 1";
307 $sql .=
" AND f.fk_soc = ".((int) $socid);
309 if (empty($user->rights->societe->client->voir) && !$socid) {
310 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
312 $sql .=
" ORDER BY f.rowid DESC";
314 $resql = $db->query($sql);
316 $num = $db->num_rows($resql);
318 print
'<div class="div-table-responsive-no-min">';
319 print
'<table class="noborder centpercent">';
320 print
'<tr class="liste_titre">';
321 print
'<th colspan="3">'.$langs->trans(
"FichinterToProcess").
' <a href="'.DOL_URL_ROOT.
'/fichinter/list.php?search_status=1"><span class="badge">'.$num.
'</span></a></th></tr>';
326 $obj = $db->fetch_object($resql);
327 print
'<tr class="oddeven">';
328 print
'<td class="nowrap" width="20%">';
330 $fichinterstatic->id = $obj->rowid;
331 $fichinterstatic->ref = $obj->ref;
333 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
334 print
'<td width="96" class="nobordernopadding nowrap">';
335 print $fichinterstatic->getNomUrl(1);
338 print
'<td width="16" class="nobordernopadding nowrap">';
342 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
345 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
346 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
347 print
'</td></tr></table>';
351 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.
dol_trunc($obj->name, 24).
'</a></td>';
353 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
360 print
"</table></div><br>";
368$parameters = array(
'user' => $user);
369$reshook = $hookmanager->executeHooks(
'dashboardInterventions', $parameters, $object);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage interventions.
const STATUS_BILLED
Billed.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.