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];
123 include DOL_DOCUMENT_ROOT.
'/theme/'.
$conf->theme.
'/theme_vars.inc.php';
131 @phan-var-force string $badgeStatus0
132 @phan-var-force string $badgeStatus1
133 @phan-var-force string $badgeStatus2
134 @phan-var-force string $badgeStatus4
137 print
'<div class="div-table-responsive-no-min">';
138 print
'<table class="noborder nohover centpercent">';
139 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Interventions").
'</th></tr>'.
"\n";
145 foreach ($listofstatus as $status) {
146 $dataseries[] = array($fichinterstatic->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
149 $colorseries[$status] =
'-'.$badgeStatus0;
152 $colorseries[$status] = $badgeStatus1;
155 $colorseries[$status] = $badgeStatus2;
158 $colorseries[$status] = $badgeStatus4;
162 if (
$conf->use_javascript_ajax) {
163 print
'<tr class="impair"><td class="center" colspan="2">';
165 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
167 $dolgraph->SetData($dataseries);
168 $dolgraph->SetDataColor(array_values($colorseries));
169 $dolgraph->setShowLegend(2);
170 $dolgraph->setShowPercent(1);
171 $dolgraph->SetType(array(
'pie'));
172 $dolgraph->setHeight(
'200');
173 $dolgraph->draw(
'idgraphstatus');
174 print $dolgraph->show($total ? 0 : 1);
178 foreach ($listofstatus as $status) {
179 if (!
$conf->use_javascript_ajax) {
180 print
'<tr class="oddeven">';
181 print
'<td>'.$fichinterstatic->LibStatut($status, 0).
'</td>';
182 print
'<td class="right"><a href="list.php?search_status='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
' ';
183 print $fichinterstatic->LibStatut($status, 3);
191 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
192 print
"</table></div><br>";
201if (isModEnabled(
'intervention')) {
202 $sql =
"SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid";
203 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
204 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
205 if (!$user->hasRight(
'societe',
'client',
'voir')) {
206 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
208 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
209 $sql .=
" AND f.fk_soc = s.rowid";
210 $sql .=
" AND f.fk_statut = 0";
212 $sql .=
" AND f.fk_soc = ".((int) $socid);
214 if (!$user->hasRight(
'societe',
'client',
'voir')) {
215 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
218 $resql = $db->query($sql);
220 print
'<div class="div-table-responsive-no-min">';
221 print
'<table class="noborder centpercent">';
222 print
'<tr class="liste_titre">';
223 print
'<th colspan="2">'.$langs->trans(
"DraftFichinter").
'</th></tr>';
224 $langs->load(
"interventions");
225 $num = $db->num_rows($resql);
229 $obj = $db->fetch_object($resql);
230 $fichinterstatic->id = $obj->rowid;
231 $fichinterstatic->ref = $obj->ref;
232 print
'<tr class="oddeven">';
233 print
'<td class="nowrap">'.$fichinterstatic->getNomUrl(1).
'</td>';
234 $companystatic->id = $obj->socid;
235 $companystatic->name = $obj->name;
236 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
241 print
"</table></div><br>";
246print
'</div><div class="fichetwothirdright">';
253$sql =
"SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,";
254$sql .=
" s.nom as name, s.rowid as socid";
255$sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f,";
256$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
257if (!$user->hasRight(
'societe',
'client',
'voir')) {
258 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
260$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
261$sql .=
" AND f.fk_soc = s.rowid";
264 $sql .=
" AND f.fk_soc = ".((int) $socid);
266if (!$user->hasRight(
'societe',
'client',
'voir')) {
267 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
269$sql .=
" ORDER BY f.tms DESC";
270$sql .= $db->plimit($max, 0);
272$resql = $db->query($sql);
274 print
'<div class="div-table-responsive-no-min">';
275 print
'<table class="noborder centpercent">';
276 print
'<tr class="liste_titre">';
277 print
'<th colspan="4">'.$langs->trans(
"LastModifiedInterventions", $max).
'</th></tr>';
279 $num = $db->num_rows($resql);
283 $obj = $db->fetch_object($resql);
285 print
'<tr class="oddeven">';
286 print
'<td width="20%" class="nowrap">';
288 $fichinterstatic->id = $obj->rowid;
289 $fichinterstatic->ref = $obj->ref;
291 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
292 print
'<td width="96" class="nobordernopadding nowrap">';
293 print $fichinterstatic->getNomUrl(1);
296 print
'<td width="16" class="nobordernopadding nowrap">';
300 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
303 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
304 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
305 print
'</td></tr></table>';
308 $companystatic->id = $obj->socid;
309 $companystatic->name = $obj->name;
310 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
311 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'day').
'</td>';
312 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
317 print
"</table></div><br>";
327if (isModEnabled(
'intervention')) {
328 $sql =
"SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid";
329 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
330 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
331 if (!$user->hasRight(
'societe',
'client',
'voir')) {
332 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
334 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
335 $sql .=
" AND f.fk_soc = s.rowid";
336 $sql .=
" AND f.fk_statut = 1";
338 $sql .=
" AND f.fk_soc = ".((int) $socid);
340 if (!$user->hasRight(
'societe',
'client',
'voir')) {
341 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
343 $sql .=
" ORDER BY f.rowid DESC";
345 $resql = $db->query($sql);
347 $num = $db->num_rows($resql);
349 print
'<div class="div-table-responsive-no-min">';
350 print
'<table class="noborder centpercent">';
351 print
'<tr class="liste_titre">';
352 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>';
357 $obj = $db->fetch_object($resql);
358 print
'<tr class="oddeven">';
359 print
'<td class="nowrap" width="20%">';
361 $fichinterstatic->id = $obj->rowid;
362 $fichinterstatic->ref = $obj->ref;
364 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
365 print
'<td width="96" class="nobordernopadding nowrap">';
366 print $fichinterstatic->getNomUrl(1);
369 print
'<td width="16" class="nobordernopadding nowrap">';
373 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
376 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
377 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
378 print
'</td></tr></table>';
381 $companystatic->id = $obj->socid;
382 $companystatic->name = $obj->name;
383 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
384 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
390 print
"</table></div><br>";
398$parameters = array(
'user' => $user);
399$reshook = $hookmanager->executeHooks(
'dashboardInterventions', $parameters, $object);
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
const STATUS_CLOSED
Closed.
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
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.