30require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/dashboard.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
46if (!$user->hasRight(
'ficheinter',
'lire')) {
51$langs->load(
"interventions");
54$hookmanager->initHooks(array(
'interventionindex'));
59if ($user->isExternalUser()) {
61 $socid = $user->isExternalUser();
75$companystatic =
new Societe($db);
79$help_url =
"EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones";
81llxHeader(
"", $langs->trans(
"Interventions"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-index');
83print
load_fiche_titre($langs->trans(
"InterventionsArea"),
'',
'intervention');
85print
'<div class="fichecenter"><div class="fichethirdleft">';
89$sql =
"SELECT count(f.rowid), f.fk_statut";
90$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
91$sql .=
", ".MAIN_DB_PREFIX.
"fichinter as f";
92if (!$user->hasRight(
'societe',
'client',
'voir')) {
93 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
95$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
96$sql .=
" AND f.fk_soc = s.rowid";
98 $sql .=
' AND f.fk_soc = '.((int) $user->socid);
100if (!$user->hasRight(
'societe',
'client',
'voir')) {
101 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
103$sql .=
" GROUP BY f.fk_statut";
104$resql = $db->query($sql);
107 while ($row = $db->fetch_row($resql)) {
108 if (!isset($vals[$row[1]])) {
111 $vals[$row[1]] += $row[0];
116 $colorofstatus = array(
127 foreach ($listofstatus as $status) {
129 'label' => $fichinterstatic->LibStatut($status, 1),
130 'labelnojs' => $fichinterstatic->LibStatut($status, 0),
131 'nb' => (isset($vals[$status]) ? (
int) $vals[$status] : 0),
132 'color' => $colorofstatus[$status],
133 'url' =>
'list.php?search_status='.$status,
136 print
getStatusPieChart($langs->trans(
"Statistics").
' - '.$langs->trans(
"Interventions"), $series);
138 dol_print_error($db);
146 $sql =
"SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid";
147 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
148 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
149 if (!$user->hasRight(
'societe',
'client',
'voir')) {
150 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
152 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
153 $sql .=
" AND f.fk_soc = s.rowid";
154 $sql .=
" AND f.fk_statut = 0";
156 $sql .=
" AND f.fk_soc = ".((int) $socid);
158 if (!$user->hasRight(
'societe',
'client',
'voir')) {
159 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
162 $resql = $db->query($sql);
164 print
'<div class="div-table-responsive-no-min">';
165 print
'<table class="noborder centpercent">';
166 print
'<tr class="liste_titre">';
167 print
'<th colspan="2">'.$langs->trans(
"DraftFichinter").
'</th></tr>';
168 $langs->load(
"interventions");
169 $num = $db->num_rows($resql);
173 $obj = $db->fetch_object($resql);
174 $fichinterstatic->id = $obj->rowid;
175 $fichinterstatic->ref = $obj->ref;
176 print
'<tr class="oddeven">';
177 print
'<td class="nowrap">'.$fichinterstatic->getNomUrl(1).
'</td>';
178 $companystatic->id = $obj->socid;
179 $companystatic->name = $obj->name;
180 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
185 print
"</table></div><br>";
190print
'</div><div class="fichetwothirdright">';
197$sql =
"SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,";
198$sql .=
" s.nom as name, s.rowid as socid";
199$sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f,";
200$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
201if (!$user->hasRight(
'societe',
'client',
'voir')) {
202 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
204$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
205$sql .=
" AND f.fk_soc = s.rowid";
208 $sql .=
" AND f.fk_soc = ".((int) $socid);
210if (!$user->hasRight(
'societe',
'client',
'voir')) {
211 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
213$sql .=
" ORDER BY f.tms DESC";
214$sql .= $db->plimit($max, 0);
216$resql = $db->query($sql);
218 print
'<div class="div-table-responsive-no-min">';
219 print
'<table class="noborder centpercent">';
220 print
'<tr class="liste_titre">';
221 print
'<th colspan="4">'.$langs->trans(
"LastModifiedInterventions", $max).
'</th></tr>';
223 $num = $db->num_rows($resql);
227 $obj = $db->fetch_object($resql);
229 print
'<tr class="oddeven">';
230 print
'<td width="20%" class="nowrap">';
232 $fichinterstatic->id = $obj->rowid;
233 $fichinterstatic->ref = $obj->ref;
235 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
236 print
'<td width="96" class="nobordernopadding nowrap">';
237 print $fichinterstatic->getNomUrl(1);
240 print
'<td width="16" class="nobordernopadding nowrap">';
244 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
247 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
248 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
249 print
'</td></tr></table>';
252 $companystatic->id = $obj->socid;
253 $companystatic->name = $obj->name;
254 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
255 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'day').
'</td>';
256 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
261 print
"</table></div><br>";
263 dol_print_error($db);
272 $sql =
"SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid";
273 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
274 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
275 if (!$user->hasRight(
'societe',
'client',
'voir')) {
276 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
278 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
279 $sql .=
" AND f.fk_soc = s.rowid";
280 $sql .=
" AND f.fk_statut = 1";
282 $sql .=
" AND f.fk_soc = ".((int) $socid);
284 if (!$user->hasRight(
'societe',
'client',
'voir')) {
285 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
287 $sql .=
" ORDER BY f.rowid DESC";
289 $resql = $db->query($sql);
291 $num = $db->num_rows($resql);
293 print
'<div class="div-table-responsive-no-min">';
294 print
'<table class="noborder centpercent">';
295 print
'<tr class="liste_titre">';
296 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>';
301 $obj = $db->fetch_object($resql);
302 print
'<tr class="oddeven">';
303 print
'<td class="nowrap" width="20%">';
305 $fichinterstatic->id = $obj->rowid;
306 $fichinterstatic->ref = $obj->ref;
308 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
309 print
'<td width="96" class="nobordernopadding nowrap">';
310 print $fichinterstatic->getNomUrl(1);
313 print
'<td width="16" class="nobordernopadding nowrap">';
317 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
320 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
321 print $formfile->getDocumentsLink($fichinterstatic->element, $filename, $filedir);
322 print
'</td></tr></table>';
325 $companystatic->id = $obj->socid;
326 $companystatic->name = $obj->name;
327 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
328 print
'<td class="right">'.$fichinterstatic->LibStatut($obj->fk_statut, 5).
'</td>';
334 print
"</table></div><br>";
336 dol_print_error($db);
343print
'<div class="clearboth"></div>';
344print
'<div class="fichecenter fichecenterbis">';
346$boxlist =
'<div class="twocolumns">';
348$boxlist .=
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
350$boxlist .= $resultboxes[
'boxlista'];
351$boxlist .=
"</div>\n";
353$boxlist .=
'<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
354$boxlist .= $resultboxes[
'boxlistb'];
355$boxlist .=
'</div>'.
"\n";
357$boxlist .=
"</div>\n";
363$parameters = array(
'user' => $user);
364$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...)
getThemeBadgeStatusColors()
Return the colors of status badges defined by the current theme (theme_vars.inc.php)
getStatusPieChart($title, $series, $options=array())
Return the HTML table with a pie chart of values by status, as shown on the home page of a module.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.