36require
'../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinterrec.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
52 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcontract.class.php';
62$langs->loadLangs(array(
"interventions",
"admin",
"compta",
"bills"));
67$date_next_execution =
GETPOST(
'date_next_execution',
'alpha');
68$action =
GETPOST(
'action',
'aZ09');
70$backtopage =
GETPOST(
'backtopage',
'alpha');
72if ($user->isExternalUser()) {
73 $socid = $user->isExternalUser();
75$objecttype =
'fichinter_rec';
76if ($action ==
"create" || $action ==
"add") {
82$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
83$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
85if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
89$offset = $limit * $page;
94$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
95$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
96if ($sortorder ==
"") {
100if ($sortfield ==
"") {
101 $sortfield =
"f.datec";
107 'f.title' => array(
'label' =>
"Ref",
'checked' => 1),
108 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1),
109 'f.fk_contrat' => array(
'label' =>
"Contract",
'checked' => 1),
110 'f.duree' => array(
'label' =>
"Duration",
'checked' => 1),
111 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 1),
112 'f.frequency' => array(
'label' =>
"RecurringInvoiceTemplate",
'checked' => 1),
113 'f.nb_gen_done' => array(
'label' =>
"NbOfGenerationDoneShort",
'checked' => 1),
114 'f.date_last_gen' => array(
'label' =>
"DateLastGeneration",
'checked' => 1),
115 'f.date_when' => array(
'label' =>
"NextDateToExecution",
'checked' => 1),
116 'f.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
117 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
122$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
123$permissiontodelete = $user->hasRight(
'ficheinter',
'supprimer');
132 if (!empty($backtopageforcancel)) {
133 header(
"Location: ".$backtopageforcancel);
135 } elseif (!empty($backtopage)) {
136 header(
"Location: ".$backtopage);
143if ($action ==
'add' && $permissiontoadd) {
145 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Title")),
null,
'errors');
151 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Customer")),
null,
'errors');
158 $rec_year =
GETPOST(
'rec_year');
159 $rec_month =
GETPOST(
'rec_month');
161 $rec_hour =
GETPOST(
'rec_hour');
165 if (empty($rec_year) || empty($rec_month) || empty($rec_day)) {
166 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Date")),
null,
'errors');
170 $date_next_execution =
dol_mktime((
int) $rec_hour, (
int) $rec_min, 0, (
int) $rec_month, (
int) $rec_day, (
int) $rec_year);
172 if ($nb_gen_max === 0) {
173 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"MaxPeriodNumber")),
null,
'errors');
187 $object->frequency = $frequency;
189 $object->nb_gen_max = $nb_gen_max;
192 $object->date_when = $date_next_execution;
194 if (
$object->create($user) > 0) {
202} elseif ($action ==
'createfrommodel' && $permissiontoadd) {
210 $newinter->socid =
$object->socid;
211 $newinter->fk_project =
$object->fk_project;
212 $newinter->fk_contrat =
$object->fk_contrat;
217 $newinter->entity =
$object->entity;
218 $newinter->duration =
$object->duration;
220 $newinter->description =
$object->description;
221 $newinter->note_private =
$object->note_private;
222 $newinter->note_public =
$object->note_public;
225 $extrafields->fetch_name_optionals_label($newinter->table_element);
227 $array_options = $extrafields->getOptionalsFromPost($newinter->table_element);
228 $newinter->array_options = $array_options;
230 $newfichinterid = $newinter->create($user);
232 if ($newfichinterid > 0) {
234 foreach (
$object->lines as $line) {
235 $newinter->addline($user, $newfichinterid, $line->desc,
dol_now(), $line->duree, array());
241 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/card.php?id='.$newfichinterid);
247} elseif ($action ==
'delete' && $permissiontodelete) {
252 header(
'Location: '.$_SERVER[
"PHP_SELF"]);
254} elseif ($action ==
'setfrequency' && $permissiontoadd) {
258} elseif ($action ==
'setdate_when' && $permissiontoadd) {
265} elseif ($action ==
'setnb_gen_max' && $permissiontoadd) {
278llxHeader(
'', $langs->trans(
"RepeatableIntervention"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card-rec');
283$contratstatic =
null;
284$projectstatic =
null;
294$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
300if ($action ==
'create') {
301 print
load_fiche_titre($langs->trans(
"CreateRepeatableIntervention"),
'',
'intervention');
306 if (
$object->fetch($id, $ref) > 0) {
307 print
'<form action="card-rec.php" method="post">';
308 print
'<input type="hidden" name="token" value="'.newToken().
'">';
309 print
'<input type="hidden" name="action" value="add">';
310 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
311 print
'<input type="hidden" name="fichinterid" value="'.$object->id.
'">';
323 print
'<table class="border centpercent">';
328 print
'<tr><td>'.$langs->trans(
"Customer").
'</td><td>';
329 print $form->select_company(
$object->thirdparty->id,
'socid',
'', 0, 1);
333 print $langs->trans(
"Comment");
337 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Title").
'</td><td>';
338 print
'<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(
GETPOST(
"title",
"alphanohtml")).
'">';
342 print
'<td rowspan="'.$rowspan.
'" valign="top">';
343 print
'<textarea class="flat" name="description" wrap="soft" cols="60" rows="'.ROWS_4.
'">';
344 print
$object->description.
'</textarea>';
348 print
"<tr><td>".$langs->trans(
"Author").
"</td><td>".$user->getFullName($langs).
"</td></tr>";
352 print
'<tr><td>'.$langs->trans(
"TotalDuration").
'</td>';
353 print
'<td colspan="3">'.convertSecondToTime(
$object->duration,
'all',
$conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
360 print
"<tr><td>".$langs->trans(
"Project").
"</td><td>";
363 $numprojet = $formproject->select_projects(
$object->thirdparty->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'');
364 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.
$object->thirdparty->id;
365 print
'&action=create&status=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"]).
'?action=create';
366 print
'&socid='.$object->thirdparty->id.(!empty($id) ?
'&id='.$id :
'').
'">';
367 print $langs->trans(
"AddProject").
'</a>';
377 print
"<tr><td>".$langs->trans(
"Contract").
"</td><td>";
379 $numcontract = $formcontract->select_contract(
$object->thirdparty->id, $contractid,
'contracttid');
389 $title = $langs->trans(
"Recurrence");
392 print
'<table class="border centpercent">';
395 print
'<tr><td class="titlefieldcreate">';
396 print $form->textwithpicto($langs->trans(
"Frequency"), $langs->transnoentitiesnoconv(
'toolTipFrequency'));
398 print
'<input type="text" name="frequency" value="'.GETPOSTINT(
'frequency').
'" size="4"> ';
399 print $form->selectarray(
'unit_frequency', array(
'd' => $langs->trans(
'Day'),
'm' => $langs->trans(
'Month'),
'y' => $langs->trans(
'Year')), (
GETPOST(
'unit_frequency') ?
GETPOST(
'unit_frequency') :
'm'));
403 print
"<tr><td>".$langs->trans(
'NextDateToExecution').
"</td><td>";
404 if (empty($date_next_execution)) {
407 print $form->selectDate($date_next_execution,
'rec_', 1, 1, 0,
"add", 1, 1);
411 print
"<tr><td>".$langs->trans(
"MaxPeriodNumber").
"</td><td>";
412 print
'<input type="text" name="nb_gen_max" value="'.GETPOSTINT(
'nb_gen_max').
'" size="5">';
419 $title = $langs->trans(
"ProductsAndServices");
421 $title = $langs->trans(
"Products");
423 $title = $langs->trans(
"Services");
431 print
'<table class="notopnoleftnoright" width="100%">';
432 print
'<tr><td colspan="3">';
434 $sql =
'SELECT l.rowid, l.description, l.duree';
435 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinterdet as l";
436 $sql .=
" WHERE l.fk_fichinter= ".((int)
$object->id);
438 $sql .=
" ORDER BY l.rang";
440 $result =
$db->query($sql);
442 $num =
$db->num_rows($result);
446 echo
'<table class="noborder centpercent">';
448 print
'<tr class="liste_titre">';
449 print
'<td>'.$langs->trans(
"Description").
'</td>';
450 print
'<td class="center">'.$langs->trans(
"Duration").
'</td>';
454 $objp =
$db->fetch_object($result);
455 print
'<tr class="oddeven">';
460 print
'<a name="'.$objp->rowid.
'"></a>';
462 $text =
img_object($langs->trans(
'Service'),
'service');
464 print $text.
' '.nl2br($objp->description);
467 print
'<td class="center">'.convertSecondToTime($objp->duree).
'</td>';
484 print $form->buttonsSaveCancel(
"Create");
490} elseif ($action ==
'selsocforcreatefrommodel') {
491 print
load_fiche_titre($langs->trans(
"CreateRepeatableIntervention"),
'',
'intervention');
494 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
495 print
'<table class="border centpercent">';
496 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
497 print $form->select_company(
'',
'socid',
'', 1, 1);
503 print
'<input type="hidden" name="action" value="createfrommodel">';
504 print
'<input type="hidden" name="id" value="'.$id.
'">';
505 print
'<input type="hidden" name="token" value="'.newToken().
'">';
506 print $form->buttonsSaveCancel(
"CreateDraftIntervention",
'');
517 $author->fetch((
int)
$object->user_author_id);
524 $linkback =
'<a href="card-rec.php">'.$langs->trans(
"BackToList").
'</a>';
526 $morehtmlref =
'<div class="refidno">';
529 $morehtmlref .= $langs->trans(
'ThirdParty').
' : '.
$object->thirdparty->getNomUrl(1);
533 $langs->load(
"projects");
534 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
535 if ($user->hasRight(
'ficheinter',
'creer')) {
536 if ($action !=
'classify') {
537 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">';
538 $morehtmlref .=
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
540 if ($action ==
'classify') {
541 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
542 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
543 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
544 $morehtmlref .= $formproject->select_projects(
$object->socid, (
string)
$object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1);
545 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
546 $morehtmlref .=
'</form>';
548 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid, (
string)
$object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
551 if (!empty(
$object->fk_project)) {
553 $proj->fetch(
$object->fk_project);
554 $morehtmlref .=
' : '.$proj->getNomUrl(1);
556 $morehtmlref .=
' - '.$proj->title;
563 $morehtmlref .=
'</div>';
565 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
567 print
'<div class="fichecenter">';
568 print
'<div class="fichehalfleft">';
569 print
'<div class="underbanner clearboth"></div>';
571 print
'<table class="border centpercent">';
573 print
"<tr><td>".$langs->trans(
"Author").
'</td><td colspan="3">'.$author->getFullName($langs).
"</td></tr>";
577 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
578 print
'<td colspan="3">';
583 print
'<tr><td>'.$langs->trans(
"Description").
'</td><td colspan="3">'.nl2br(
$object->description).
"</td></tr>";
586 if (
isModEnabled(
'contract') && $contratstatic !==
null) {
590 $langs->load(
'contracts');
594 print
'<table class="nobordernopadding" width="100%"><tr><td>';
595 print $langs->trans(
'Contract');
597 if ($action !=
'contrat') {
598 print
'<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.
$object->id.
'&token='.newToken().
'">';
599 print
img_edit($langs->trans(
'SetContract'), 1);
602 print
'</tr></table>';
604 if ($action ==
'contrat') {
606 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1);
610 $contratstatic->fetch(
$object->fk_contrat);
611 print $contratstatic->getNomUrl(0, 0, 1);
623 print
'<div class="fichehalfright">';
624 print
'<div class="underbanner clearboth"></div>';
626 $title = $langs->trans(
"Recurrence");
629 print
'<table class="border centpercent">';
632 print
'<tr><td class="titlefield">';
633 print
'<table class="nobordernopadding" width="100%"><tr><td>';
634 print $langs->trans(
'Frequency');
636 if ($action !=
'editfrequency' && $user->hasRight(
'ficheinter',
'creer')) {
637 print
'<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=editfrequency&token='.newToken().
'&id='.
$id.
'">';
638 print
img_edit($langs->trans(
'Edit'), 1).
'</a></td>';
640 print
'</tr></table>';
642 if ($action ==
'editfrequency') {
643 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
644 print
'<input type="hidden" name="action" value="setfrequency">';
645 print
'<input type="hidden" name="token" value="'.newToken().
'">';
646 print
'<table class="nobordernopadding">';
648 print
'<input type="text" name="frequency" value="'.$object->frequency.
'" size="5"> ';
649 print $form->selectarray(
'unit_frequency', array(
'd' => $langs->trans(
'Day'),
'm' => $langs->trans(
'Month'),
'y' => $langs->trans(
'Year')), (
$object->unit_frequency ?
$object->unit_frequency :
'm'));
651 print
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
652 print
'</tr></table></form>';
655 print $langs->trans(
'FrequencyPer_'.
$object->unit_frequency,
$object->frequency);
657 print $langs->trans(
"NotARecurringInterventionalTemplate");
664 if ($user->hasRight(
'ficheinter',
'creer') && ($action ==
'date_when' ||
$object->frequency > 0)) {
665 print $form->editfieldkey($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'ficheinter',
'creer'),
'day');
667 print $langs->trans(
"NextDateToExecution");
670 if ($action ==
'date_when' ||
$object->frequency > 0) {
671 print $form->editfieldval($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'ficheinter',
'creer'),
'day');
678 if ($user->hasRight(
'ficheinter',
'creer') && ($action ==
'nb_gen_max' ||
$object->frequency > 0)) {
679 print $form->editfieldkey($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max', (
string)
$object->nb_gen_max, $object, $user->hasRight(
'ficheinter',
'creer'));
681 print $langs->trans(
"MaxPeriodNumber");
685 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
686 print $form->editfieldval($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max',
$object->nb_gen_max ?
$object->nb_gen_max :
'',
$object, $user->hasRight(
'ficheinter',
'creer'));
700 $txtinfoadmin = $langs->trans(
"EnableAndSetupModuleCron", $langs->transnoentitiesnoconv(
"Module2300Name"));
703 print
'<div class="underbanner clearboth"></div>';
704 print
'<table class="border centpercent">';
707 print
'<tr><td class="titlefield">'.$langs->trans(
"NbOfGenerationOfRecordDone").
'</td>';
715 print $langs->trans(
"DateLastGeneration");
727 print
'<div class="clearboth"></div><br>';
733 $title = $langs->trans(
"ProductsAndServices");
735 $title = $langs->trans(
"Products");
737 $title = $langs->trans(
"Services");
742 print
'<table class="noborder centpercent">';
743 print
'<tr class="liste_titre">';
744 print
'<td>'.$langs->trans(
"Description").
'</td>';
745 print
'<td class="center">'.$langs->trans(
"Duration").
'</td>';
753 if (isset(
$object->lines[$i]->product_type)) {
754 $type =
$object->lines[$i]->product_type;
758 if (isset($objp) && is_object($objp)) {
760 if (!empty($objp->date_start)) {
763 if (!empty($objp->date_end)) {
769 print
'<tr class="oddeven">';
771 $text =
img_object($langs->trans(
'Service'),
'service');
772 print $text.
' '.nl2br(
$object->lines[$i]->desc);
775 print
'<td class="center">'.convertSecondToTime(
$object->lines[$i]->duree).
'</td>';
782 print
'<div class="tabsAction">';
784 if ($user->hasRight(
'ficheinter',
'creer')) {
785 print
'<div class="inline-block divButAction">';
786 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=createfrommodel&token='.newToken();
787 print
'&socid='.$object->thirdparty->id.
'&id='.
$object->id.
'">';
788 print $langs->trans(
"AddIntervention").
'</a></div>';
792 print dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.newToken(),
'delete', $user->hasRight(
'ficheinter',
'supprimer'));
796 print $langs->trans(
"ErrorRecordNotFound");
801 $sql =
"SELECT f.rowid as id, s.nom as name, s.rowid as socid, f.title,";
802 $sql .=
" f.duree, f.fk_contrat, f.fk_projet as fk_project, f.frequency, f.nb_gen_done, f.nb_gen_max,";
803 $sql .=
" f.date_last_gen, f.date_when, f.datec, f.status";
805 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter_rec as f";
806 $sql .=
" , ".MAIN_DB_PREFIX.
"societe as s ";
807 if (!$user->hasRight(
'societe',
'client',
'voir')) {
808 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
810 $sql .=
" WHERE f.fk_soc = s.rowid";
811 $sql .=
" AND f.entity = ".$conf->entity;
812 if (!empty($socid)) {
813 $sql .=
" AND s.rowid = ".((int) $socid);
815 if (!$user->hasRight(
'societe',
'client',
'voir')) {
816 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
823 if (!empty($search_societe)) {
826 if (!empty($search_frequency) && $search_frequency ==
'1') {
827 $sql .=
' AND f.frequency > 0';
829 if (isset($search_frequency) && (
string) $search_frequency ==
'0') {
830 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
837 $resql =
$db->query($sql);
839 $num =
$db->num_rows($resql);
841 print_barre_liste($langs->trans(
"RepeatableIntervention"), $page, $_SERVER[
'PHP_SELF'],
"&socid=$socid", $sortfield, $sortorder,
'', $num,
'',
'intervention');
843 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedIntervention").
'</span><br><br>';
846 print
'<table class="noborder centpercent">';
847 print
'<tr class="liste_titre">';
848 print_liste_field_titre(
"Ref", $_SERVER[
'PHP_SELF'],
"f.title",
"",
"",
'width="200px"', $sortfield, $sortorder,
'left ');
849 print_liste_field_titre(
"Company", $_SERVER[
'PHP_SELF'],
"s.nom",
"",
"",
'width="200px"', $sortfield, $sortorder,
'left ');
851 print_liste_field_titre(
"Contract", $_SERVER[
'PHP_SELF'],
"f.fk_contrat",
"",
"",
'width="100px"', $sortfield, $sortorder,
'left ');
854 print_liste_field_titre(
"Project", $_SERVER[
'PHP_SELF'],
"f.fk_project",
"",
"",
'width="100px"', $sortfield, $sortorder,
'left ');
856 print_liste_field_titre(
"Duration", $_SERVER[
'PHP_SELF'],
'f.duree',
'',
'',
'width="50px"', $sortfield, $sortorder,
'right ');
858 print_liste_field_titre(
"Frequency", $_SERVER[
'PHP_SELF'],
"f.frequency",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
859 print_liste_field_titre(
"NbOfGenerationDoneShort", $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
860 print_liste_field_titre(
"DateLastGeneration", $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
861 print_liste_field_titre(
"NextDateToIntervention", $_SERVER[
'PHP_SELF'],
"f.date_when",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
862 print
'<th width="100px"></th>';
869 while ($i < min($num, $limit)) {
870 $objp =
$db->fetch_object($resql);
871 $fichinterrecstatic->id = $objp->id;
872 $fichinterrecstatic->ref = $objp->title;
873 $fichinterrecstatic->title = $objp->title;
875 print
'<tr class="oddeven">';
876 print
'<td>'.$fichinterrecstatic->getNomUrl(1).
"</td>\n";
878 $companystatic->id = $objp->socid;
879 $companystatic->name = $objp->name;
880 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
882 print
'<td>'.$langs->trans(
"None").
'</td>';
885 if (
isModEnabled(
'contract') && $contratstatic !==
null) {
887 if ($objp->fk_contrat > 0) {
888 $contratstatic->fetch($objp->fk_contrat);
889 print $contratstatic->getNomUrl(1);
893 if (
isModEnabled(
'project') && $projectstatic !==
null) {
895 if ($objp->fk_project > 0) {
896 $projectstatic->fetch($objp->fk_project);
897 print $projectstatic->getNomUrl(1);
902 print
'<td class=right>'.convertSecondToTime($objp->duree).
'</td>';
904 print
'<td class="center">'.yn($objp->frequency ? 1 : 0).
'</td>';
906 print
'<td class="center">';
907 if ($objp->frequency) {
908 print $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'');
911 print
'<td class="center">';
915 print
'<td class="center">';
919 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
921 print
'<td class="center">';
922 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
924 print
'<td class="center">';
925 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
929 if ($user->hasRight(
'ficheinter',
'creer')) {
931 print
'<td class="center">';
932 if ($user->hasRight(
'ficheinter',
'creer')) {
933 if (empty($objp->frequency) ||
$db->jdate($objp->date_when) <= $today) {
934 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=createfrommodel';
935 print
'&socid='.$objp->socid.
'&id='.$objp->id.
'&token='.newToken().
'">';
936 print $langs->trans(
"NewIntervention").
'</a>';
938 print $langs->trans(
"DateIsNotEnough");
951 print
'<tr class="oddeven"><td colspan="10"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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.
Class to manage recurring interventions.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
fichinter_rec_prepare_head($object)
Prepare array with list of tabs.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
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.