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';
34require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
44if (!$user->hasRight(
'ficheinter',
'lire')) {
49$langs->load(
"interventions");
52$hookmanager->initHooks(array(
'interventionindex'));
57if ($user->socid > 0) {
59 $socid = $user->socid;
70$companystatic =
new Societe($db);
74$help_url =
"EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones";
76llxHeader(
"", $langs->trans(
"Interventions"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-index');
78print
load_fiche_titre($langs->trans(
"InterventionsArea"),
'',
'intervention');
80print
'<div class="fichecenter"><div class="fichethirdleft">';
84$sql =
"SELECT count(f.rowid), f.fk_statut";
85$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
86$sql .=
", ".MAIN_DB_PREFIX.
"fichinter as f";
87if (!$user->hasRight(
'societe',
'client',
'voir')) {
88 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
90$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
91$sql .=
" AND f.fk_soc = s.rowid";
93 $sql .=
' AND f.fk_soc = '.((int) $user->socid);
95if (!$user->hasRight(
'societe',
'client',
'voir')) {
96 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
98$sql .=
" GROUP BY f.fk_statut";
99$resql = $db->query($sql);
101 $num = $db->num_rows($resql);
105 $dataseries = array();
106 $colorseries = array();
111 while ($row = $db->fetch_row($resql)) {
112 if (!isset($vals[$row[1]])) {
115 $vals[$row[1]] += $row[0];
116 $totalinprocess += $row[0];
122 include DOL_DOCUMENT_ROOT.
'/theme/'.
$conf->theme.
'/theme_vars.inc.php';
124 print
'<div class="div-table-responsive-no-min">';
125 print
'<table class="noborder nohover centpercent">';
126 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Interventions").
'</th></tr>'.
"\n";
132 foreach ($listofstatus as $status) {
133 $dataseries[] = array($fichinterstatic->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
136 $colorseries[$status] =
'-'.$badgeStatus0;
139 $colorseries[$status] = $badgeStatus1;
142 $colorseries[$status] = $badgeStatus4;
146 if (
$conf->use_javascript_ajax) {
147 print
'<tr class="impair"><td class="center" colspan="2">';
149 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
151 $dolgraph->SetData($dataseries);
152 $dolgraph->SetDataColor(array_values($colorseries));
153 $dolgraph->setShowLegend(2);
154 $dolgraph->setShowPercent(1);
155 $dolgraph->SetType(array(
'pie'));
156 $dolgraph->setHeight(
'200');
157 $dolgraph->draw(
'idgraphstatus');
158 print $dolgraph->show($total ? 0 : 1);
162 foreach ($listofstatus as $status) {
163 if (!
$conf->use_javascript_ajax) {
164 print
'<tr class="oddeven">';
165 print
'<td>'.$fichinterstatic->LibStatut($status, 0).
'</td>';
166 print
'<td class="right"><a href="list.php?search_status='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
' ';
167 print $fichinterstatic->LibStatut($status, 3);
175 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
176 print
"</table></div><br>";
185if (isModEnabled(
'intervention')) {
186 $sql =
"SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid";
187 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
188 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
189 if (!$user->hasRight(
'societe',
'client',
'voir')) {
190 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
192 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
193 $sql .=
" AND f.fk_soc = s.rowid";
194 $sql .=
" AND f.fk_statut = 0";
196 $sql .=
" AND f.fk_soc = ".((int) $socid);
198 if (!$user->hasRight(
'societe',
'client',
'voir')) {
199 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
202 $resql = $db->query($sql);
204 print
'<div class="div-table-responsive-no-min">';
205 print
'<table class="noborder centpercent">';
206 print
'<tr class="liste_titre">';
207 print
'<th colspan="2">'.$langs->trans(
"DraftFichinter").
'</th></tr>';
208 $langs->load(
"interventions");
209 $num = $db->num_rows($resql);
213 $obj = $db->fetch_object($resql);
214 $fichinterstatic->id = $obj->rowid;
215 $fichinterstatic->ref = $obj->ref;
216 print
'<tr class="oddeven">';
217 print
'<td class="nowrap">'.$fichinterstatic->getNomUrl(1).
'</td>';
218 $companystatic->id = $obj->socid;
219 $companystatic->name = $obj->name;
220 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
225 print
"</table></div><br>";
230print
'</div><div class="fichetwothirdright">';
237$sql =
"SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,";
238$sql .=
" s.nom as name, s.rowid as socid";
239$sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f,";
240$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
241if (!$user->hasRight(
'societe',
'client',
'voir')) {
242 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
244$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
245$sql .=
" AND f.fk_soc = s.rowid";
248 $sql .=
" AND f.fk_soc = ".((int) $socid);
250if (!$user->hasRight(
'societe',
'client',
'voir')) {
251 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
253$sql .=
" ORDER BY f.tms DESC";
254$sql .= $db->plimit($max, 0);
256$resql = $db->query($sql);
258 print
'<div class="div-table-responsive-no-min">';
259 print
'<table class="noborder centpercent">';
260 print
'<tr class="liste_titre">';
261 print
'<th colspan="4">'.$langs->trans(
"LastModifiedInterventions", $max).
'</th></tr>';
263 $num = $db->num_rows($resql);
267 $obj = $db->fetch_object($resql);
269 print
'<tr class="oddeven">';
270 print
'<td width="20%" class="nowrap">';
272 $fichinterstatic->id = $obj->rowid;
273 $fichinterstatic->ref = $obj->ref;
275 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
276 print
'<td width="96" class="nobordernopadding nowrap">';
277 print $fichinterstatic->getNomUrl(1);
280 print
'<td width="16" class="nobordernopadding nowrap">';
284 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
287 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
288 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
289 print
'</td></tr></table>';
292 $companystatic->id = $obj->socid;
293 $companystatic->name = $obj->name;
294 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
295 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'day').
'</td>';
296 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
301 print
"</table></div><br>";
311if (isModEnabled(
'intervention')) {
312 $sql =
"SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid";
313 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
314 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
315 if (!$user->hasRight(
'societe',
'client',
'voir')) {
316 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
318 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
319 $sql .=
" AND f.fk_soc = s.rowid";
320 $sql .=
" AND f.fk_statut = 1";
322 $sql .=
" AND f.fk_soc = ".((int) $socid);
324 if (!$user->hasRight(
'societe',
'client',
'voir')) {
325 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
327 $sql .=
" ORDER BY f.rowid DESC";
329 $resql = $db->query($sql);
331 $num = $db->num_rows($resql);
333 print
'<div class="div-table-responsive-no-min">';
334 print
'<table class="noborder centpercent">';
335 print
'<tr class="liste_titre">';
336 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>';
341 $obj = $db->fetch_object($resql);
342 print
'<tr class="oddeven">';
343 print
'<td class="nowrap" width="20%">';
345 $fichinterstatic->id = $obj->rowid;
346 $fichinterstatic->ref = $obj->ref;
348 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
349 print
'<td width="96" class="nobordernopadding nowrap">';
350 print $fichinterstatic->getNomUrl(1);
353 print
'<td width="16" class="nobordernopadding nowrap">';
357 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
360 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
361 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
362 print
'</td></tr></table>';
365 $companystatic->id = $obj->socid;
366 $companystatic->name = $obj->name;
367 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
368 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
374 print
"</table></div><br>";
382$parameters = array(
'user' => $user);
383$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.
Class to manage third parties objects (customers, suppliers, prospects...)
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.