36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinterrec.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
43if (isModEnabled(
'project')) {
44 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
47if (isModEnabled(
'contract')) {
48 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcontract.class.php';
53$langs->loadLangs(array(
"interventions",
"admin",
"compta",
"bills"));
58$date_next_execution =
GETPOST(
'date_next_execution',
'alpha');
59$action =
GETPOST(
'action',
'aZ09');
60$cancel =
GETPOST(
'cancel',
'aZ09');
61$backtopage =
GETPOST(
'backtopage',
'alpha');
64 $socid = $user->socid;
66$objecttype =
'fichinter_rec';
67if ($action ==
"create" || $action ==
"add") {
74$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
75$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
77if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
81$offset = $limit * $page;
86$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
87$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
88if ($sortorder ==
"") {
92if ($sortfield ==
"") {
93 $sortfield =
"f.datec";
101 'f.title' => array(
'label' =>
"Ref",
'checked' => 1),
102 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1),
103 'f.fk_contrat' => array(
'label' =>
"Contract",
'checked' => 1),
104 'f.duree' => array(
'label' =>
"Duration",
'checked' => 1),
105 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 1),
106 'f.frequency' => array(
'label' =>
"RecurringInvoiceTemplate",
'checked' => 1),
107 'f.nb_gen_done' => array(
'label' =>
"NbOfGenerationDoneShort",
'checked' => 1),
108 'f.date_last_gen' => array(
'label' =>
"DateLastGeneration",
'checked' => 1),
109 'f.date_when' => array(
'label' =>
"NextDateToExecution",
'checked' => 1),
110 'f.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
111 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
121 if (!empty($backtopageforcancel)) {
122 header(
"Location: ".$backtopageforcancel);
124 } elseif (!empty($backtopage)) {
125 header(
"Location: ".$backtopage);
132if ($action ==
'add') {
134 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Title")),
null,
'errors');
140 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Customer")),
null,
'errors');
154 if (empty($reyear) || empty($remonth) || empty($reday)) {
155 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Date")),
null,
'errors');
159 $date_next_execution =
dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
161 if ($nb_gen_max === 0) {
162 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"MaxPeriodNumber")),
null,
'errors');
176 $object->frequency = $frequency;
178 $object->nb_gen_max = $nb_gen_max;
181 $object->date_when = $date_next_execution;
183 if (
$object->create($user) > 0) {
191} elseif ($action ==
'createfrommodel') {
199 $newinter->socid =
$object->socid;
200 $newinter->fk_project =
$object->fk_project;
201 $newinter->fk_contrat =
$object->fk_contrat;
206 $newinter->entity =
$object->entity;
207 $newinter->duree =
$object->duree;
209 $newinter->description =
$object->description;
210 $newinter->note_private =
$object->note_private;
211 $newinter->note_public =
$object->note_public;
214 $extrafields->fetch_name_optionals_label($newinter->table_element);
216 $array_options = $extrafields->getOptionalsFromPost($newinter->table_element);
217 $newinter->array_options = $array_options;
219 $newfichinterid = $newinter->create($user);
221 if ($newfichinterid > 0) {
223 foreach (
$object->lines as $line) {
224 $newinter->addline($user, $newfichinterid, $line->desc, $line->datei, $line->duree,
'');
230 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/card.php?id='.$newfichinterid);
236} elseif ($action ==
'delete' && $user->hasRight(
'ficheinter',
'supprimer')) {
241 header(
'Location: '.$_SERVER[
"PHP_SELF"]);
243} elseif ($action ==
'setfrequency' && $user->hasRight(
'ficheinter',
'creer')) {
247} elseif ($action ==
'setdate_when' && $user->hasRight(
'ficheinter',
'creer')) {
254} elseif ($action ==
'setnb_gen_max' && $user->hasRight(
'ficheinter',
'creer')) {
267llxHeader(
'', $langs->trans(
"RepeatableIntervention"), $help_url);
269$form =
new Form($db);
270$companystatic =
new Societe($db);
271if (isModEnabled(
'contract')) {
272 $contratstatic =
new Contrat($db);
274if (isModEnabled(
'project')) {
275 $projectstatic =
new Project($db);
280$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
287if ($action ==
'create') {
288 print
load_fiche_titre($langs->trans(
"CreateRepeatableIntervention"),
'',
'intervention');
293 if (
$object->fetch($id, $ref) > 0) {
294 print
'<form action="card-rec.php" method="post">';
295 print
'<input type="hidden" name="token" value="'.newToken().
'">';
296 print
'<input type="hidden" name="action" value="add">';
297 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
298 print
'<input type="hidden" name="fichinterid" value="'.$object->id.
'">';
303 if (isModEnabled(
'project') &&
$object->fk_project > 0) {
306 if (isModEnabled(
'contract') &&
$object->fk_contrat > 0) {
310 print
'<table class="border centpercent">';
315 print
'<tr><td>'.$langs->trans(
"Customer").
'</td><td>';
316 print $form->select_company(
$object->thirdparty->id,
'socid',
'', 0, 1);
320 print $langs->trans(
"Comment");
324 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Title").
'</td><td>';
325 print
'<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(
GETPOST(
"title",
"alphanohtml")).
'">';
329 print
'<td rowspan="'.$rowspan.
'" valign="top">';
330 print
'<textarea class="flat" name="description" wrap="soft" cols="60" rows="'.ROWS_4.
'">';
331 print
$object->description.
'</textarea>';
335 print
"<tr><td>".$langs->trans(
"Author").
"</td><td>".$user->getFullName($langs).
"</td></tr>";
339 print
'<tr><td>'.$langs->trans(
"TotalDuration").
'</td>';
340 print
'<td colspan="3">'.convertSecondToTime(
$object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
345 if (isModEnabled(
'project')) {
347 print
"<tr><td>".$langs->trans(
"Project").
"</td><td>";
350 $numprojet = $formproject->select_projects(
$object->thirdparty->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'');
351 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.
$object->thirdparty->id;
352 print
'&action=create&status=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"]).
'?action=create';
353 print
'&socid='.$object->thirdparty->id.(!empty($id) ?
'&id='.$id :
'').
'">';
354 print $langs->trans(
"AddProject").
'</a>';
359 if (isModEnabled(
'contract')) {
361 print
"<tr><td>".$langs->trans(
"Contract").
"</td><td>";
363 $numcontract = $formcontract->select_contract(
$object->thirdparty->id, $contractid,
'contracttid');
372 $title = $langs->trans(
"Recurrence");
375 print
'<table class="border centpercent">';
378 print
'<tr><td class="titlefieldcreate">';
379 print $form->textwithpicto($langs->trans(
"Frequency"), $langs->transnoentitiesnoconv(
'toolTipFrequency'));
381 print
'<input type="text" name="frequency" value="'.GETPOSTINT(
'frequency').
'" size="4"> ';
382 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'));
386 print
"<tr><td>".$langs->trans(
'NextDateToExecution').
"</td><td>";
387 if (empty($date_next_execution)) {
390 print $form->selectDate($date_next_execution,
'', 1, 1, 0,
"add", 1, 1);
394 print
"<tr><td>".$langs->trans(
"MaxPeriodNumber").
"</td><td>";
395 print
'<input type="text" name="nb_gen_max" value="'.GETPOSTINT(
'nb_gen_max').
'" size="5">';
402 $title = $langs->trans(
"ProductsAndServices");
403 if (!isModEnabled(
"service")) {
404 $title = $langs->trans(
"Products");
405 } elseif (!isModEnabled(
"product")) {
406 $title = $langs->trans(
"Services");
414 print
'<table class="notopnoleftnoright" width="100%">';
415 print
'<tr><td colspan="3">';
417 $sql =
'SELECT l.rowid, l.description, l.duree';
418 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinterdet as l";
419 $sql .=
" WHERE l.fk_fichinter= ".((int)
$object->id);
421 $sql .=
" ORDER BY l.rang";
423 $result = $db->query($sql);
425 $num = $db->num_rows($result);
429 echo
'<table class="noborder centpercent">';
431 print
'<tr class="liste_titre">';
432 print
'<td>'.$langs->trans(
"Description").
'</td>';
433 print
'<td class="center">'.$langs->trans(
"Duration").
'</td>';
437 $objp = $db->fetch_object($result);
438 print
'<tr class="oddeven">';
443 print
'<a name="'.$objp->rowid.
'"></a>';
445 $text =
img_object($langs->trans(
'Service'),
'service');
447 print $text.
' '.nl2br($objp->description);
450 print
'<td class="center">'.convertSecondToTime($objp->duree).
'</td>';
467 print $form->buttonsSaveCancel(
"Create");
473} elseif ($action ==
'selsocforcreatefrommodel') {
474 print
load_fiche_titre($langs->trans(
"CreateRepeatableIntervention"),
'',
'intervention');
477 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
478 print
'<table class="border centpercent">';
479 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
480 print $form->select_company(
'',
'socid',
'', 1, 1);
486 print
'<input type="hidden" name="action" value="createfrommodel">';
487 print
'<input type="hidden" name="id" value="'.$id.
'">';
488 print
'<input type="hidden" name="token" value="'.newToken().
'">';
489 print $form->buttonsSaveCancel(
"CreateDraftIntervention",
'');
501 $author =
new User($db);
502 $author->fetch(
$object->user_author);
506 print
dol_get_fiche_head($head,
'card', $langs->trans(
"PredefinedInterventional"), 0,
'intervention');
509 $linkback =
'<a href="card-rec.php">'.$langs->trans(
"BackToList").
'</a>';
511 $morehtmlref =
'<div class="refidno">';
514 $morehtmlref .= $langs->trans(
'ThirdParty').
' : '.
$object->thirdparty->getNomUrl(1);
516 if (isModEnabled(
'project')) {
518 $langs->load(
"projects");
519 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
520 if ($user->hasRight(
'ficheinter',
'creer')) {
521 if ($action !=
'classify') {
522 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">';
523 $morehtmlref .=
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
525 if ($action ==
'classify') {
526 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
527 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
528 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
529 $morehtmlref .= $formproject->select_projects(
$object->socid,
$object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
530 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
531 $morehtmlref .=
'</form>';
533 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
536 if (!empty(
$object->fk_project)) {
538 $proj->fetch(
$object->fk_project);
539 $morehtmlref .=
' : '.$proj->getNomUrl(1);
541 $morehtmlref .=
' - '.$proj->title;
548 $morehtmlref .=
'</div>';
550 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
552 print
'<div class="fichecenter">';
553 print
'<div class="fichehalfleft">';
554 print
'<div class="underbanner clearboth"></div>';
556 print
'<table class="border centpercent">';
558 print
"<tr><td>".$langs->trans(
"Author").
'</td><td colspan="3">'.$author->getFullName($langs).
"</td></tr>";
562 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
563 print
'<td colspan="3">';
568 print
'<tr><td>'.$langs->trans(
"Description").
'</td><td colspan="3">'.nl2br(
$object->description).
"</td></tr>";
571 if (isModEnabled(
'contract')) {
572 $langs->load(
'contracts');
576 print
'<table class="nobordernopadding" width="100%"><tr><td>';
577 print $langs->trans(
'Contract');
579 if ($action !=
'contrat') {
580 print
'<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.
$object->id.
'&token='.
newToken().
'">';
581 print
img_edit($langs->trans(
'SetContract'), 1);
584 print
'</tr></table>';
586 if ($action ==
'contrat') {
588 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1);
591 $contratstatic =
new Contrat($db);
592 $contratstatic->fetch(
$object->fk_contrat);
593 print $contratstatic->getNomUrl(0,
'', 1);
604 print
'<div class="fichehalfright">';
605 print
'<div class="underbanner clearboth"></div>';
607 $title = $langs->trans(
"Recurrence");
610 print
'<table class="border centpercent">';
613 print
'<tr><td class="titlefield">';
614 print
'<table class="nobordernopadding" width="100%"><tr><td>';
615 print $langs->trans(
'Frequency');
617 if ($action !=
'editfrequency' && $user->hasRight(
'ficheinter',
'creer')) {
618 print
'<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=editfrequency&token='.
newToken().
'&id='.$id.
'">';
619 print
img_edit($langs->trans(
'Edit'), 1).
'</a></td>';
621 print
'</tr></table>';
623 if ($action ==
'editfrequency') {
624 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
625 print
'<input type="hidden" name="action" value="setfrequency">';
626 print
'<input type="hidden" name="token" value="'.newToken().
'">';
627 print
'<table class="nobordernopadding">';
629 print
'<input type="text" name="frequency" value="'.$object->frequency.
'" size="5"> ';
630 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'));
632 print
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
633 print
'</tr></table></form>';
636 print $langs->trans(
'FrequencyPer_'.
$object->unit_frequency,
$object->frequency);
638 print $langs->trans(
"NotARecurringInterventionalTemplate");
645 if ($user->hasRight(
'ficheinter',
'creer') && ($action ==
'date_when' ||
$object->frequency > 0)) {
646 print $form->editfieldkey($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day');
648 print $langs->trans(
"NextDateToExecution");
651 if ($action ==
'date_when' ||
$object->frequency > 0) {
652 print $form->editfieldval($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day');
659 if ($user->hasRight(
'ficheinter',
'creer') && ($action ==
'nb_gen_max' ||
$object->frequency > 0)) {
660 print $form->editfieldkey($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max',
$object->nb_gen_max, $object, $user->hasRight(
'facture',
'creer'));
662 print $langs->trans(
"MaxPeriodNumber");
666 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
667 print $form->editfieldval($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max',
$object->nb_gen_max ?
$object->nb_gen_max :
'',
$object, $user->hasRight(
'facture',
'creer'));
680 if (empty($conf->cron->enabled)) {
681 $txtinfoadmin = $langs->trans(
"EnableAndSetupModuleCron", $langs->transnoentitiesnoconv(
"Module2300Name"));
684 print
'<div class="underbanner clearboth"></div>';
685 print
'<table class="border centpercent">';
688 print
'<tr><td class="titlefield">'.$langs->trans(
"NbOfGenerationOfRecordDone").
'</td>';
696 print $langs->trans(
"DateLastGeneration");
708 print
'<div class="clearboth"></div><br>';
714 $title = $langs->trans(
"ProductsAndServices");
715 if (!isModEnabled(
"service")) {
716 $title = $langs->trans(
"Products");
717 } elseif (!isModEnabled(
"product")) {
718 $title = $langs->trans(
"Services");
723 print
'<table class="noborder centpercent">';
724 print
'<tr class="liste_titre">';
725 print
'<td>'.$langs->trans(
"Description").
'</td>';
726 print
'<td class="center">'.$langs->trans(
"Duration").
'</td>';
733 if (isset(
$object->lines[$i]->product_type)) {
734 $type =
$object->lines[$i]->product_type;
738 if (!empty($objp->date_start)) {
741 if (!empty($objp->date_end)) {
746 print
'<tr class="oddeven">';
748 $text =
img_object($langs->trans(
'Service'),
'service');
749 print $text.
' '.nl2br(
$object->lines[$i]->desc);
752 print
'<td class="center">'.convertSecondToTime(
$object->lines[$i]->duree).
'</td>';
761 print
'<div class="tabsAction">';
763 if ($user->hasRight(
'ficheinter',
'creer')) {
764 print
'<div class="inline-block divButAction">';
765 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=createfrommodel&token='.
newToken();
766 print
'&socid='.$object->thirdparty->id.
'&id='.
$object->id.
'">';
767 print $langs->trans(
"AddIntervention").
'</a></div>';
771 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $user->hasRight(
'ficheinter',
'supprimer'));
775 print $langs->trans(
"ErrorRecordNotFound");
781 $sql =
"SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.title,";
782 $sql .=
" f.duree, f.fk_contrat, f.fk_projet as fk_project, f.frequency, f.nb_gen_done, f.nb_gen_max,";
783 $sql .=
" f.date_last_gen, f.date_when, f.datec, f.status";
785 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter_rec as f";
786 $sql .=
" , ".MAIN_DB_PREFIX.
"societe as s ";
787 if (!$user->hasRight(
'societe',
'client',
'voir')) {
788 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
790 $sql .=
" WHERE f.fk_soc = s.rowid";
791 $sql .=
" AND f.entity = ".$conf->entity;
792 if (!empty($socid)) {
793 $sql .=
" AND s.rowid = ".((int) $socid);
795 if (!$user->hasRight(
'societe',
'client',
'voir')) {
796 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
803 if (!empty($search_societe)) {
806 if (!empty($search_frequency) && $search_frequency ==
'1') {
807 $sql .=
' AND f.frequency > 0';
809 if (isset($search_frequency) && (
string) $search_frequency ==
'0') {
810 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
817 $resql = $db->query($sql);
819 $num = $db->num_rows($resql);
821 print_barre_liste($langs->trans(
"RepeatableIntervention"), $page, $_SERVER[
'PHP_SELF'],
"&socid=$socid", $sortfield, $sortorder,
'', $num,
'',
'intervention');
823 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedIntervention").
'</span><br><br>';
826 print
'<table class="noborder centpercent">';
827 print
'<tr class="liste_titre">';
828 print_liste_field_titre(
"Ref", $_SERVER[
'PHP_SELF'],
"f.title",
"",
"",
'width="200px"', $sortfield, $sortorder,
'left ');
829 print_liste_field_titre(
"Company", $_SERVER[
'PHP_SELF'],
"s.nom",
"",
"",
'width="200px"', $sortfield, $sortorder,
'left ');
830 if (isModEnabled(
'contract')) {
831 print_liste_field_titre(
"Contract", $_SERVER[
'PHP_SELF'],
"f.fk_contrat",
"",
"",
'width="100px"', $sortfield, $sortorder,
'left ');
833 if (isModEnabled(
'project')) {
834 print_liste_field_titre(
"Project", $_SERVER[
'PHP_SELF'],
"f.fk_project",
"",
"",
'width="100px"', $sortfield, $sortorder,
'left ');
836 print_liste_field_titre(
"Duration", $_SERVER[
'PHP_SELF'],
'f.duree',
'',
'',
'width="50px"', $sortfield, $sortorder,
'right ');
838 print_liste_field_titre(
"Frequency", $_SERVER[
'PHP_SELF'],
"f.frequency",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
839 print_liste_field_titre(
"NbOfGenerationDoneShort", $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
840 print_liste_field_titre(
"DateLastGeneration", $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
841 print_liste_field_titre(
"NextDateToIntervention", $_SERVER[
'PHP_SELF'],
"f.date_when",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
842 print
'<th width="100px"></th>';
849 while ($i < min($num, $limit)) {
850 $objp = $db->fetch_object($resql);
852 print
'<tr class="oddeven">';
853 print
'<td><a href="'.$_SERVER[
'PHP_SELF'].
'?id='.$objp->fich_rec.
'">';
854 print
img_object($langs->trans(
"ShowIntervention"),
"intervention").
' '.$objp->title;
857 $companystatic->id = $objp->socid;
858 $companystatic->name = $objp->name;
859 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
861 print
'<td>'.$langs->trans(
"None").
'</td>';
864 if (isModEnabled(
'contract')) {
866 if ($objp->fk_contrat > 0) {
867 $contratstatic->fetch($objp->fk_contrat);
868 print $contratstatic->getNomUrl(1);
872 if (isModEnabled(
'project')) {
874 if ($objp->fk_project > 0) {
875 $projectstatic->fetch($objp->fk_project);
876 print $projectstatic->getNomUrl(1);
881 print
'<td class=right>'.convertSecondToTime($objp->duree).
'</td>';
883 print
'<td class="center">'.yn($objp->frequency ? 1 : 0).
'</td>';
885 print
'<td class="center">';
886 if ($objp->frequency) {
887 print $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'');
890 print
'<td class="center">';
894 print
'<td class="center">';
898 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
900 print
'<td class="center">';
901 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
903 print
'<td class="center">';
904 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
908 if ($user->hasRight(
'ficheinter',
'creer')) {
910 print
'<td class="center">';
911 if ($user->hasRight(
'ficheinter',
'creer')) {
912 if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
913 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=createfrommodel';
914 print
'&socid='.$objp->socid.
'&id='.$objp->fich_rec.
'&token='.
newToken().
'">';
915 print $langs->trans(
"NewIntervention").
'</a>';
917 print $langs->trans(
"DateIsNotEnough");
930 print
'<tr class="oddeven"><td colspan="10"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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 interventions.
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_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...
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)
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)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
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).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $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, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.