28require
"../main.inc.php";
29require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
30require_once DOL_DOCUMENT_ROOT.
"/product/class/product.class.php";
35$hookmanager->initHooks(array(
'contractindex'));
38$langs->loadLangs(array(
'products',
'companies',
'contracts'));
40$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
41$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
42$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
49if (!empty($user->socid)) {
50 $socid = $user->socid;
54$staticcompany =
new Societe($db);
55$staticcontrat =
new Contrat($db);
57$productstatic =
new Product($db);
73$title = $langs->trans(
"ContractsArea");
81print
'<div class="fichecenter"><div class="fichethirdleft">';
95$sql =
"SELECT count(cd.rowid) as nb, cd.statut as status";
96$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
97$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd, ".MAIN_DB_PREFIX.
"contrat as c";
98if (empty($user->rights->societe->client->voir) && !$socid) {
99 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
101$sql .=
" WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
102$sql .=
" AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate($now).
"')))";
103$sql .=
" AND c.entity IN (".getEntity(
'contract', 0).
")";
105 $sql .=
' AND c.fk_soc = '.((int) $user->socid);
107if (empty($user->rights->societe->client->voir) && !$socid) {
108 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
110$sql .=
" GROUP BY cd.statut";
111$resql = $db->query($sql);
113 $num = $db->num_rows($resql);
116 $obj = $db->fetch_object($resql);
118 $nb[$obj->status] = $obj->nb;
119 if ($obj->status != 5) {
120 $vals[$obj->status] = $obj->nb;
121 $totalinprocess += $obj->nb;
132$sql =
"SELECT count(cd.rowid) as nb, cd.statut as status";
133$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
134$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd, ".MAIN_DB_PREFIX.
"contrat as c";
135if (empty($user->rights->societe->client->voir) && !$socid) {
136 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
138$sql .=
" WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
139$sql .=
" AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now).
"')";
140$sql .=
" AND c.entity IN (".getEntity(
'contract', 0).
")";
142 $sql .=
' AND c.fk_soc = '.((int) $user->socid);
144if (empty($user->rights->societe->client->voir) && !$socid) {
145 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
147$sql .=
" GROUP BY cd.statut";
148$resql = $db->query($sql);
150 $num = $db->num_rows($resql);
155 $obj = $db->fetch_object($resql);
157 $nb[$obj->status.true] = $obj->nb;
158 if ($obj->status != 5) {
159 $vals[$obj->status.true] = $obj->nb;
160 $totalinprocess += $obj->nb;
171$colorseries = array();
173include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
175print
'<div class="div-table-responsive-no-min">';
176print
'<table class="noborder nohover centpercent">';
177print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Services").
'</th></tr>'.
"\n";
178$listofstatus = array(0, 4, 4, 5); $bool =
false;
179foreach ($listofstatus as $status) {
180 $dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool]) ? (int) $nb[$status.$bool] : 0));
181 if ($status == ContratLigne::STATUS_INITIAL) {
182 $colorseries[$status.$bool] =
'-'.$badgeStatus0;
184 if ($status == ContratLigne::STATUS_OPEN && !$bool) {
185 $colorseries[$status.$bool] = $badgeStatus4;
187 if ($status == ContratLigne::STATUS_OPEN && $bool) {
188 $colorseries[$status.$bool] = $badgeStatus1;
190 if ($status == ContratLigne::STATUS_CLOSED) {
191 $colorseries[$status.$bool] = $badgeStatus6;
194 if (empty($conf->use_javascript_ajax)) {
195 print
'<tr class="oddeven">';
196 print
'<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).
'</td>';
197 print
'<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ?
'&filter=expired' :
'').
'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).
' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).
'</a></td>';
200 if ($status == 4 && !$bool) {
206if (!empty($conf->use_javascript_ajax)) {
207 print
'<tr class="impair"><td class="center" colspan="2">';
209 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
211 $dolgraph->SetData($dataseries);
212 $dolgraph->SetDataColor(array_values($colorseries));
213 $dolgraph->setShowLegend(2);
214 $dolgraph->setShowPercent(1);
215 $dolgraph->SetType(array(
'pie'));
216 $dolgraph->setHeight(
'200');
217 $dolgraph->draw(
'idgraphstatus');
218 print $dolgraph->show($total ? 0 : 1);
222$listofstatus = array(0, 4, 4, 5); $bool =
false;
223foreach ($listofstatus as $status) {
224 if (empty($conf->use_javascript_ajax)) {
225 print
'<tr class="oddeven">';
226 print
'<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).
'</td>';
227 print
'<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ?
'&filter=expired' :
'').
'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).
' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).
'</a></td>';
228 if ($status == 4 && !$bool) {
236print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
237print
"</table></div><br>";
242if (isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire')) {
243 $sql =
"SELECT c.rowid, c.ref,";
244 $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";
245 $sql .=
" FROM ".MAIN_DB_PREFIX.
"contrat as c, ".MAIN_DB_PREFIX.
"societe as s";
246 if (empty($user->rights->societe->client->voir) && !$socid) {
247 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
249 $sql .=
" WHERE s.rowid = c.fk_soc";
250 $sql .=
" AND c.entity IN (".getEntity(
'contract', 0).
")";
251 $sql .=
" AND c.statut = 0";
252 if (empty($user->rights->societe->client->voir) && !$socid) {
253 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
256 $sql .=
" AND c.fk_soc = ".((int) $socid);
259 $resql = $db->query($sql);
262 $num = $db->num_rows($resql);
264 print
'<div class="div-table-responsive-no-min">';
265 print
'<table class="noborder centpercent">';
266 print
'<tr class="liste_titre">';
267 print
'<th colspan="3">'.$langs->trans(
"DraftContracts").($num ?
'<span class="badge marginleftonlyshort">'.$num.
'</span>' :
'').
'</th></tr>';
272 $obj = $db->fetch_object($resql);
274 $staticcontrat->ref = $obj->ref;
275 $staticcontrat->id = $obj->rowid;
277 $staticcompany->id = $obj->socid;
278 $staticcompany->name = $obj->name;
279 $staticcompany->name_alias = $obj->name_alias;
280 $staticcompany->photo = 1;
281 $staticcompany->code_client = $obj->code_client;
282 $staticcompany->code_fournisseur = $obj->code_fournisseur;
283 $staticcompany->code_compta = $obj->code_compta;
284 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
285 $staticcompany->client = $obj->client;
286 $staticcompany->fournisseur = $obj->fournisseur;
288 print
'<tr class="oddeven"><td class="nowrap">';
289 print $staticcontrat->getNomUrl(1,
'');
292 print $staticcompany->getNomUrl(1,
'', 16);
299 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoContracts").
'</span></td></tr>';
301 print
"</table></div><br>";
309print
'</div><div class="fichetwothirdright">';
315$sql .=
" sum(".$db->ifsql(
"cd.statut=0", 1, 0).
') as nb_initial,';
316$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,';
317$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,';
318$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,';
319$sql .=
" sum(".$db->ifsql(
"cd.statut=5", 1, 0).
') as nb_closed,';
320$sql .=
" c.rowid as cid, c.ref, c.datec, c.tms, c.statut,";
321$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";
322$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,";
323if (empty($user->rights->societe->client->voir) && !$socid) {
324 $sql .=
" ".MAIN_DB_PREFIX.
"societe_commerciaux as sc,";
326$sql .=
" ".MAIN_DB_PREFIX.
"contrat as c";
327$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contratdet as cd ON c.rowid = cd.fk_contrat";
328$sql .=
" WHERE c.fk_soc = s.rowid";
329$sql .=
" AND c.entity IN (".getEntity(
'contract', 0).
")";
330$sql .=
" AND c.statut > 0";
331if (empty($user->rights->societe->client->voir) && !$socid) {
332 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
335 $sql .=
" AND s.rowid = ".((int) $socid);
337$sql .=
" GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut,";
338$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";
339$sql .=
" ORDER BY c.tms DESC";
340$sql .= $db->plimit($max);
343$result = $db->query($sql);
345 $num = $db->num_rows($result);
348 print
'<div class="div-table-responsive-no-min">';
349 print
'<table class="noborder centpercent">';
351 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"LastContracts", 5).
'</th>';
352 print
'<th class="center">'.$langs->trans(
"DateModification").
'</th>';
354 print
'<th class="center" width="80" colspan="4">'.$langs->trans(
"Services").
'</th>';
358 $obj = $db->fetch_object($result);
359 $datem = $db->jdate($obj->tms);
361 $staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->cid);
362 $staticcontrat->id = $obj->cid;
364 $staticcompany->id = $obj->socid;
365 $staticcompany->name = $obj->name;
366 $staticcompany->name_alias = $obj->name_alias;
367 $staticcompany->photo = 1;
368 $staticcompany->code_client = $obj->code_client;
369 $staticcompany->code_fournisseur = $obj->code_fournisseur;
370 $staticcompany->code_compta = $obj->code_compta;
371 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
372 $staticcompany->client = $obj->client;
373 $staticcompany->fournisseur = $obj->fournisseur;
375 print
'<tr class="oddeven">';
376 print
'<td class="nowraponall">';
377 print $staticcontrat->getNomUrl(1, 16);
383 print
'<td class="tdoverflowmax150">';
384 print $staticcompany->getNomUrl(1,
'', 20);
386 print
'<td class="center nowraponall" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
390 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>';
391 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>';
392 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>';
393 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>';
399 print
"</table></div>";
407$sql =
"SELECT c.ref, c.fk_soc as socid,";
408$sql .=
" cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
409$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,";
410$sql .=
" p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
411$sql .=
" FROM (".MAIN_DB_PREFIX.
"contrat as c";
412$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
413if (empty($user->rights->societe->client->voir) && !$socid) {
414 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
416$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd";
417$sql .=
") LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
418$sql .=
" WHERE c.entity IN (".getEntity(
'contract', 0).
")";
419$sql .=
" AND cd.fk_contrat = c.rowid";
420$sql .=
" AND c.fk_soc = s.rowid";
421if (empty($user->rights->societe->client->voir) && !$socid) {
422 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
425 $sql .=
" AND s.rowid = ".((int) $socid);
427$sql .=
" ORDER BY cd.tms DESC";
429$resql = $db->query($sql);
431 $num = $db->num_rows($resql);
434 print
'<div class="div-table-responsive-no-min">';
435 print
'<table class="noborder centpercent">';
437 print
'<tr class="liste_titre"><th colspan="4">'.$langs->trans(
"LastModifiedServices", $max).
'</th>';
440 while ($i < min($num, $max)) {
441 $obj = $db->fetch_object($resql);
443 print
'<tr class="oddeven">';
444 print
'<td class="nowraponall">';
446 $staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
447 $staticcontrat->id = $obj->fk_contrat;
449 $staticcompany->id = $obj->socid;
450 $staticcompany->name = $obj->name;
451 $staticcompany->name_alias = $obj->name_alias;
452 $staticcompany->photo = 1;
453 $staticcompany->code_client = $obj->code_client;
454 $staticcompany->code_fournisseur = $obj->code_fournisseur;
455 $staticcompany->code_compta = $obj->code_compta;
456 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
457 $staticcompany->client = $obj->client;
458 $staticcompany->fournisseur = $obj->fournisseur;
460 print $staticcontrat->getNomUrl(1, 16);
465 if ($obj->fk_product > 0) {
466 $productstatic->id = $obj->fk_product;
467 $productstatic->type = $obj->ptype;
468 $productstatic->ref = $obj->pref;
469 $productstatic->entity = $obj->pentity;
470 print $productstatic->getNomUrl(1,
'', 20);
472 print
'<a href="'.DOL_URL_ROOT.
'/contrat/card.php?id='.$obj->fk_contrat.
'">'.
img_object($langs->trans(
"ShowService"),
"service");
474 print
' '.dol_trunc($obj->label, 20).
'</a>';
476 print
'</a> '.dol_trunc($obj->note, 20);
480 print
'<td class="tdoverflowmax125">';
481 print $staticcompany->getNomUrl(1,
'', 20);
483 print
'<td class="nowrap right"><a href="'.DOL_URL_ROOT.
'/contrat/card.php?id='.$obj->fk_contrat.
'&ligne='.$obj->cid.
'">';
484 $dateend = $db->jdate($obj->date_fin_validite);
485 print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now) ? 1 : 0);
492 print
"</table></div>";
500$sql =
"SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
501$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,";
502$sql .=
" p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
503$sql .=
" FROM (".MAIN_DB_PREFIX.
"contrat as c";
504$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
505if (empty($user->rights->societe->client->voir) && !$socid) {
506 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
508$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd";
509$sql .=
" ) LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
510$sql .=
" WHERE c.entity IN (".getEntity(
'contract', 0).
")";
511$sql .=
" AND c.statut = 1";
512$sql .=
" AND cd.statut = 0";
513$sql .=
" AND cd.fk_contrat = c.rowid";
514$sql .=
" AND c.fk_soc = s.rowid";
515if (empty($user->rights->societe->client->voir) && !$socid) {
516 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
519 $sql .=
" AND s.rowid = ".((int) $socid);
521$sql .=
" ORDER BY cd.tms DESC";
523$resql = $db->query($sql);
525 $num = $db->num_rows($resql);
528 print
'<div class="div-table-responsive-no-min">';
529 print
'<table class="noborder centpercent">';
531 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>';
535 $obj = $db->fetch_object($resql);
537 $staticcompany->id = $obj->fk_soc;
538 $staticcompany->name = $obj->name;
539 $staticcompany->name_alias = $obj->name_alias;
540 $staticcompany->photo = 1;
541 $staticcompany->code_client = $obj->code_client;
542 $staticcompany->code_fournisseur = $obj->code_fournisseur;
543 $staticcompany->code_compta = $obj->code_compta;
544 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
545 $staticcompany->client = $obj->client;
546 $staticcompany->fournisseur = $obj->fournisseur;
548 $staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
549 $staticcontrat->id = $obj->fk_contrat;
551 $productstatic->id = $obj->fk_product;
552 $productstatic->type = $obj->ptype;
553 $productstatic->ref = $obj->pref;
554 $productstatic->entity = $obj->pentity;
556 print
'<tr class="oddeven">';
558 print
'<td class="nowraponall">';
559 print $staticcontrat->getNomUrl(1, 16);
561 print
'<td class="nowrap">';
562 if ($obj->fk_product > 0) {
563 print $productstatic->getNomUrl(1,
'', 20);
565 print
'<a href="'.DOL_URL_ROOT.
'/contrat/card.php?id='.$obj->fk_contrat.
'">'.
img_object($langs->trans(
"ShowService"),
"service");
567 print
' '.dol_trunc($obj->label, 20).
'</a>';
569 print
'</a> '.dol_trunc($obj->note, 20);
573 print
'<td class="tdoverflowmax125">';
574 print $staticcompany->getNomUrl(1,
'', 20);
576 print
'<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.
'&ligne='.$obj->cid.
'">';
577 print $staticcontratligne->LibStatut($obj->statut, 3);
585 print
"</table></div>";
593$sql =
"SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
594$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,";
595$sql .=
" p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
596$sql .=
" FROM (".MAIN_DB_PREFIX.
"contrat as c";
597$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
598if (empty($user->rights->societe->client->voir) && !$socid) {
599 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
601$sql .=
", ".MAIN_DB_PREFIX.
"contratdet as cd";
602$sql .=
" ) LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
603$sql .=
" WHERE c.entity IN (".getEntity(
'contract', 0).
")";
604$sql .=
" AND c.statut = 1";
605$sql .=
" AND cd.statut = 4";
606$sql .=
" AND cd.date_fin_validite < '".$db->idate($now).
"'";
607$sql .=
" AND cd.fk_contrat = c.rowid";
608$sql .=
" AND c.fk_soc = s.rowid";
609if (empty($user->rights->societe->client->voir) && !$socid) {
610 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
613 $sql .=
" AND s.rowid = ".((int) $socid);
615$sql .=
" ORDER BY cd.tms DESC";
617$resql = $db->query($sql);
619 $num = $db->num_rows($resql);
622 print
'<div class="div-table-responsive-no-min">';
623 print
'<table class="noborder centpercent">';
625 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>';
629 $obj = $db->fetch_object($resql);
631 $staticcompany->id = $obj->fk_soc;
632 $staticcompany->name = $obj->name;
633 $staticcompany->name_alias = $obj->name_alias;
634 $staticcompany->photo = 1;
635 $staticcompany->code_client = $obj->code_client;
636 $staticcompany->code_fournisseur = $obj->code_fournisseur;
637 $staticcompany->code_compta = $obj->code_compta;
638 $staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
639 $staticcompany->client = $obj->client;
640 $staticcompany->fournisseur = $obj->fournisseur;
642 $staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
643 $staticcontrat->id = $obj->fk_contrat;
645 $productstatic->id = $obj->fk_product;
646 $productstatic->type = $obj->ptype;
647 $productstatic->ref = $obj->pref;
648 $productstatic->entity = $obj->pentity;
650 print
'<tr class="oddeven">';
652 print
'<td class="nowraponall">';
653 print $staticcontrat->getNomUrl(1, 16);
655 print
'<td class="nowrap">';
656 if ($obj->fk_product > 0) {
657 print $productstatic->getNomUrl(1,
'', 20);
659 print
'<a href="'.DOL_URL_ROOT.
'/contrat/card.php?id='.$obj->fk_contrat.
'">'.
img_object($langs->trans(
"ShowService"),
"service");
661 print
' '.dol_trunc($obj->label, 20).
'</a>';
663 print
'</a> '.dol_trunc($obj->note, 20);
667 print
'<td class="tdoverflowmax125">';
668 print $staticcompany->getNomUrl(1,
'', 20);
670 print
'<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.
'&ligne='.$obj->cid.
'">';
671 print $staticcontratligne->LibStatut($obj->statut, 3, 1);
678 print
"</table></div>";
686$parameters = array(
'user' => $user);
687$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($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.