33 require
'../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinterrec.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40 if (!empty($conf->projet->enabled)) {
41 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
44 if (!empty($conf->contrat->enabled)) {
45 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcontract.class.php';
50 $langs->loadLangs(array(
"interventions",
"admin",
"compta",
"bills"));
54 $action =
GETPOST(
'action',
'aZ09');
55 if ($user->socid) $socid = $user->socid;
56 $objecttype =
'fichinter_rec';
57 if ($action ==
"create" || $action ==
"add") $objecttype =
'';
63 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
64 $offset = $limit * $page;
70 $sortfield =
"f.datec";
77 'f.titre'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
78 's.nom'=>array(
'label'=>$langs->trans(
"ThirdParty"),
'checked'=>1),
79 'f.fk_contrat'=>array(
'label'=>$langs->trans(
"Contract"),
'checked'=>1),
80 'f.duree'=>array(
'label'=>$langs->trans(
"Duration"),
'checked'=>1),
81 'f.total_ttc'=>array(
'label'=>$langs->trans(
"AmountTTC"),
'checked'=>1),
82 'f.frequency'=>array(
'label'=>$langs->trans(
"RecurringInvoiceTemplate"),
'checked'=>1),
83 'f.nb_gen_done'=>array(
'label'=>$langs->trans(
"NbOfGenerationDone"),
'checked'=>1),
84 'f.date_last_gen'=>array(
'label'=>$langs->trans(
"DateLastGeneration"),
'checked'=>1),
85 'f.date_when'=>array(
'label'=>$langs->trans(
"NextDateToExecution"),
'checked'=>1),
86 'f.datec'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
87 'f.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>500),
97 if ($action ==
'add') {
99 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Title")), null,
'errors');
105 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Customer")), null,
'errors');
111 $frequency =
GETPOST(
'frequency',
'int');
117 $nb_gen_max = (
GETPOST(
'nb_gen_max',
'int') ?
GETPOST(
'nb_gen_max',
'int') : 0);
119 if (empty($reyear) || empty($remonth) || empty($reday)) {
120 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Date")), null,
'errors');
124 if ($nb_gen_max ===
'') {
125 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"MaxPeriodNumber")), null,
'errors');
132 $object->id_origin = $id;
133 $object->title =
GETPOST(
'titre',
'alpha');
134 $object->description =
GETPOST(
'description',
'restricthtml');
135 $object->socid =
GETPOST(
'socid',
'alpha');
136 $object->fk_project =
GETPOST(
'projectid',
'int');
137 $object->fk_contract =
GETPOST(
'contractid',
'int');
139 $object->frequency = $frequency;
140 $object->unit_frequency =
GETPOST(
'unit_frequency',
'alpha');
141 $object->nb_gen_max = $nb_gen_max;
142 $object->auto_validate =
GETPOST(
'auto_validate',
'int');
144 $date_next_execution =
dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
145 $object->date_when = $date_next_execution;
147 if ($object->create($user) > 0) {
155 } elseif ($action ==
'createfrommodel') {
162 if ($object->socid > 0) {
163 $newinter->socid = $object->socid;
164 $newinter->fk_project = $object->fk_project;
165 $newinter->fk_contrat = $object->fk_contrat;
167 $newinter->socid =
GETPOST(
"socid");
170 $newinter->entity = $object->entity;
171 $newinter->duree = $object->duree;
173 $newinter->description = $object->description;
174 $newinter->note_private = $object->note_private;
175 $newinter->note_public = $object->note_public;
178 $extrafields->fetch_name_optionals_label($newinter->table_element);
180 $array_options = $extrafields->getOptionalsFromPost($newinter->table_element);
181 $newinter->array_options = $array_options;
183 $newfichinterid = $newinter->create($user);
185 if ($newfichinterid > 0) {
187 foreach ($object->lines as $line) {
188 $newinter->addline($user, $newfichinterid, $line->desc,
'', $line->duree,
'');
192 $object->updateNbGenDone();
194 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/card.php?id='.$newfichinterid);
200 } elseif ($action ==
'delete' && $user->rights->ficheinter->supprimer) {
205 header(
'Location: '.
$_SERVER[
"PHP_SELF"]);
207 } elseif ($action ==
'setfrequency' && $user->rights->ficheinter->creer) {
210 $object->setFrequencyAndUnit(
GETPOST(
'frequency',
'int'),
GETPOST(
'unit_frequency',
'alpha'));
211 } elseif ($action ==
'setdate_when' && $user->rights->ficheinter->creer) {
215 if (!empty($date)) $object->setNextDate($date);
216 } elseif ($action ==
'setnb_gen_max' && $user->rights->ficheinter->creer) {
219 $object->setMaxPeriod(
GETPOST(
'nb_gen_max',
'int'));
227 llxHeader(
'', $langs->trans(
"RepeatableIntervention"),
'ch-fichinter.html#s-fac-fichinter-rec');
229 $form =
new Form($db);
230 $companystatic =
new Societe($db);
231 if (!empty($conf->contrat->enabled)) {
232 $contratstatic =
new Contrat($db);
234 if (!empty($conf->projet->enabled)) {
235 $projectstatic =
new Project($db);
240 $today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
247 if ($action ==
'create') {
253 if ($object->fetch($id, $ref) > 0) {
254 print '<form action="card-rec.php" method="post">';
255 print '<input type="hidden" name="token" value="'.newToken().
'">';
256 print '<input type="hidden" name="action" value="add">';
257 print '<input type="hidden" name="fichinterid" value="'.$object->id.
'">';
262 if (!empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++;
263 if (!empty($conf->contrat->enabled) && $object->fk_contrat > 0) $rowspan++;
265 print '<table class="border centpercent">';
267 $object->fetch_thirdparty();
270 print '<tr><td>'.$langs->trans(
"Customer").
'</td><td>';
271 print $form->select_company($object->thirdparty->id,
'socid',
'', 0, 1);
275 print $langs->trans(
"Comment");
279 print '<tr><td class="fieldrequired">'.$langs->trans(
"Title").
'</td><td>';
280 print '<input class="flat quatrevingtpercent" type="text" name="titre" value="'.dol_escape_htmltag(
GETPOST(
"titre",
"alphanohtml")).
'">';
284 print '<td rowspan="'.$rowspan.
'" valign="top">';
285 print '<textarea class="flat" name="description" wrap="soft" cols="60" rows="'.ROWS_4.
'">';
286 print $object->description.
'</textarea>';
290 print "<tr><td>".$langs->trans(
"Author").
"</td><td>".$user->getFullName($langs).
"</td></tr>";
292 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
294 print '<tr><td>'.$langs->trans(
"TotalDuration").
'</td>';
295 print '<td colspan="3">'.convertSecondToTime($object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
300 if (!empty($conf->projet->enabled)) {
302 print "<tr><td>".$langs->trans(
"Project").
"</td><td>";
303 $projectid =
GETPOST(
'projectid') ?
GETPOST(
'projectid') : $object->fk_project;
305 $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'');
306 print ' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.$object->thirdparty->id;
307 print '&action=create&status=1&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"]).
'?action=create';
308 print '&socid='.$object->thirdparty->id.(!empty($id) ?
'&id='.$id :
'').
'">';
309 print $langs->trans(
"AddProject").
'</a>';
314 if (!empty($conf->contrat->enabled)) {
316 print "<tr><td>".$langs->trans(
"Contract").
"</td><td>";
317 $contractid =
GETPOST(
'contractid') ?
GETPOST(
'contractid') : $object->fk_contract;
318 $numcontract = $formcontract->select_contract($object->thirdparty->id, $contractid,
'contracttid');
327 $title = $langs->trans(
"Recurrence");
330 print '<table class="border centpercent">';
333 print '<tr><td class="titlefieldcreate">';
334 print $form->textwithpicto($langs->trans(
"Frequency"), $langs->transnoentitiesnoconv(
'toolTipFrequency'));
336 print '<input type="text" name="frequency" value="'.GETPOST(
'frequency',
'int').
'" size="4"> ';
337 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'));
341 print "<tr><td>".$langs->trans(
'NextDateToExecution').
"</td><td>";
342 if ($date_next_execution !=
"") {
345 print $form->selectDate($date_next_execution,
'', 1, 1,
'',
"add", 1, 1);
349 print "<tr><td>".$langs->trans(
"MaxPeriodNumber").
"</td><td>";
350 print '<input type="text" name="nb_gen_max" value="'.GETPOST(
'nb_gen_max',
'int').
'" size="5">';
357 $title = $langs->trans(
"ProductsAndServices");
358 if (empty($conf->service->enabled)) {
359 $title = $langs->trans(
"Products");
360 } elseif (empty($conf->product->enabled)) {
361 $title = $langs->trans(
"Services");
369 print '<table class="notopnoleftnoright" width="100%">';
370 print '<tr><td colspan="3">';
372 $sql =
'SELECT l.rowid, l.description, l.duree';
373 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinterdet as l";
374 $sql .=
" WHERE l.fk_fichinter= ".$object->id;
376 $sql .=
" ORDER BY l.rang";
378 $result = $db->query($sql);
380 $num = $db->num_rows($result);
384 echo
'<table class="noborder centpercent">';
386 print '<tr class="liste_titre">';
387 print '<td>'.$langs->trans(
"Description").
'</td>';
388 print '<td class="center">'.$langs->trans(
"Duration").
'</td>';
392 $objp = $db->fetch_object($result);
393 print '<tr class="oddeven">';
398 print '<a name="'.$objp->rowid.
'"></a>';
400 $text =
img_object($langs->trans(
'Service'),
'service');
402 print $text.
' '.nl2br($objp->description);
405 print '<td class="center">'.convertSecondToTime($objp->duree).
'</td>';
422 print '<div class="center"><input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
423 print ' ';
424 print '<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
430 } elseif ($action ==
'selsocforcreatefrommodel') {
434 print '<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
435 print '<table class="border centpercent">';
436 print '<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
437 print $form->select_company(
'',
'socid',
'', 1, 1);
443 print '<div class="center">';
444 print '<input type="hidden" name="action" value="createfrommodel">';
445 print '<input type="hidden" name="id" value="'.$id.
'">';
446 print '<input type="submit" class="button" value="'.$langs->trans(
"CreateDraftIntervention").
'">';
456 if ($object->fetch($id) > 0) {
457 $object->fetch_thirdparty();
459 $author =
new User($db);
460 $author->fetch($object->user_author);
467 $linkback =
'<a href="card-rec.php">'.$langs->trans(
"BackToList").
'</a>';
469 $morehtmlref =
'<div class="refidno">';
472 $morehtmlref .= $langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
474 if (!empty($conf->projet->enabled)) {
476 $langs->load(
"projects");
477 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
478 if ($user->rights->ficheinter->creer) {
479 if ($action !=
'classify') {
480 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&id='.$object->id.
'">';
481 $morehtmlref .=
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
483 if ($action ==
'classify') {
484 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
485 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
486 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
487 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
488 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
489 $morehtmlref .=
'</form>';
491 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
494 if (!empty($object->fk_project)) {
496 $proj->fetch($object->fk_project);
497 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'"';
498 $morehtmlref .=
'title="'.$langs->trans(
'ShowProject').
'">';
499 $morehtmlref .= $proj->ref;
500 $morehtmlref .=
'</a>';
506 $morehtmlref .=
'</div>';
508 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
510 print '<div class="fichecenter">';
511 print '<div class="fichehalfleft">';
512 print '<div class="underbanner clearboth"></div>';
514 print '<table class="border centpercent">';
516 print "<tr><td>".$langs->trans(
"Author").
'</td><td colspan="3">'.$author->getFullName($langs).
"</td></tr>";
518 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
520 print '<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
521 print '<td colspan="3">';
526 print '<tr><td>'.$langs->trans(
"Description").
'</td><td colspan="3">'.nl2br($object->description).
"</td></tr>";
529 if (!empty($conf->contrat->enabled)) {
530 $langs->load(
'contracts');
534 print '<table class="nobordernopadding" width="100%"><tr><td>';
535 print $langs->trans(
'Contract');
537 if ($action !=
'contrat') {
538 print '<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.$object->id.
'">';
542 print '</tr></table>';
544 if ($action ==
'contrat') {
545 $formcontract =
new Formcontract($db);
546 $formcontract->formSelectContract(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contrat,
'contratid', 0, 1);
548 if ($object->fk_contrat) {
549 $contratstatic =
new Contrat($db);
550 $contratstatic->fetch($object->fk_contrat);
551 print $contratstatic->getNomUrl(0,
'', 1);
562 print '<div class="fichehalfright">';
563 print '<div class="ficheaddleft">';
564 print '<div class="underbanner clearboth"></div>';
566 print '<table class="border centpercent">';
568 $title = $langs->trans(
"Recurrence");
571 print '<table class="border centpercent">';
574 print '<tr><td style="width: 50%">';
575 print '<table class="nobordernopadding" width="100%"><tr><td>';
576 print $langs->trans(
'Frequency');
578 if ($action !=
'editfrequency' && $user->rights->ficheinter->creer) {
579 print '<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=editfrequency&id='.$id.
'">';
582 print '</tr></table>';
584 if ($action ==
'editfrequency') {
585 print '<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'">';
586 print '<input type="hidden" name="action" value="setfrequency">';
587 print '<input type="hidden" name="token" value="'.newToken().
'">';
588 print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
590 print '<input type="text" name="frequency" value="'.$object->frequency.
'" size="5"> ';
591 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'));
593 print '<td class="left"><input type="submit" class="button" value="'.$langs->trans(
"Modify").
'"></td>';
594 print '</tr></table></form>';
596 if ($object->frequency > 0)
597 print $langs->trans(
'FrequencyPer_'.$object->unit_frequency, $object->frequency);
598 else print $langs->trans(
"NotARecurringInterventionalTemplate");
604 if ($user->rights->ficheinter->creer && ($action ==
'date_when' || $object->frequency > 0)) {
605 print $form->editfieldkey($langs->trans(
"NextDateToExecution"),
'date_when', $object->date_when, $object, $user->rights->facture->creer,
'day');
607 print $langs->trans(
"NextDateToExecution");
610 if ($action ==
'date_when' || $object->frequency > 0) {
611 print $form->editfieldval($langs->trans(
"NextDateToExecution"),
'date_when', $object->date_when, $object, $user->rights->facture->creer,
'day');
618 if ($user->rights->ficheinter->creer && ($action ==
'nb_gen_max' || $object->frequency > 0)) {
619 print $form->editfieldkey($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
620 }
else print $langs->trans(
"MaxPeriodNumber");
623 if ($action ==
'nb_gen_max' || $object->frequency > 0) {
624 print $form->editfieldval($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max', $object->nb_gen_max ? $object->nb_gen_max :
'', $object, $user->rights->facture->creer);
633 if ($object->frequency > 0) {
635 if (empty($conf->cron->enabled)) {
636 $txtinfoadmin = $langs->trans(
"EnableAndSetupModuleCron", $langs->transnoentitiesnoconv(
"Module2300Name"));
639 print '<div class="underbanner clearboth"></div>';
640 print '<table class="border centpercent">';
643 print '<tr><td style="width: 50%">'.$langs->trans(
"NbOfGenerationDone").
'</td>';
645 print $object->nb_gen_done ? $object->nb_gen_done :
'0';
651 print $langs->trans(
"DateLastGeneration");
664 print '<div class="clearboth"></div><br>';
670 $title = $langs->trans(
"ProductsAndServices");
671 if (empty($conf->service->enabled)) {
672 $title = $langs->trans(
"Products");
673 } elseif (empty($conf->product->enabled)) {
674 $title = $langs->trans(
"Services");
679 print '<table class="noborder centpercent">';
680 print '<tr class="liste_titre">';
681 print '<td>'.$langs->trans(
"Description").
'</td>';
682 print '<td class="center">'.$langs->trans(
"Duration").
'</td>';
685 $num = count($object->lines);
689 if (isset($object->lines[$i]->product_type))
690 $type = $object->lines[$i]->product_type;
691 else $object->lines[$i]->fk_product_type;
694 if (!empty($objp->date_start)) $type = 1;
695 if (!empty($objp->date_end)) $type = 1;
698 print '<tr class="oddeven">';
700 $text =
img_object($langs->trans(
'Service'),
'service');
701 print $text.
' '.nl2br($object->lines[$i]->desc);
704 print '<td class="center">'.convertSecondToTime($object->lines[$i]->duree).
'</td>';
713 print '<div class="tabsAction">';
715 if ($user->rights->ficheinter->creer) {
716 print '<div class="inline-block divButAction">';
717 print '<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=createfrommodel&token='.
newToken().
'';
718 print '&socid='.$object->thirdparty->id.
'&id='.$object->id.
'">';
719 print $langs->trans(
"CreateFichInter").
'</a></div>';
722 if ($user->rights->ficheinter->supprimer) {
723 print '<div class="inline-block divButAction">';
724 print '<a class="butActionDelete" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'">';
725 print $langs->trans(
'Delete').
'</a></div>';
728 }
else print $langs->trans(
"ErrorRecordNotFound");
733 $sql =
"SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title,";
734 $sql .=
" f.duree, f.fk_contrat, f.fk_projet as fk_project, f.frequency, f.nb_gen_done, f.nb_gen_max,";
735 $sql .=
" f.date_last_gen, f.date_when, f.datec";
737 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter_rec as f";
738 $sql .=
" , ".MAIN_DB_PREFIX.
"societe as s ";
739 if (!$user->rights->societe->client->voir && !$socid) {
740 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
742 $sql .=
" WHERE f.fk_soc = s.rowid";
743 $sql .=
" AND f.entity = ".$conf->entity;
744 if ($socid) $sql .=
" AND s.rowid = ".$socid;
745 if (!$user->rights->societe->client->voir && !$socid) {
746 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
749 if ($search_societe) $sql .=
natural_search(
's.nom', $search_societe);
750 if ($search_frequency ==
'1') $sql .=
' AND f.frequency > 0';
751 if ($search_frequency ==
'0') $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
757 $resql = $db->query($sql);
759 $num = $db->num_rows(
$resql);
761 print_barre_liste($langs->trans(
"RepeatableIntervention"), $page,
$_SERVER[
'PHP_SELF'],
"&socid=$socid", $sortfield, $sortorder,
'', $num,
'',
'intervention');
763 print '<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedIntervention").
'</span><br><br>';
766 print '<table class="noborder centpercent">';
767 print '<tr class="liste_titre">';
768 print_liste_field_titre(
"Ref", $_SERVER[
'PHP_SELF'],
"f.titre",
"",
"",
'width="200px"', $sortfield, $sortorder,
'left ');
769 print_liste_field_titre(
"Company", $_SERVER[
'PHP_SELF'],
"s.nom",
"",
"",
'width="200px"', $sortfield, $sortorder,
'left ');
770 if (!empty($conf->contrat->enabled)) {
771 print_liste_field_titre(
"Contract", $_SERVER[
'PHP_SELF'],
"f.fk_contrat",
"",
"",
'width="100px"', $sortfield, $sortorder,
'left ');
773 if (!empty($conf->projet->enabled)) {
774 print_liste_field_titre(
"Project", $_SERVER[
'PHP_SELF'],
"f.fk_project",
"",
"",
'width="100px"', $sortfield, $sortorder,
'left ');
776 print_liste_field_titre(
"Duration", $_SERVER[
'PHP_SELF'],
'f.duree',
'',
'',
'width="50px"', $sortfield, $sortorder,
'right ');
778 print_liste_field_titre(
"Frequency", $_SERVER[
'PHP_SELF'],
"f.frequency",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
779 print_liste_field_titre(
"NbOfGenerationDone", $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
780 print_liste_field_titre(
"DateLastGeneration", $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
781 print_liste_field_titre(
"NextDateToIntervention", $_SERVER[
'PHP_SELF'],
"f.date_when",
"",
"",
'width="100px"', $sortfield, $sortorder,
'center ');
782 print '<th width="100px"></th>';
789 while ($i < min($num, $limit)) {
790 $objp = $db->fetch_object(
$resql);
792 print '<tr class="oddeven">';
793 print '<td><a href="'.$_SERVER[
'PHP_SELF'].
'?id='.$objp->fich_rec.
'">';
794 print img_object($langs->trans(
"ShowIntervention"),
"intervention").
' '.$objp->title;
797 $companystatic->id = $objp->socid;
798 $companystatic->name = $objp->name;
799 print '<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
801 print '<td>'.$langs->trans(
"None").
'</td>';
804 if (!empty($conf->contrat->enabled)) {
806 if ($objp->fk_contrat > 0) {
807 $contratstatic->fetch($objp->fk_contrat);
808 print $contratstatic->getNomUrl(1);
812 if (!empty($conf->projet->enabled)) {
814 if ($objp->fk_project > 0) {
815 $projectstatic->fetch($objp->fk_project);
816 print $projectstatic->getNomUrl(1);
821 print '<td class=right>'.convertSecondToTime($objp->duree).
'</td>';
823 print '<td class="center">'.yn($objp->frequency ? 1 : 0).
'</td>';
825 print '<td class="center">';
826 if ($objp->frequency) {
827 print $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'');
830 print '<td class="center">';
834 print
'<td class="center">';
838 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
840 print
'<td class="center">';
841 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
843 print
'<td class="center">';
844 print
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>';
848 if ($user->rights->ficheinter->creer) {
850 print
'<td class="center">';
851 if ($user->rights->ficheinter->creer) {
852 if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
853 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=createfrommodel';
854 print
'&socid='.$objp->socid.
'&id='.$objp->fich_rec.
'">';
855 print $langs->trans(
"CreateFichInter").
'</a>';
856 }
else print $langs->trans(
"DateIsNotEnough");
857 }
else print
" ";
866 print
'<tr class="oddeven"><td colspan="10">'.$langs->trans(
"NoneF").
'</td></tr>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Class to manage interventions.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
fichinter_rec_prepare_head($object)
Prepare array with list of tabs.
Class to manage contracts.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Classe de gestion des factures recurrentes/Modeles.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.