29require
"../main.inc.php";
30require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
31require_once DOL_DOCUMENT_ROOT.
"/product/class/product.class.php";
36$hookmanager->initHooks(array(
'contractindex'));
39$langs->loadLangs(array(
'products',
'companies',
'contracts'));
41$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
42$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52if (!empty($user->socid)) {
53 $socid = $user->socid;
57$staticcompany =
new Societe($db);
58$staticcontrat =
new Contrat($db);
60$productstatic =
new Product($db);
77$title = $langs->trans(
"ContractsArea");
85print
'<div class="fichecenter"><div class="fichethirdleft">';
99$sql =
"SELECT count(cd.rowid) as nb, cd.statut as status";
100$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
101$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd, ".MAIN_DB_PREFIX.
"contrat as c";
102if (!$user->hasRight(
'societe',
'client',
'voir')) {
103 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
105$sql .=
" WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
106$sql .=
" AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate($now).
"')))";
107$sql .=
" AND c.entity IN (".getEntity(
'contract', 0).
")";
109 $sql .=
' AND c.fk_soc = '.((int) $user->socid);
111if (!$user->hasRight(
'societe',
'client',
'voir')) {
112 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
114$sql .=
" GROUP BY cd.statut";
115$resql = $db->query($sql);
117 $num = $db->num_rows($resql);
120 $obj = $db->fetch_object($resql);
122 $nb[$obj->status] = $obj->nb;
123 if ($obj->status != 5) {
124 $vals[$obj->status] = $obj->nb;
125 $totalinprocess += $obj->nb;
136$sql =
"SELECT count(cd.rowid) as nb, cd.statut as status";
137$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
138$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd, ".MAIN_DB_PREFIX.
"contrat as c";
139if (!$user->hasRight(
'societe',
'client',
'voir')) {
140 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
142$sql .=
" WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
143$sql .=
" AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now).
"')";
144$sql .=
" AND c.entity IN (".getEntity(
'contract', 0).
")";
146 $sql .=
' AND c.fk_soc = '.((int) $user->socid);
148if (!$user->hasRight(
'societe',
'client',
'voir')) {
149 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
151$sql .=
" GROUP BY cd.statut";
152$resql = $db->query($sql);
154 $num = $db->num_rows($resql);
159 $obj = $db->fetch_object($resql);
161 $nb[$obj->status.((string)
true)] = $obj->nb;
162 if ($obj->status != 5) {
163 $vals[$obj->status.((string)
true)] = $obj->nb;
164 $totalinprocess += $obj->nb;
175$colorseries = array();
177include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
179print
'<div class="div-table-responsive-no-min">';
180print
'<table class="noborder nohover centpercent">';
181print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Services").
'</th></tr>'.
"\n";
182$listofstatus = array(0, 4, 4, 5);
184foreach ($listofstatus as $status) {
185 $bool_str = (string) $bool;
186 $dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool_str]) ? (int) $nb[$status.$bool_str] : 0));
187 if ($status == ContratLigne::STATUS_INITIAL) {
188 $colorseries[$status.$bool_str] =
'-'.$badgeStatus0;
190 if ($status == ContratLigne::STATUS_OPEN && !$bool) {
191 $colorseries[$status.$bool_str] = $badgeStatus4;
193 if ($status == ContratLigne::STATUS_OPEN && $bool) {
194 $colorseries[$status.$bool_str] = $badgeStatus1;
196 if ($status == ContratLigne::STATUS_CLOSED) {
197 $colorseries[$status.$bool_str] = $badgeStatus6;
200 if (empty($conf->use_javascript_ajax)) {
201 print
'<tr class="oddeven">';
202 print
'<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).
'</td>';
203 print
'<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ?
'&filter=expired' :
'').
'">'.($nb[$status.$bool_str] ? $nb[$status.$bool_str] : 0).
' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).
'</a></td>';
206 if ($status == 4 && !$bool) {
212if (!empty($conf->use_javascript_ajax)) {
213 print
'<tr class="impair"><td class="center" colspan="2">';
215 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
217 $dolgraph->SetData($dataseries);
218 $dolgraph->SetDataColor(array_values($colorseries));
219 $dolgraph->setShowLegend(2);
220 $dolgraph->setShowPercent(1);
221 $dolgraph->SetType(array(
'pie'));
222 $dolgraph->setHeight(
'200');
223 $dolgraph->draw(
'idgraphstatus');
224 print $dolgraph->show($total ? 0 : 1);
228$listofstatus = array(0, 4, 4, 5);
230foreach ($listofstatus as $status) {
231 $bool_str = (string) $bool;
232 if (empty($conf->use_javascript_ajax)) {
233 print
'<tr class="oddeven">';
234 print
'<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).
'</td>';
235 print
'<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ?
'&filter=expired' :
'').
'">'.($nb[$status.$bool_str] ? $nb[$status.$bool_str] : 0).
' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).
'</a></td>';
236 if ($status == 4 && !$bool) {
244print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
245print
"</table></div><br>";
250if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
251 $sql =
"SELECT c.rowid, c.ref,";
252 $sql .=
" s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
253 $sql .=
" FROM ".MAIN_DB_PREFIX.
"contrat as c, ".MAIN_DB_PREFIX.
"societe as s";
254 if (!$user->hasRight(
'societe',
'client',
'voir')) {
255 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
257 $sql .=
" WHERE s.rowid = c.fk_soc";
258 $sql .=
" AND c.entity IN (".getEntity(
'contract', 0).
")";
259 $sql .=
" AND c.statut = 0";
260 if (!$user->hasRight(
'societe',
'client',
'voir')) {
261 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
264 $sql .=
" AND c.fk_soc = ".((int) $socid);
267 $resql = $db->query($sql);
270 $num = $db->num_rows($resql);
272 print
'<div class="div-table-responsive-no-min">';
273 print
'<table class="noborder centpercent">';
274 print
'<tr class="liste_titre">';
275 print
'<th colspan="3">'.$langs->trans(
"DraftContracts").($num ?
'<span class="badge marginleftonlyshort">'.$num.
'</span>' :
'').
'</th></tr>';
280 $obj = $db->fetch_object($resql);
282 $staticcontrat->ref = $obj->ref;
283 $staticcontrat->id = $obj->rowid;
285 $staticcompany->id = $obj->socid;
286 $staticcompany->name = $obj->name;
287 $staticcompany->name_alias = $obj->name_alias;
288 $staticcompany->logo = $obj->logo;
289 $staticcompany->code_client = $obj->code_client;
290 $staticcompany->code_fournisseur = $obj->code_fournisseur;
291 $staticcompany->code_compta = $obj->code_compta;
292 $staticcompany->code_compta_client = $obj->code_compta;
293 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
294 $staticcompany->client = $obj->client;
295 $staticcompany->fournisseur = $obj->fournisseur;
297 print
'<tr class="oddeven"><td class="nowrap">';
298 print $staticcontrat->getNomUrl(1,
'');
301 print $staticcompany->getNomUrl(1,
'', 16);
308 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoContracts").
'</span></td></tr>';
310 print
"</table></div><br>";
318print
'</div><div class="fichetwothirdright">';
323$sql .=
" sum(".$db->ifsql(
"cd.statut=0", 1, 0).
') as nb_initial,';
324$sql .=
" sum(".$db->ifsql(
"cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now).
"')", 1, 0).
') as nb_running,';
325$sql .=
" sum(".$db->ifsql(
"cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now).
"')", 1, 0).
') as nb_expired,';
326$sql .=
" sum(".$db->ifsql(
"cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay).
"')", 1, 0).
') as nb_late,';
327$sql .=
" sum(".$db->ifsql(
"cd.statut=5", 1, 0).
') as nb_closed,';
328$sql .=
" c.rowid as cid, c.ref, c.datec, c.tms, c.statut,";
329$sql .=
" s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
330$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,";
331if (!$user->hasRight(
'societe',
'client',
'voir')) {
332 $sql .=
" ".MAIN_DB_PREFIX.
"societe_commerciaux as sc,";
334$sql .=
" ".MAIN_DB_PREFIX.
"contrat as c";
335$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contratdet as cd ON c.rowid = cd.fk_contrat";
336$sql .=
" WHERE c.fk_soc = s.rowid";
337$sql .=
" AND c.entity IN (".getEntity(
'contract', 0).
")";
338$sql .=
" AND c.statut > 0";
339if (!$user->hasRight(
'societe',
'client',
'voir')) {
340 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
343 $sql .=
" AND s.rowid = ".((int) $socid);
345$sql .=
" GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut,";
346$sql .=
" s.nom, s.name_alias, s.logo, s.rowid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
347$sql .=
" ORDER BY c.tms DESC";
348$sql .= $db->plimit($max);
351$result = $db->query($sql);
353 $num = $db->num_rows($result);
356 print
'<div class="div-table-responsive-no-min">';
357 print
'<table class="noborder centpercent">';
359 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"LastContracts", $max).
'</th>';
360 print
'<th class="center">'.$langs->trans(
"DateModification").
'</th>';
362 print
'<th class="center" width="80" colspan="4">'.$langs->trans(
"Services").
'</th>';
366 $obj = $db->fetch_object($result);
367 $datem = $db->jdate($obj->tms);
369 $staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->cid);
370 $staticcontrat->id = $obj->cid;
372 $staticcompany->id = $obj->socid;
373 $staticcompany->name = $obj->name;
374 $staticcompany->name_alias = $obj->name_alias;
375 $staticcompany->photo = 1;
376 $staticcompany->code_client = $obj->code_client;
377 $staticcompany->code_fournisseur = $obj->code_fournisseur;
378 $staticcompany->code_compta = $obj->code_compta;
379 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
380 $staticcompany->client = $obj->client;
381 $staticcompany->fournisseur = $obj->fournisseur;
383 print
'<tr class="oddeven">';
384 print
'<td class="nowraponall">';
385 print $staticcontrat->getNomUrl(1, 16);
391 print
'<td class="tdoverflowmax150">';
392 print $staticcompany->getNomUrl(1,
'', 20);
394 print
'<td class="center nowraponall" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
398 print
'<td class="right nowraponall" width="32">'.($obj->nb_initial > 0 ?
'<span class="paddingright">'.$obj->nb_initial.
'</span>'.$staticcontratligne->LibStatut(0, 3, -1,
'class="paddingleft"') :
'').
'</td>';
399 print
'<td class="right nowraponall" width="32">'.($obj->nb_running > 0 ?
'<span class="paddingright">'.$obj->nb_running.
'</span>'.$staticcontratligne->LibStatut(4, 3, 0,
'class="marginleft"') :
'').
'</td>';
400 print
'<td class="right nowraponall" width="32">'.($obj->nb_expired > 0 ?
'<span class="paddingright">'.$obj->nb_expired.
'</span>'.$staticcontratligne->LibStatut(4, 3, 1,
'class="paddingleft"') :
'').
'</td>';
401 print
'<td class="right nowraponall" width="32">'.($obj->nb_closed > 0 ?
'<span class="paddingright">'.$obj->nb_closed.
'</span>'.$staticcontratligne->LibStatut(5, 3, -1,
'class="paddingleft"') :
'').
'</td>';
407 print
"</table></div>";
415$sql =
"SELECT c.ref, c.fk_soc as socid,";
416$sql .=
" cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
417$sql .=
" s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
418$sql .=
" p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
419$sql .=
" FROM (".MAIN_DB_PREFIX.
"contrat as c";
420$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
421if (!$user->hasRight(
'societe',
'client',
'voir')) {
422 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
424$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd";
425$sql .=
") LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
426$sql .=
" WHERE c.entity IN (".getEntity(
'contract', 0).
")";
427$sql .=
" AND cd.fk_contrat = c.rowid";
428$sql .=
" AND c.fk_soc = s.rowid";
429if (!$user->hasRight(
'societe',
'client',
'voir')) {
430 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
433 $sql .=
" AND s.rowid = ".((int) $socid);
435$sql .=
" ORDER BY cd.tms DESC";
437$resql = $db->query($sql);
439 $num = $db->num_rows($resql);
442 print
'<div class="div-table-responsive-no-min">';
443 print
'<table class="noborder centpercent">';
445 print
'<tr class="liste_titre"><th colspan="4">'.$langs->trans(
"LastModifiedServices", $max).
'</th>';
448 while ($i < min($num, $max)) {
449 $obj = $db->fetch_object($resql);
451 print
'<tr class="oddeven">';
452 print
'<td class="nowraponall">';
454 $staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
455 $staticcontrat->id = $obj->fk_contrat;
457 $staticcompany->id = $obj->socid;
458 $staticcompany->name = $obj->name;
459 $staticcompany->name_alias = $obj->name_alias;
460 $staticcompany->photo = 1;
461 $staticcompany->code_client = $obj->code_client;
462 $staticcompany->code_fournisseur = $obj->code_fournisseur;
463 $staticcompany->code_compta = $obj->code_compta;
464 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
465 $staticcompany->client = $obj->client;
466 $staticcompany->fournisseur = $obj->fournisseur;
468 print $staticcontrat->getNomUrl(1, 16);
473 if ($obj->fk_product > 0) {
474 $productstatic->id = $obj->fk_product;
475 $productstatic->type = $obj->ptype;
476 $productstatic->ref = $obj->pref;
477 $productstatic->entity = $obj->pentity;
478 print $productstatic->getNomUrl(1,
'', 20);
480 print
'<a href="'.DOL_URL_ROOT.
'/contrat/card.php?id='.$obj->fk_contrat.
'">'.
img_object($langs->trans(
"ShowService"),
"service");
482 print
' '.dol_trunc($obj->label, 20).
'</a>';
484 print
'</a> '.dol_trunc($obj->note, 20);
488 print
'<td class="tdoverflowmax125">';
489 print $staticcompany->getNomUrl(1,
'', 20);
491 print
'<td class="nowrap right"><a href="'.DOL_URL_ROOT.
'/contrat/card.php?id='.$obj->fk_contrat.
'&ligne='.$obj->cid.
'">';
492 $dateend = $db->jdate($obj->date_fin_validite);
493 print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now) ? 1 : 0);
500 print
"</table></div>";
508$sql =
"SELECT c.ref, c.fk_soc as thirdpartyid, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
509$sql .=
" s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
510$sql .=
" p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
511$sql .=
" FROM (".MAIN_DB_PREFIX.
"contrat as c";
512$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
513if (!$user->hasRight(
'societe',
'client',
'voir')) {
514 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
516$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd";
517$sql .=
" ) LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
518$sql .=
" WHERE c.entity IN (".getEntity(
'contract', 0).
")";
519$sql .=
" AND c.statut = 1";
520$sql .=
" AND cd.statut = 0";
521$sql .=
" AND cd.fk_contrat = c.rowid";
522$sql .=
" AND c.fk_soc = s.rowid";
523if (!$user->hasRight(
'societe',
'client',
'voir')) {
524 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
527 $sql .=
" AND s.rowid = ".((int) $socid);
529$sql .=
" ORDER BY cd.tms DESC";
531$resql = $db->query($sql);
533 $num = $db->num_rows($resql);
536 print
'<div class="div-table-responsive-no-min">';
537 print
'<table class="noborder centpercent">';
539 print
'<tr class="liste_titre"><th colspan="4">'.$langs->trans(
"NotActivatedServices").
' <a href="'.DOL_URL_ROOT.
'/contrat/services_list.php?mode=0"><span class="badge">'.$num.
'</span></a></th>';
543 $obj = $db->fetch_object($resql);
545 $staticcompany->id = $obj->thirdpartyid;
546 $staticcompany->name = $obj->name;
547 $staticcompany->name_alias = $obj->name_alias;
548 $staticcompany->photo = 1;
549 $staticcompany->code_client = $obj->code_client;
550 $staticcompany->code_fournisseur = $obj->code_fournisseur;
551 $staticcompany->code_compta = $obj->code_compta;
552 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
553 $staticcompany->client = $obj->client;
554 $staticcompany->fournisseur = $obj->fournisseur;
556 $staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
557 $staticcontrat->id = $obj->fk_contrat;
559 $productstatic->id = $obj->fk_product;
560 $productstatic->type = $obj->ptype;
561 $productstatic->ref = $obj->pref;
562 $productstatic->entity = $obj->pentity;
564 print
'<tr class="oddeven">';
566 print
'<td class="nowraponall">';
567 print $staticcontrat->getNomUrl(1, 16);
569 print
'<td class="nowrap">';
570 if ($obj->fk_product > 0) {
571 print $productstatic->getNomUrl(1,
'', 20);
573 print
'<a href="'.DOL_URL_ROOT.
'/contrat/card.php?id='.$obj->fk_contrat.
'">'.
img_object($langs->trans(
"ShowService"),
"service");
575 print
' '.dol_trunc($obj->label, 20).
'</a>';
577 print
'</a> '.dol_trunc($obj->note, 20);
581 print
'<td class="tdoverflowmax125">';
582 print $staticcompany->getNomUrl(1,
'', 20);
584 print
'<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.
'&ligne='.$obj->cid.
'">';
585 print $staticcontratligne->LibStatut($obj->statut, 3);
593 print
"</table></div>";
601$sql =
"SELECT c.ref, c.fk_soc as thirdpartyid, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
602$sql .=
" s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
603$sql .=
" p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
604$sql .=
" FROM (".MAIN_DB_PREFIX.
"contrat as c";
605$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
606if (!$user->hasRight(
'societe',
'client',
'voir')) {
607 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
609$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd";
610$sql .=
" ) LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
611$sql .=
" WHERE c.entity IN (".getEntity(
'contract', 0).
")";
612$sql .=
" AND c.statut = 1";
613$sql .=
" AND cd.statut = 4";
614$sql .=
" AND cd.date_fin_validite < '".$db->idate($now).
"'";
615$sql .=
" AND cd.fk_contrat = c.rowid";
616$sql .=
" AND c.fk_soc = s.rowid";
617if (!$user->hasRight(
'societe',
'client',
'voir')) {
618 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
621 $sql .=
" AND s.rowid = ".((int) $socid);
623$sql .=
" ORDER BY cd.tms DESC";
625$resql = $db->query($sql);
627 $num = $db->num_rows($resql);
630 print
'<div class="div-table-responsive-no-min">';
631 print
'<table class="noborder centpercent">';
633 print
'<tr class="liste_titre"><th colspan="4">'.$langs->trans(
"ListOfExpiredServices").
' <a href="'.DOL_URL_ROOT.
'/contrat/services_list.php?search_status=4&filter=expired"><span class="badge">'.$num.
'</span></a></th>';
637 $obj = $db->fetch_object($resql);
639 $staticcompany->id = $obj->thirdpartyid;
640 $staticcompany->name = $obj->name;
641 $staticcompany->name_alias = $obj->name_alias;
642 $staticcompany->photo = 1;
643 $staticcompany->code_client = $obj->code_client;
644 $staticcompany->code_fournisseur = $obj->code_fournisseur;
645 $staticcompany->code_compta = $obj->code_compta;
646 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
647 $staticcompany->client = $obj->client;
648 $staticcompany->fournisseur = $obj->fournisseur;
650 $staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
651 $staticcontrat->id = $obj->fk_contrat;
653 $productstatic->id = $obj->fk_product;
654 $productstatic->type = $obj->ptype;
655 $productstatic->ref = $obj->pref;
656 $productstatic->entity = $obj->pentity;
658 print
'<tr class="oddeven">';
660 print
'<td class="nowraponall">';
661 print $staticcontrat->getNomUrl(1, 16);
663 print
'<td class="nowrap">';
664 if ($obj->fk_product > 0) {
665 print $productstatic->getNomUrl(1,
'', 20);
667 print
'<a href="'.DOL_URL_ROOT.
'/contrat/card.php?id='.$obj->fk_contrat.
'">'.
img_object($langs->trans(
"ShowService"),
"service");
669 print
' '.dol_trunc($obj->label, 20).
'</a>';
671 print
'</a> '.dol_trunc($obj->note, 20);
675 print
'<td class="tdoverflowmax125">';
676 print $staticcompany->getNomUrl(1,
'', 20);
678 print
'<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.
'&ligne='.$obj->cid.
'">';
679 print $staticcontratligne->LibStatut($obj->statut, 3, 1);
686 print
"</table></div>";
694$parameters = array(
'user' => $user);
695$reshook = $hookmanager->executeHooks(
'dashboardContracts', $parameters, $object);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage contracts.
Class to manage lines of contracts.
Class to manage products or services.
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.