28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
38 $hookmanager->initHooks(array(
'interventionindex'));
41 $langs->load(
"interventions");
44 $socid =
GETPOST(
'socid',
'int');
48 $socid = $user->socid;
58 $form =
new Form($db);
61 $help_url =
"EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones";
63 llxHeader(
"", $langs->trans(
"Interventions"), $help_url);
67 print '<div class="fichecenter"><div class="fichethirdleft">';
69 if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))
73 print
'<form method="post" action="'.DOL_URL_ROOT.
'/fichinter/list.php">';
74 print
'<input type="hidden" name="token" value="'.newToken().
'">';
75 print
'<div class="div-table-responsive-no-min">';
76 print
'<table class="noborder nohover centpercent">';
77 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
78 print
'<tr class="oddeven"><td>';
79 print $langs->trans(
"Intervention").
':</td><td><input type="text" class="flat" name="sall" size="18"></td><td><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
80 print
"</table></div></form><br>\n";
88 $sql =
"SELECT count(f.rowid), f.fk_statut";
89 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
90 $sql .=
", ".MAIN_DB_PREFIX.
"fichinter as f";
91 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
92 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
93 $sql .=
" AND f.fk_soc = s.rowid";
94 if ($user->socid) $sql .=
' AND f.fk_soc = '.$user->socid;
95 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
96 $sql .=
" GROUP BY f.fk_statut";
100 $num = $db->num_rows(
$resql);
105 $dataseries = array();
111 $row = $db->fetch_row(
$resql);
116 $bool = (!empty($row[2]) ?
true:
false);
117 if (!isset($vals[$row[1].$bool])) $vals[$row[1].$bool] = 0;
118 $vals[$row[1].$bool] += $row[0];
119 $totalinprocess += $row[0];
127 include_once DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
129 print
'<div class="div-table-responsive-no-min">';
130 print
'<table class="noborder nohover centpercent">';
131 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Interventions").
'</th></tr>'.
"\n";
132 $listofstatus = array(0, 1, 3);
134 foreach ($listofstatus as $status)
136 $dataseries[] = array($fichinterstatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool]) ? (int) $vals[$status.$bool] : 0));
137 if ($status == 3 && !$bool) $bool =
true;
145 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);
163 foreach ($listofstatus as $status)
165 if (!$conf->use_javascript_ajax)
167 print
'<tr class="oddeven">';
168 print
'<td>'.$fichinterstatic->LibStatut($status, $bool, 0).
'</td>';
169 print
'<td class="right"><a href="list.php?search_status='.$status.
'">'.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).
' ';
170 print $fichinterstatic->LibStatut($status, $bool, 3);
174 if ($status == 3 && !$bool) $bool =
true;
180 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
181 print
"</table></div><br>";
190 if (!empty($conf->ficheinter->enabled))
192 $sql =
"SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid";
193 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
194 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
195 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
196 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
197 $sql .=
" AND f.fk_soc = s.rowid";
198 $sql .=
" AND f.fk_statut = 0";
199 if ($socid) $sql .=
" AND f.fk_soc = ".$socid;
200 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
202 $resql = $db->query($sql);
205 print
'<div class="div-table-responsive-no-min">';
206 print
'<table class="noborder centpercent">';
207 print
'<tr class="liste_titre">';
208 print
'<th colspan="2">'.$langs->trans(
"DraftFichinter").
'</th></tr>';
209 $langs->load(
"fichinter");
210 $num = $db->num_rows(
$resql);
216 $obj = $db->fetch_object(
$resql);
217 print
'<tr class="oddeven">';
218 print
'<td class="nowrap">';
219 print
"<a href=\"card.php?id=".$obj->rowid.
"\">".
img_object($langs->trans(
"ShowFichinter"),
"intervention").
' '.$obj->ref.
"</a></td>";
220 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>';
224 print
"</table></div><br>";
229 print
'</div><div class="fichetwothirdright"><div class="ficheaddleft">';
238 $sql =
"SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,";
239 $sql .=
" s.nom as name, s.rowid as socid";
240 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f,";
241 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
242 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
243 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
244 $sql .=
" AND f.fk_soc = s.rowid";
246 if ($socid) $sql .=
" AND f.fk_soc = ".$socid;
247 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
248 $sql .=
" ORDER BY f.tms DESC";
249 $sql .= $db->plimit($max, 0);
251 $resql = $db->query($sql);
254 print
'<div class="div-table-responsive-no-min">';
255 print
'<table class="noborder centpercent">';
256 print
'<tr class="liste_titre">';
257 print
'<th colspan="4">'.$langs->trans(
"LastModifiedInterventions", $max).
'</th></tr>';
259 $num = $db->num_rows(
$resql);
265 $obj = $db->fetch_object(
$resql);
267 print
'<tr class="oddeven">';
268 print
'<td width="20%" class="nowrap">';
270 $fichinterstatic->id = $obj->rowid;
271 $fichinterstatic->ref = $obj->ref;
273 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
274 print
'<td width="96" class="nobordernopadding nowrap">';
275 print $fichinterstatic->getNomUrl(1);
278 print
'<td width="16" class="nobordernopadding nowrap">';
282 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
285 $urlsource =
$_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
286 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
287 print
'</td></tr></table>';
291 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.$obj->name.
'</a></td>';
292 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'day').
'</td>';
293 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
298 print
"</table></div><br>";
306 if (!empty($conf->ficheinter->enabled))
308 $sql =
"SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid";
309 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
310 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
311 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
312 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
313 $sql .=
" AND f.fk_soc = s.rowid";
314 $sql .=
" AND f.fk_statut = 1";
315 if ($socid) $sql .=
" AND f.fk_soc = ".$socid;
316 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
317 $sql .=
" ORDER BY f.rowid DESC";
319 $resql = $db->query($sql);
322 $num = $db->num_rows(
$resql);
324 print
'<div class="div-table-responsive-no-min">';
325 print
'<table class="noborder centpercent">';
326 print
'<tr class="liste_titre">';
327 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>';
334 $obj = $db->fetch_object(
$resql);
335 print
'<tr class="oddeven">';
336 print
'<td class="nowrap" width="20%">';
338 $fichinterstatic->id = $obj->rowid;
339 $fichinterstatic->ref = $obj->ref;
341 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
342 print
'<td width="96" class="nobordernopadding nowrap">';
343 print $fichinterstatic->getNomUrl(1);
346 print
'<td width="16" class="nobordernopadding nowrap">';
350 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
353 $urlsource =
$_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
354 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
355 print
'</td></tr></table>';
359 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>';
361 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
368 print
"</table></div><br>";
372 print
'</div></div></div>';
374 $parameters = array(
'user' => $user);
375 $reshook = $hookmanager->executeHooks(
'dashboardInterventions', $parameters, $object);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage interventions.
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.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
const STATUS_CLOSED
Closed.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
const STATUS_BILLED
Billed.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $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.