33 require
'../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39 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 ($conf->contrat->enabled)
46 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcontract.class.php";
47 require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
49 if (!empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
".php"))
51 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
'.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
57 $langs->loadLangs(array(
'bills',
'companies',
'interventions'));
61 $socid = (int)
GETPOST(
'socid',
'int');
62 $contratid = (int)
GETPOST(
'contratid',
'int');
63 $action =
GETPOST(
'action',
'alpha');
64 $cancel =
GETPOST(
'cancel',
'alpha');
65 $confirm =
GETPOST(
'confirm',
'alpha');
66 $mesg =
GETPOST(
'msg',
'alpha');
67 $origin =
GETPOST(
'origin',
'alpha');
69 $note_public =
GETPOST(
'note_public',
'restricthtml');
70 $lineid =
GETPOST(
'line_id',
'int');
73 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
74 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
75 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
78 if ($user->socid) $socid = $user->socid;
82 $hookmanager->initHooks(array(
'interventioncard',
'globalcard'));
87 $extrafields->fetch_name_optionals_label($object->table_element);
90 if ($id > 0 || !empty($ref))
92 $ret = $object->fetch($id, $ref);
93 if ($ret > 0) $ret = $object->fetch_thirdparty();
97 $permissionnote = $user->rights->ficheinter->creer;
98 $permissiondellink = $user->rights->ficheinter->creer;
107 $parameters = array(
'socid'=>$socid);
108 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
109 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
115 if (!empty($backtopage))
117 header(
"Location: ".$backtopage);
123 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
125 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
128 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->rights->ficheinter->creer)
130 if (1 == 0 && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers'))
137 $orig = clone $object;
139 $result = $object->createFromClone($user, $socid);
142 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
'?id='.$result);
153 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $user->rights->ficheinter->creer)
155 $result = $object->setValid($user);
159 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
162 $outputlangs = $langs;
164 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
165 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
166 if (!empty($newlang))
169 $outputlangs->setDefaultLang($newlang);
174 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
177 $mesg = $object->error;
179 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
180 $result = $object->setDraft($user);
183 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
186 $outputlangs = $langs;
188 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
189 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
190 if (!empty($newlang)) {
192 $outputlangs->setDefaultLang($newlang);
197 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
200 $mesg = $object->error;
202 } elseif ($action ==
'add' && $user->rights->ficheinter->creer) {
203 $object->socid = $socid;
204 $object->duration = (int)
GETPOST(
'duration',
'int');
205 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
206 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
207 $object->author = $user->id;
208 $object->description =
GETPOST(
'description',
'restricthtml');
210 $object->model_pdf =
GETPOST(
'model',
'alpha');
211 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
212 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
214 if ($object->socid > 0)
217 if (!empty($origin) && !empty($originid))
221 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
222 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs))
225 $subelement = $regs[2];
229 if ($element ==
'order') {
230 $element = $subelement =
'commande';
232 if ($element ==
'propal') {
233 $element =
'comm/propal'; $subelement =
'propal';
235 if ($element ==
'contract') {
236 $element = $subelement =
'contrat';
239 $object->origin = $origin;
240 $object->origin_id = $originid;
243 $object->linked_objects[$object->origin] = $object->origin_id;
244 if (is_array($_POST[
'other_linked_objects']) && !empty($_POST[
'other_linked_objects']))
246 $object->linked_objects = array_merge($object->linked_objects, $_POST[
'other_linked_objects']);
252 $ret = $extrafields->setOptionalsFromPost(null, $object);
257 $array_options = $extrafields->getOptionalsFromPost($object->table_element);
259 $object->array_options = $array_options;
261 $id = $object->create($user);
267 $classname = ucfirst($subelement);
268 $srcobject =
new $classname($db);
270 dol_syslog(
"Try to find source object origin=".$object->origin.
" originid=".$object->origin_id.
" to add lines");
271 $result = $srcobject->fetch($object->origin_id);
274 $srcobject->fetch_thirdparty();
275 $lines = $srcobject->lines;
276 if (empty($lines) && method_exists($srcobject,
'fetch_lines'))
278 $srcobject->fetch_lines();
279 $lines = $srcobject->lines;
282 if (is_array($lines)) {
283 $num = count($lines);
285 for ($i = 0; $i < $num; $i++)
293 if ($lines[$i]->fk_product > 0)
296 $prod->id = $lines[$i]->fk_product;
299 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
300 $prod->getMultiLangs();
302 $prod->fetch($lines[$i]->fk_product);
303 $outputlangs = $langs;
305 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
306 if (empty($newlang)) $newlang = $srcobject->thirdparty->default_lang;
307 if (!empty($newlang)) {
309 $outputlangs->setDefaultLang($newlang);
311 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
313 $prod->fetch($lines[$i]->fk_product);
314 $label = $lines[$i]->product_label;
317 if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
318 switch ($prod->duration_unit) {
327 $mult = 3600 * 24 * 7;
330 $mult = (int) 3600 * 24 * (365 / 12);
333 $mult = 3600 * 24 * 365;
336 $duration = $prod->duration_value * $mult * $lines[$i]->qty;
339 $desc = $lines[$i]->product_ref;
347 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
350 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
359 $extrafields->fetch_name_optionals_label($object->table_element_line);
360 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
362 $result = $object->addline(
380 $mesg = $srcobject->error;
384 $mesg = $object->error;
389 $ret = $extrafields->setOptionalsFromPost(null, $object);
398 $array_options = $extrafields->getOptionalsFromPost($object->table_element);
400 $object->array_options = $array_options;
402 $result = $object->create($user);
407 $langs->load(
"errors");
414 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
417 } elseif ($action ==
'update' && $user->rights->ficheinter->creer) {
418 $object->socid = $socid;
419 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
420 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
421 $object->author = $user->id;
422 $object->description =
GETPOST(
'description',
'restricthtml');
425 $result = $object->update($user);
432 elseif ($action ==
'classin' && $user->rights->ficheinter->creer)
434 $result = $object->setProject(
GETPOST(
'projectid',
'int'));
439 elseif ($action ==
'setcontract' && $user->rights->contrat->creer)
441 $result = $object->set_contrat($user,
GETPOST(
'contratid',
'int'));
443 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->ficheinter->supprimer)
445 $result = $object->delete($user);
450 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
452 } elseif ($action ==
'setdescription' && $user->rights->ficheinter->creer)
454 $result = $object->set_description($user,
GETPOST(
'description'));
459 elseif ($action ==
"addline" && $user->rights->ficheinter->creer)
461 if (!
GETPOST(
'np_desc',
'restricthtml') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC))
463 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
466 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && !
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int'))
468 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
471 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) &&
GETPOST(
'durationhour',
'int') >= 24 &&
GETPOST(
'durationmin',
'int') > 0)
473 $mesg = $langs->trans(
"ErrorValueTooHigh");
480 $desc =
GETPOST(
'np_desc',
'restricthtml');
481 $date_intervention =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
485 $extrafields->fetch_name_optionals_label($object->table_element_line);
486 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
488 $result = $object->addline(
498 $outputlangs = $langs;
500 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
501 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
502 if (!empty($newlang))
505 $outputlangs->setDefaultLang($newlang);
512 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
fichinter_create($db, $object, $object->model_pdf, $outputlangs);
513 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
516 $mesg = $object->error;
523 elseif ($action ==
'classifybilled' && $user->rights->ficheinter->creer)
525 $result = $object->setStatut(2);
527 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
535 elseif ($action ==
'classifyunbilled' && $user->rights->ficheinter->creer)
537 $result = $object->setStatut(1);
540 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
543 $mesg = $object->error;
548 elseif ($action ==
'classifydone' && $user->rights->ficheinter->creer)
550 $result = $object->setStatut(3);
553 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
561 elseif ($action ==
'confirm_reopen' && $user->rights->ficheinter->creer)
566 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
570 $mesg = $object->error;
577 elseif ($action ==
'updateline' && $user->rights->ficheinter->creer &&
GETPOST(
'save',
'alpha') == $langs->trans(
"Save")) {
579 if ($objectline->fetch($lineid) <= 0) {
584 if ($object->fetch($objectline->fk_fichinter) <= 0) {
588 $object->fetch_thirdparty();
590 $desc =
GETPOST(
'np_desc',
'restricthtml');
591 $date_inter =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
594 $objectline->datei = $date_inter;
595 $objectline->desc = $desc;
596 $objectline->duration = $duration;
599 $extrafields->fetch_name_optionals_label($object->table_element_line);
600 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
601 $objectline->array_options = $array_options;
603 $result = $objectline->update($user);
610 $outputlangs = $langs;
612 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
613 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
614 if (!empty($newlang)) {
616 $outputlangs->setDefaultLang($newlang);
618 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
fichinter_create($db, $object, $object->model_pdf, $outputlangs);
620 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
627 elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $user->rights->ficheinter->creer)
630 if ($objectline->fetch($lineid) <= 0)
635 $result = $objectline->deleteline($user);
637 if ($object->fetch($objectline->fk_fichinter) <= 0)
644 $outputlangs = $langs;
646 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
647 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
648 if (!empty($newlang))
651 $outputlangs->setDefaultLang($newlang);
653 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
fichinter_create($db, $object, $object->model_pdf, $outputlangs);
659 elseif ($action ==
'up' && $user->rights->ficheinter->creer)
661 $object->line_up($lineid);
664 $outputlangs = $langs;
666 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
667 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
668 if (!empty($newlang))
671 $outputlangs->setDefaultLang($newlang);
673 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
fichinter_create($db, $object, $object->model_pdf, $outputlangs);
675 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
677 } elseif ($action ==
'down' && $user->rights->ficheinter->creer)
679 $object->line_down($lineid);
682 $outputlangs = $langs;
684 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
685 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
686 if (!empty($newlang))
689 $outputlangs->setDefaultLang($newlang);
691 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
fichinter_create($db, $object, $object->model_pdf, $outputlangs);
693 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
698 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
701 $triggersendname =
'FICHINTER_SENTBYMAIL';
702 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
703 $trackid =
'int'.$object->id;
704 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
707 $upload_dir = $conf->ficheinter->dir_output;
708 $permissiontoadd = $user->rights->ficheinter->creer;
709 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
711 if ($action ==
'update_extras')
716 $ret = $extrafields->setOptionalsFromPost(null, $object,
GETPOST(
'attribute',
'restricthtml'));
717 if ($ret < 0) $error++;
722 $result = $object->insertExtraFields(
'INTERVENTION_MODIFY');
729 if ($error) $action =
'edit_extras';
732 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer)
734 if ($action ==
'addcontact')
736 if ($result > 0 && $id > 0)
740 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
745 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
748 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
750 $langs->load(
"errors");
751 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
753 $mesg = $object->error;
759 elseif ($action ==
'swapstatut')
761 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
765 elseif ($action ==
'deletecontact')
767 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
771 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
785 $form =
new Form($db);
787 if ($conf->contrat->enabled) $formcontract =
new FormContract($db);
788 if (!empty($conf->projet->enabled)) { $formproject =
new FormProjets($db); }
790 llxHeader(
'', $langs->trans(
"Intervention"));
792 if ($action ==
'create')
806 if ($socid) $res = $soc->fetch($socid);
808 if (
GETPOST(
'origin',
'alphanohtml') &&
GETPOST(
'originid',
'int'))
812 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
813 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs))
816 $subelement = $regs[2];
819 if ($element ==
'project')
821 $projectid =
GETPOST(
'originid',
'int');
824 if ($element ==
'order' || $element ==
'commande') {
825 $element = $subelement =
'commande';
827 if ($element ==
'propal') {
828 $element =
'comm/propal'; $subelement =
'propal';
830 if ($element ==
'contract') {
831 $element = $subelement =
'contrat';
836 $classname = ucfirst($subelement);
837 $objectsrc =
new $classname($db);
838 $objectsrc->fetch(
GETPOST(
'originid'));
839 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines'))
841 $objectsrc->fetch_lines();
842 $lines = $objectsrc->lines;
844 $objectsrc->fetch_thirdparty();
846 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
848 $soc = $objectsrc->thirdparty;
850 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
851 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
854 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
857 $projectid =
GETPOST(
'projectid',
'int');
860 if (!$conf->global->FICHEINTER_ADDON)
862 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
868 $obj = $conf->global->FICHEINTER_ADDON;
879 print '<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
880 print '<input type="hidden" name="token" value="'.newToken().
'">';
881 print '<input type="hidden" name="socid" value='.$soc->id.
'>';
882 print '<input type="hidden" name="action" value="add">';
886 print '<table class="border centpercent">';
888 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
891 print '<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
894 print '<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
896 print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
900 if (!empty($conf->projet->enabled))
904 $langs->load(
"project");
906 print '<tr><td>'.$langs->trans(
"Project").
'</td><td>';
913 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
916 print ' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.$soc->id.
'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProject").
'"></span></a>';
922 if ($conf->contrat->enabled)
924 $langs->load(
"contracts");
925 print '<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
926 $numcontrat = $formcontract->select_contract($soc->id,
GETPOST(
'contratid',
'int'),
'contratid', 0, 1, 1);
927 if ($numcontrat == 0)
929 print ' <a href="'.DOL_URL_ROOT.
'/contrat/card.php?socid='.$soc->id.
'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddContract").
'"></span></a>';
936 print '<td>'.$langs->trans(
"DefaultModel").
'</td>';
939 print $form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
944 print '<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
946 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In', 0,
false,
true, ROWS_3,
'90%');
947 print $doleditor->Create(1);
952 if (empty($user->socid))
955 print '<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
957 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In', 0,
false,
true, ROWS_3,
'90%');
958 print $doleditor->Create(1);
964 $parameters = array();
965 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
966 print $hookmanager->resPrint;
969 print $object->showOptionals($extrafields,
'edit');
973 if (!empty($origin) && !empty($originid) && is_object($objectsrc))
975 $newclassname = $classname;
976 if ($newclassname ==
'Propal') $newclassname =
'CommercialProposal';
977 print '<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1006 if (is_object($objectsrc))
1008 print '<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1009 print '<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1010 } elseif ($origin ==
'project' && !empty($projectid)) {
1011 print '<input type="hidden" name="projectid" value="'.$projectid.
'">';
1016 print '<div class="center">';
1017 print '<input type="submit" class="button" value="'.$langs->trans(
"CreateDraftIntervention").
'">';
1018 print ' ';
1019 print '<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
1025 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1026 $title = $langs->trans(
'Services');
1029 print '<table class="noborder centpercent">';
1031 $objectsrc->printOriginLinesList(empty($conf->global->FICHINTER_PRINT_PRODUCTS) ?
'services' :
'');
1036 print '<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1037 print '<input type="hidden" name="token" value="'.newToken().
'">';
1041 if (is_object($objectsrc))
1043 print '<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1044 print '<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1045 } elseif ($origin ==
'project' && !empty($projectid)) {
1046 print '<input type="hidden" name="projectid" value="'.$projectid.
'">';
1048 print '<table class="border centpercent">';
1049 print '<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1050 print $form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, null, 0,
'minwidth300');
1051 print ' <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?action=create').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
1057 print '<div class="center">';
1058 print '<input type="hidden" name="action" value="create">';
1059 print '<input type="submit" class="button" value="'.$langs->trans(
"CreateDraftIntervention").
'">';
1060 print ' ';
1061 print '<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
1066 } elseif ($id > 0 || !empty($ref))
1072 $object->fetch($id, $ref);
1073 $object->fetch_thirdparty();
1076 $soc->fetch($object->socid);
1091 if ($action ==
'delete')
1093 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1097 if ($action ==
'validate')
1100 $ref = substr($object->ref, 1, 4);
1103 $numref = $object->getNextNumRef($soc);
1110 $numref = $object->ref;
1112 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1114 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1118 if ($action ==
'modify')
1120 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1124 if ($action ==
'reopen')
1126 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'Reopen'), $langs->trans(
'ConfirmReopenIntervention', $object->ref),
'confirm_reopen',
'', 0, 1);
1130 if ($action ==
'ask_deleteline')
1132 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1136 if ($action ==
'clone') {
1138 $formquestion = array(
1144 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' => $form->select_company(
GETPOST(
'socid',
'int'),
'socid',
'',
'', 0, 0, null, 0,
'minwidth200')));
1146 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1151 $parameters = array(
'formConfirm' => $formconfirm,
'lineid'=>$lineid);
1152 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1153 if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
1154 elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
1162 $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
1165 $morehtmlref = '<div class="refidno">';
1170 $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
1172 if (!empty($conf->projet->enabled))
1174 $langs->load(
"projects");
1175 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
1176 if ($user->rights->ficheinter->creer)
1178 if ($action !=
'classify') {
1179 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
1181 if ($action ==
'classify') {
1183 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
1184 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
1185 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1186 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
1187 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
1188 $morehtmlref .=
'</form>';
1190 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
1193 if (!empty($object->fk_project)) {
1195 $proj->fetch($object->fk_project);
1196 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
1197 $morehtmlref .= $proj->ref;
1198 $morehtmlref .=
'</a>';
1204 $morehtmlref .=
'</div>';
1206 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1209 print '<div class="fichecenter">';
1210 print '<div class="fichehalfleft">';
1211 print '<div class="underbanner clearboth"></div>';
1213 print '<table class="border tableforfield" width="100%">';
1215 if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES))
1218 print '<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1225 print '<tr><td>'.$langs->trans(
"Datee").
'</td>';
1232 print '<tr><td>'.$langs->trans(
"Datet").
'</td>';
1240 print '<tr><td class="titlefield">';
1241 print $form->editfieldkey(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea');
1243 print $form->editfieldval(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea:8:80');
1248 if ($conf->contrat->enabled)
1250 $langs->load(
'contracts');
1254 print '<table class="nobordernopadding centpercent"><tr><td>';
1255 print $langs->trans(
'Contract');
1257 if ($action !=
'contrat')
1259 print '<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.$object->id.
'">';
1263 print '</tr></table>';
1265 if ($action ==
'contrat')
1267 $formcontract =
new Formcontract($db);
1268 $formcontract->formSelectContract(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contrat,
'contratid', 0, 1, 1);
1270 if ($object->fk_contrat)
1272 $contratstatic =
new Contrat($db);
1273 $contratstatic->fetch($object->fk_contrat);
1275 print $contratstatic->getNomUrl(0,
'', 1);
1286 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1291 print '<div class="fichehalfright">';
1292 print '<div class="ficheaddleft">';
1293 print '<div class="underbanner clearboth"></div>';
1295 print '<table class="border tableforfield centpercent">';
1297 if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
1300 print '<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1301 print '<td>'.convertSecondToTime($object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1311 print '<div class="clearboth"></div><br>';
1314 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
1316 $blocname =
'contacts';
1317 $title = $langs->trans(
'ContactsAddresses');
1318 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1321 if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB))
1323 $blocname =
'notes';
1324 $title = $langs->trans(
'Notes');
1325 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1329 if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
1331 print '<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" name="addinter" method="post">';
1332 print '<input type="hidden" name="token" value="'.newToken().
'">';
1333 print '<input type="hidden" name="id" value="'.$object->id.
'">';
1334 if ($action ==
'editline') {
1335 print '<input type="hidden" name="action" value="updateline">';
1336 print '<input type="hidden" name="line_id" value="'.GETPOST(
'line_id',
'int').
'">';
1338 print '<input type="hidden" name="action" value="addline">';
1342 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1343 $sql .=
' ft.date as date_intervention';
1344 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1345 $sql .=
' WHERE ft.fk_fichinter = '.$object->id;
1346 if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) {
1347 $sql .=
' AND ft.duree <> 0';
1349 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1351 $resql = $db->query($sql);
1354 $num = $db->num_rows(
$resql);
1360 print '<table class="noborder centpercent">';
1361 print '<tr class="liste_titre">';
1364 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1365 print '<td width="5" class="center linecolnum"></td>';
1368 print '<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1369 print '<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1370 print '<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1371 print '<td class="liste_titre"> </td>';
1372 print
'<td class="liste_titre"> </td>';
1376 $objp = $db->fetch_object(
$resql);
1379 if ($action !=
'editline' ||
GETPOST(
'line_id',
'int') != $objp->rowid) {
1380 print '<tr class="oddeven">';
1383 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1384 print '<td class="center linecolnum">'.($i + 1).
'</td>';
1388 print '<a name="'.$objp->rowid.
'"></a>';
1392 print '<td class="center" width="150">'.(empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR) ?
dol_print_date($db->jdate($objp->date_intervention),
'dayhour') :
dol_print_date($db->jdate($objp->date_intervention),
'day')).
'</td>';
1395 print '<td class="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ?
convertSecondToTime($objp->duree) :
'').
'</td>';
1400 if ($object->statut == 0 && $user->rights->ficheinter->creer)
1402 print '<td class="center">';
1403 print '<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1406 print '<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteline&line_id='.$objp->rowid.
'">';
1409 print '<td class="center">';
1414 print '<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=up&line_id='.$objp->rowid.
'">';
1420 print '<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=down&line_id='.$objp->rowid.
'">';
1427 print '<td colspan="2"> </td>';
1433 $line->fetch($objp->rowid);
1435 $extrafields->fetch_name_optionals_label($line->table_element);
1437 $line->fetch_optionals();
1439 print $line->showOptionals($extrafields,
'view', array(
'colspan'=>5));
1443 if ($object->statut == 0 && $action ==
'editline' && $user->rights->ficheinter->creer &&
GETPOST(
'line_id',
'int') == $objp->rowid)
1445 print '<tr class="oddeven nohover">';
1448 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1449 print '<td class="center linecolnum">'.($i + 1).
'</td>';
1453 print '<a name="'.$objp->rowid.
'"></a>';
1456 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1457 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2,
'90%');
1458 $doleditor->Create();
1462 print '<td class="center nowrap">';
1463 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1464 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1466 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1471 print '<td class="right">';
1472 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1473 $selectmode =
'select';
1474 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION))
1475 $selectmode =
'text';
1476 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1480 print '<td class="center" colspan="5" valign="center">';
1481 print '<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1482 print '<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1486 $line->fetch($objp->rowid);
1488 $extrafields->fetch_name_optionals_label($line->table_element);
1489 $line->fetch_optionals();
1491 print $line->showOptionals($extrafields,
'edit', array(
'colspan'=>5));
1500 if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <>
'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS))
1505 print '<table class="noborder centpercent">';
1506 print '<tr class="liste_titre">';
1509 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1510 print '<td width="5" class="center linecolnum"></td>';
1514 print '<a name="add"></a>';
1515 print $langs->trans(
'Description').
'</td>';
1516 print '<td class="center">'.$langs->trans(
'Date').
'</td>';
1517 print '<td class="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1518 print '<td colspan="3"> </td>';
1522 print '<tr class="oddeven nohover">'.
"\n";
1525 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1526 print '<td class="center linecolnum">'.($i + 1).
'</td>';
1531 if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
1532 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1533 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2,
'90%');
1534 $doleditor->Create();
1539 print '<td class="center nowrap">';
1542 if (!
GETPOST(
'diday',
'int')) {
1543 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1545 $timewithnohour =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
1547 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1548 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1550 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1555 print '<td class="right">';
1556 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1557 $selectmode =
'select';
1558 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1559 $selectmode =
'text';
1561 $form->select_duration(
'duration', (!
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) ? 3600 : (60 * 60 *
GETPOST(
'durationhour',
'int') + 60 *
GETPOST(
'durationmin',
'int')), 0, $selectmode);
1565 print '<td class="center" valign="middle" colspan="3"><input type="submit" class="button" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1572 $extrafields->fetch_name_optionals_label($lineadd->table_element);
1574 print $lineadd->showOptionals($extrafields,
'edit', array(
'colspan'=>5));
1576 if (!$num)
print '</table>';
1579 if ($num)
print '</table>';
1584 print '</form>'.
"\n";
1596 print '<div class="tabsAction">';
1598 $parameters = array();
1599 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1601 if (empty($reshook))
1603 if ($user->socid == 0)
1605 if ($action !=
'editdescription' && ($action !=
'presend')) {
1607 if ($object->statut ==
Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
1608 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) {
1609 print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate"';
1610 print '>'.$langs->trans(
"Validate").
'</a></div>';
1615 if ($object->statut ==
Fichinter::STATUS_VALIDATED && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate)))
1617 print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify">';
1618 if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
print $langs->trans(
"Modify");
1619 else print $langs->trans(
"SetToDraft");
1626 if ($user->rights->ficheinter->creer)
1628 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen">'.$langs->trans(
'Reopen').
'</a></div>';
1629 }
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'Reopen').
'</a></div>';
1633 if (empty($user->socid)) {
1636 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)
1638 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a></div>';
1639 }
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1644 if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut ==
Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
1645 print '<div class="inline-block divButAction">';
1646 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/fichinter/card-rec.php?id='.$object->id.
'&action=create">'.$langs->trans(
"ChangeIntoRepeatableIntervention").
'</a>';
1653 $langs->load(
"propal");
1656 if ($user->rights->propal->creer)
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin='.$object->element.
'&originid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddProp").
'</a></div>';
1657 else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddProp").
'</a></div>';
1664 $langs->load(
"bills");
1667 if ($user->rights->facture->creer)
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.$object->element.
'&originid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddBill").
'</a></div>';
1668 else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddBill").
'</a></div>';
1671 if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED))
1675 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=classifybilled">'.$langs->trans(
"InterventionClassifyBilled").
'</a></div>';
1677 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=classifyunbilled">'.$langs->trans(
"InterventionClassifyUnBilled").
'</a></div>';
1685 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=classifydone">'.$langs->trans(
"InterventionClassifyDone").
'</a></div>';
1689 if ($user->rights->ficheinter->creer) {
1690 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&socid='.$object->socid.
'&action=clone&object=ficheinter">'.$langs->trans(
"ToClone").
'</a></div>';
1694 if (($object->statut ==
Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer)
1696 print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'"';
1697 print '>'.$langs->trans(
'Delete').
'</a></div>';
1705 if ($action !=
'presend')
1707 print '<div class="fichecenter"><div class="fichehalfleft">';
1713 $filedir = $conf->ficheinter->dir_output.
"/".$filename;
1714 $urlsource =
$_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1715 $genallowed = $user->rights->ficheinter->lire;
1716 $delallowed = $user->rights->ficheinter->creer;
1717 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1720 $linktoelem = $form->showLinkToObjectBlock($object, null, array(
'fichinter'));
1721 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1724 print '</div><div class="fichehalfright"><div class="ficheaddleft">';
1727 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1729 $somethingshown =
$formactions->showactions($object,
'fichinter', $socid, 1);
1731 print '</div></div></div>';
1736 if (
GETPOST(
'modelselected')) {
1737 $action =
'presend';
1741 $modelmail =
'fichinter_send';
1742 $defaulttopic =
'SendInterventionRef';
1743 $diroutput = $conf->ficheinter->dir_output;
1744 $trackid =
'int'.$object->id;
1746 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
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.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action== 'set') elseif($action== 'specimen') elseif($action== 'setmodel') elseif($action== 'del') elseif($action== 'setdoc') $formactions
View.
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...
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage products or services.
Class to manage interventions.
dol_now($mode= 'auto')
Return date for now.
fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Create an intervention document on disk using template defined into FICHEINTER_ADDON_PDF.
Class to manage contracts.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom= 'UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
const STATUS_DRAFT
Draft status.
const TYPE_SERVICE
Service.
fichinter_prepare_head($object)
Prepare array with list of tabs.
const TYPE_PRODUCT
Regular product.
const STATUS_VALIDATED
Validated status.
convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0)
Convert hours and minutes into seconds.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
img_down($titlealt= 'default', $selected=0, $moreclass= '')
Show down arrow logo.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_up($titlealt= 'default', $selected=0, $moreclass= '')
Show top arrow logo.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
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.
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
const STATUS_CLOSED
Closed.
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.
dol_htmloutput_mesg($mesgstring= '', $mesgarray=array(), $style= 'ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
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).
Class to manage intervention lines.
const STATUS_BILLED
Billed.
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.
Class to manage a WYSIWYG editor.
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.
dol_htmloutput_errors($mesgstring= '', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.