30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
35if (!$user->hasRight(
'ficheinter',
'lire')) {
42$hookmanager->initHooks(array(
'interventionindex'));
45$langs->load(
"interventions");
49if ($user->socid > 0) {
51 $socid = $user->socid;
65$help_url =
"EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones";
67llxHeader(
"", $langs->trans(
"Interventions"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-index');
69print
load_fiche_titre($langs->trans(
"InterventionsArea"),
'',
'intervention');
71print
'<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 (!$user->hasRight(
'societe',
'client',
'voir')) {
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 (!$user->hasRight(
'societe',
'client',
'voir')) {
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();
97 $colorseries = array();
102 while ($row = $db->fetch_row($resql)) {
103 if (!isset($vals[$row[1]])) {
106 $vals[$row[1]] += $row[0];
107 $totalinprocess += $row[0];
113 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
115 print
'<div class="div-table-responsive-no-min">';
116 print
'<table class="noborder nohover centpercent">';
117 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Interventions").
'</th></tr>'.
"\n";
123 foreach ($listofstatus as $status) {
124 $dataseries[] = array($fichinterstatic->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
127 $colorseries[$status] =
'-'.$badgeStatus0;
130 $colorseries[$status] = $badgeStatus1;
133 $colorseries[$status] = $badgeStatus4;
137 if ($conf->use_javascript_ajax) {
138 print
'<tr class="impair"><td class="center" colspan="2">';
140 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
142 $dolgraph->SetData($dataseries);
143 $dolgraph->SetDataColor(array_values($colorseries));
144 $dolgraph->setShowLegend(2);
145 $dolgraph->setShowPercent(1);
146 $dolgraph->SetType(array(
'pie'));
147 $dolgraph->setHeight(
'200');
148 $dolgraph->draw(
'idgraphstatus');
149 print $dolgraph->show($total ? 0 : 1);
153 foreach ($listofstatus as $status) {
154 if (!$conf->use_javascript_ajax) {
155 print
'<tr class="oddeven">';
156 print
'<td>'.$fichinterstatic->LibStatut($status, 0).
'</td>';
157 print
'<td class="right"><a href="list.php?search_status='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
' ';
158 print $fichinterstatic->LibStatut($status, 3);
166 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
167 print
"</table></div><br>";
176if (isModEnabled(
'intervention')) {
177 $sql =
"SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid";
178 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
179 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
180 if (!$user->hasRight(
'societe',
'client',
'voir')) {
181 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
183 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
184 $sql .=
" AND f.fk_soc = s.rowid";
185 $sql .=
" AND f.fk_statut = 0";
187 $sql .=
" AND f.fk_soc = ".((int) $socid);
189 if (!$user->hasRight(
'societe',
'client',
'voir')) {
190 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
193 $resql = $db->query($sql);
195 print
'<div class="div-table-responsive-no-min">';
196 print
'<table class="noborder centpercent">';
197 print
'<tr class="liste_titre">';
198 print
'<th colspan="2">'.$langs->trans(
"DraftFichinter").
'</th></tr>';
199 $langs->load(
"interventions");
200 $num = $db->num_rows($resql);
204 $obj = $db->fetch_object($resql);
205 print
'<tr class="oddeven">';
206 print
'<td class="nowrap">';
207 print
"<a href=\"card.php?id=".$obj->rowid.
"\">".
img_object($langs->trans(
"ShowFichinter"),
"intervention").
' '.$obj->ref.
"</a></td>";
208 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>';
212 print
"</table></div><br>";
217print
'</div><div class="fichetwothirdright">';
224$sql =
"SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,";
225$sql .=
" s.nom as name, s.rowid as socid";
226$sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f,";
227$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
228if (!$user->hasRight(
'societe',
'client',
'voir')) {
229 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
231$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
232$sql .=
" AND f.fk_soc = s.rowid";
235 $sql .=
" AND f.fk_soc = ".((int) $socid);
237if (!$user->hasRight(
'societe',
'client',
'voir')) {
238 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
240$sql .=
" ORDER BY f.tms DESC";
241$sql .= $db->plimit($max, 0);
243$resql = $db->query($sql);
245 print
'<div class="div-table-responsive-no-min">';
246 print
'<table class="noborder centpercent">';
247 print
'<tr class="liste_titre">';
248 print
'<th colspan="4">'.$langs->trans(
"LastModifiedInterventions", $max).
'</th></tr>';
250 $num = $db->num_rows($resql);
254 $obj = $db->fetch_object($resql);
256 print
'<tr class="oddeven">';
257 print
'<td width="20%" class="nowrap">';
259 $fichinterstatic->id = $obj->rowid;
260 $fichinterstatic->ref = $obj->ref;
262 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
263 print
'<td width="96" class="nobordernopadding nowrap">';
264 print $fichinterstatic->getNomUrl(1);
267 print
'<td width="16" class="nobordernopadding nowrap">';
271 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
274 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
275 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
276 print
'</td></tr></table>';
280 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.$obj->name.
'</a></td>';
281 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'day').
'</td>';
282 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
287 print
"</table></div><br>";
297if (isModEnabled(
'intervention')) {
298 $sql =
"SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid";
299 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
300 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
301 if (!$user->hasRight(
'societe',
'client',
'voir')) {
302 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
304 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
305 $sql .=
" AND f.fk_soc = s.rowid";
306 $sql .=
" AND f.fk_statut = 1";
308 $sql .=
" AND f.fk_soc = ".((int) $socid);
310 if (!$user->hasRight(
'societe',
'client',
'voir')) {
311 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
313 $sql .=
" ORDER BY f.rowid DESC";
315 $resql = $db->query($sql);
317 $num = $db->num_rows($resql);
319 print
'<div class="div-table-responsive-no-min">';
320 print
'<table class="noborder centpercent">';
321 print
'<tr class="liste_titre">';
322 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>';
327 $obj = $db->fetch_object($resql);
328 print
'<tr class="oddeven">';
329 print
'<td class="nowrap" width="20%">';
331 $fichinterstatic->id = $obj->rowid;
332 $fichinterstatic->ref = $obj->ref;
334 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
335 print
'<td width="96" class="nobordernopadding nowrap">';
336 print $fichinterstatic->getNomUrl(1);
339 print
'<td width="16" class="nobordernopadding nowrap">';
343 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
346 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
347 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
348 print
'</td></tr></table>';
352 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>';
354 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
361 print
"</table></div><br>";
369$parameters = array(
'user' => $user);
370$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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
const STATUS_BILLED
Billed.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.