35 require
'../main.inc.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
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")) {
50 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
'.php';
52 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
56 $langs->loadLangs(array(
'bills',
'companies',
'interventions',
'stocks'));
60 $ref_client =
GETPOST(
'ref_client',
'alpha');
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 $backtopage =
GETPOST(
'backtopage',
'alpha');
68 $mesg =
GETPOST(
'msg',
'alpha');
69 $origin =
GETPOST(
'origin',
'alpha');
71 $note_public =
GETPOST(
'note_public',
'restricthtml');
72 $note_private =
GETPOST(
'note_private',
'restricthtml');
73 $lineid =
GETPOST(
'line_id',
'int');
78 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
79 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
80 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
83 $hookmanager->initHooks(array(
'interventioncard',
'globalcard'));
89 $extrafields->fetch_name_optionals_label($object->table_element);
92 if ($id > 0 || !empty($ref)) {
93 $ret = $object->fetch($id, $ref);
95 $ret = $object->fetch_thirdparty();
104 $socid = $user->socid;
108 $permissionnote = $user->hasRight(
'ficheinter',
'creer');
109 $permissiondellink = $user->hasRight(
'ficheinter',
'creer');
110 $permissiontodelete = (($object->statut ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->rights->ficheinter->supprimer);
112 $usercancreate = $user->hasRight(
'ficheinter',
'creer');
120 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
125 if (empty($reshook)) {
126 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
128 if (empty($backtopage) || ($cancel && empty($id))) {
129 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
130 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
131 $backtopage = $backurlforlist;
133 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
139 if (!empty($backtopageforcancel)) {
140 header(
"Location: ".$backtopageforcancel);
142 } elseif (!empty($backtopage)) {
143 header(
"Location: ".$backtopage);
149 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
151 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
154 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
155 if (1 == 0 && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
158 if ($object->id > 0) {
160 $orig = clone $object;
162 $result = $object->createFromClone($user, $socid);
164 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
175 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
176 $result = $object->setValid($user);
179 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
181 $outputlangs = $langs;
184 $newlang =
GETPOST(
'lang_id',
'aZ09');
187 $newlang = $object->thirdparty->default_lang;
189 if (!empty($newlang)) {
191 $outputlangs->setDefaultLang($newlang);
196 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
199 $mesg = $object->error;
201 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
202 $result = $object->setDraft($user);
204 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
206 $outputlangs = $langs;
209 $newlang =
GETPOST(
'lang_id',
'aZ09');
212 $newlang = $object->thirdparty->default_lang;
214 if (!empty($newlang)) {
216 $outputlangs->setDefaultLang($newlang);
221 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
224 $mesg = $object->error;
226 } elseif ($action ==
'add' && $user->hasRight(
'ficheinter',
'creer')) {
227 $selectedLines =
GETPOST(
'toselect',
'array');
228 $object->socid = $socid;
229 $object->duration = (int)
GETPOST(
'duration',
'int');
230 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
231 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
232 $object->author = $user->id;
233 $object->description =
GETPOST(
'description',
'restricthtml');
235 $object->ref_client = $ref_client;
236 $object->model_pdf =
GETPOST(
'model',
'alpha');
237 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
238 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
240 if ($object->socid > 0) {
242 if (!empty($origin) && !empty($originid)) {
245 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
246 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
248 $subelement = $regs[2];
252 if ($element ==
'order') {
253 $element = $subelement =
'commande';
255 if ($element ==
'propal') {
256 $element =
'comm/propal'; $subelement =
'propal';
258 if ($element ==
'contract') {
259 $element = $subelement =
'contrat';
262 $object->origin = $origin;
263 $object->origin_id = $originid;
266 $object->linked_objects[$object->origin] = $object->origin_id;
267 if (is_array($_POST[
'other_linked_objects']) && !empty($_POST[
'other_linked_objects'])) {
268 $object->linked_objects = array_merge($object->linked_objects, $_POST[
'other_linked_objects']);
274 $ret = $extrafields->setOptionalsFromPost(
null, $object);
283 $id = $object->create($user);
288 $classname = ucfirst($subelement);
289 $srcobject =
new $classname($db);
291 dol_syslog(
"Try to find source object origin=".$object->origin.
" originid=".$object->origin_id.
" to add lines");
292 $result = $srcobject->fetch($object->origin_id);
294 $srcobject->fetch_thirdparty();
295 $lines = $srcobject->lines;
296 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
297 $srcobject->fetch_lines();
298 $lines = $srcobject->lines;
301 if (is_array($lines)) {
302 $num = count($lines);
304 for ($i = 0; $i < $num; $i++) {
305 if (!in_array($lines[$i]->
id, $selectedLines)) {
315 if ($lines[$i]->fk_product > 0) {
317 $prod->id = $lines[$i]->fk_product;
320 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
321 $prod->getMultiLangs();
323 $prod->fetch($lines[$i]->fk_product);
324 $outputlangs = $langs;
326 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
327 $newlang =
GETPOST(
'lang_id',
'aZ09');
329 if (empty($newlang)) {
330 $newlang = $srcobject->thirdparty->default_lang;
332 if (!empty($newlang)) {
334 $outputlangs->setDefaultLang($newlang);
336 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
338 $prod->fetch($lines[$i]->fk_product);
339 $label = $lines[$i]->product_label;
342 if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
343 switch ($prod->duration_unit) {
352 $mult = 3600 * 24 * 7;
355 $mult = (int) 3600 * 24 * (365 / 12);
358 $mult = 3600 * 24 * 365;
361 $duration = $prod->duration_value * $mult * $lines[$i]->qty;
364 $desc = $lines[$i]->product_ref;
372 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
375 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
384 $extrafields->fetch_name_optionals_label($object->table_element_line);
385 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
387 $result = $object->addline(
404 $langs->load(
"errors");
410 $langs->load(
"errors");
417 $ret = $extrafields->setOptionalsFromPost(
null, $object);
425 $array_options = $extrafields->getOptionalsFromPost($object->table_element);
427 $object->array_options = $array_options;
429 $result = $object->create($user);
433 $langs->load(
"errors");
441 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
445 } elseif ($action ==
'update' && $user->hasRight(
'ficheinter',
'creer')) {
446 $object->socid = $socid;
447 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
448 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
449 $object->author = $user->id;
450 $object->description =
GETPOST(
'description',
'restricthtml');
452 $object->ref_client = $ref_client;
454 $result = $object->update($user);
458 } elseif ($action ==
'classin' && $user->hasRight(
'ficheinter',
'creer')) {
460 $result = $object->setProject(
GETPOST(
'projectid',
'int'));
464 } elseif ($action ==
'setcontract' && $user->hasRight(
'contrat',
'creer')) {
466 $result = $object->set_contrat($user,
GETPOST(
'contratid',
'int'));
470 } elseif ($action ==
'setref_client' && $user->hasRight(
'ficheinter',
'creer')) {
472 $result = $object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
476 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->ficheinter->supprimer) {
477 $result = $object->delete($user);
482 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
484 } elseif ($action ==
'setdescription' && $user->hasRight(
'ficheinter',
'creer')) {
485 $result = $object->set_description($user,
GETPOST(
'description'));
489 } elseif ($action ==
"addline" && $user->hasRight(
'ficheinter',
'creer')) {
491 if (!
GETPOST(
'np_desc',
'restricthtml') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
492 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
495 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && !
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) {
496 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
499 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) &&
GETPOST(
'durationhour',
'int') >= 24 &&
GETPOST(
'durationmin',
'int') > 0) {
500 $mesg = $langs->trans(
"ErrorValueTooHigh");
506 $desc =
GETPOST(
'np_desc',
'restricthtml');
507 $date_intervention =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
511 $extrafields->fetch_name_optionals_label($object->table_element_line);
512 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
514 $result = $object->addline(
524 $outputlangs = $langs;
527 $newlang =
GETPOST(
'lang_id',
'aZ09');
530 $newlang = $object->thirdparty->default_lang;
532 if (!empty($newlang)) {
534 $outputlangs->setDefaultLang($newlang);
540 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
543 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
546 $mesg = $object->error;
550 } elseif ($action ==
'classifybilled' && $user->hasRight(
'ficheinter',
'creer')) {
554 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
559 } elseif ($action ==
'classifyunbilled' && $user->hasRight(
'ficheinter',
'creer')) {
563 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
566 $mesg = $object->error;
568 } elseif ($action ==
'classifydone' && $user->hasRight(
'ficheinter',
'creer')) {
572 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
577 } elseif ($action ==
'confirm_reopen' && $user->hasRight(
'ficheinter',
'creer')) {
581 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
584 $mesg = $object->error;
586 } elseif ($action ==
'updateline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOST(
'save',
'alpha')) {
589 if ($objectline->fetch($lineid) <= 0) {
594 if ($object->fetch($objectline->fk_fichinter) <= 0) {
598 $object->fetch_thirdparty();
600 $desc =
GETPOST(
'np_desc',
'restricthtml');
601 $date_inter =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
604 $objectline->date = $date_inter;
605 $objectline->desc = $desc;
606 $objectline->duration = $duration;
609 $extrafields->fetch_name_optionals_label($object->table_element_line);
610 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
611 $objectline->array_options = array_merge($objectline->array_options, $array_options);
613 $result = $objectline->update($user);
620 $outputlangs = $langs;
623 $newlang =
GETPOST(
'lang_id',
'aZ09');
626 $newlang = $object->thirdparty->default_lang;
628 if (!empty($newlang)) {
630 $outputlangs->setDefaultLang($newlang);
632 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
636 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
638 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
641 if ($objectline->fetch($lineid) <= 0) {
645 $result = $objectline->deleteline($user);
647 if ($object->fetch($objectline->fk_fichinter) <= 0) {
653 $outputlangs = $langs;
656 $newlang =
GETPOST(
'lang_id',
'aZ09');
659 $newlang = $object->thirdparty->default_lang;
661 if (!empty($newlang)) {
663 $outputlangs->setDefaultLang($newlang);
665 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
668 } elseif ($action ==
'up' && $user->hasRight(
'ficheinter',
'creer')) {
670 $object->line_up($lineid);
673 $outputlangs = $langs;
676 $newlang =
GETPOST(
'lang_id',
'aZ09');
679 $newlang = $object->thirdparty->default_lang;
681 if (!empty($newlang)) {
683 $outputlangs->setDefaultLang($newlang);
685 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
689 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
691 } elseif ($action ==
'down' && $user->hasRight(
'ficheinter',
'creer')) {
692 $object->line_down($lineid);
695 $outputlangs = $langs;
698 $newlang =
GETPOST(
'lang_id',
'aZ09');
701 $newlang = $object->thirdparty->default_lang;
703 if (!empty($newlang)) {
705 $outputlangs->setDefaultLang($newlang);
707 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
711 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
716 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
719 $triggersendname =
'FICHINTER_SENTBYMAIL';
720 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
721 $trackid =
'int'.$object->id;
722 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
725 $upload_dir = $conf->ficheinter->dir_output;
726 $permissiontoadd = $user->rights->ficheinter->creer;
727 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
729 if ($action ==
'update_extras') {
733 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
740 $result = $object->insertExtraFields(
'INTERVENTION_MODIFY');
748 $action =
'edit_extras';
752 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->hasRight(
'ficheinter',
'creer')) {
753 if ($action ==
'addcontact') {
754 if ($result > 0 && $id > 0) {
757 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
761 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
764 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
765 $langs->load(
"errors");
766 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
768 $mesg = $object->error;
771 } elseif ($action ==
'swapstatut') {
773 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
774 } elseif ($action ==
'deletecontact') {
776 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
779 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
807 if ($action ==
'create') {
812 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
821 $res = $soc->fetch($socid);
824 if (
GETPOST(
'origin',
'alphanohtml') &&
GETPOST(
'originid',
'int')) {
827 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
828 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
830 $subelement = $regs[2];
833 if ($element ==
'project') {
834 $projectid =
GETPOST(
'originid',
'int');
837 if ($element ==
'order' || $element ==
'commande') {
838 $element = $subelement =
'commande';
840 if ($element ==
'propal') {
841 $element =
'comm/propal'; $subelement =
'propal';
843 if ($element ==
'contract') {
844 $element = $subelement =
'contrat';
849 $classname = ucfirst($subelement);
850 $objectsrc =
new $classname($db);
851 $objectsrc->fetch(
GETPOST(
'originid'));
852 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
853 $objectsrc->fetch_lines();
854 $lines = $objectsrc->lines;
856 $objectsrc->fetch_thirdparty();
858 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
860 $soc = $objectsrc->thirdparty;
862 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
863 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
866 $objectsrc->fetch_optionals();
867 $object->array_options = $objectsrc->array_options;
870 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
873 $projectid =
GETPOST(
'projectid',
'int');
876 if (!$conf->global->FICHEINTER_ADDON) {
877 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
883 $obj = $conf->global->FICHEINTER_ADDON;
893 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
894 print
'<input type="hidden" name="token" value="'.newToken().
'">';
895 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
896 print
'<input type="hidden" name="action" value="add">';
897 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
901 print
'<table class="border centpercent">';
903 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
906 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
909 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
910 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
914 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
916 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
923 $langs->load(
"project");
925 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
932 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
933 if ($numprojet == 0) {
934 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>';
941 $langs->load(
"contracts");
942 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
943 $numcontrat = $formcontract->select_contract($soc->id,
GETPOST(
'contratid',
'int'),
'contratid', 0, 1, 1);
944 if ($numcontrat == 0) {
945 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>';
952 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
955 print
$form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
960 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
962 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3,
'90%');
963 print $doleditor->Create(1);
968 if (empty($user->socid)) {
970 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
972 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3,
'90%');
973 print $doleditor->Create(1);
980 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
981 print $hookmanager->resPrint;
982 if (empty($reshook)) {
983 print $object->showOptionals($extrafields,
'create');
987 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
988 $newclassname = $classname;
989 if ($newclassname ==
'Propal') {
990 $newclassname =
'CommercialProposal';
992 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1021 if (is_object($objectsrc)) {
1022 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1023 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1024 } elseif ($origin ==
'project' && !empty($projectid)) {
1025 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1030 print
$form->buttonsSaveCancel(
"CreateDraftIntervention");
1033 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1034 $title = $langs->trans(
'Services');
1037 print
'<div class="div-table-responsive-no-min">';
1038 print
'<table class="noborder centpercent">';
1040 $objectsrc->printOriginLinesList(empty($conf->global->FICHINTER_PRINT_PRODUCTS) ?
'services' :
'');
1048 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1049 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1050 print
'<input type="hidden" name="action" value="create">';
1051 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1055 if (is_object($objectsrc)) {
1056 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1057 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1058 } elseif ($origin ==
'project' && !empty($projectid)) {
1059 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1061 print
'<table class="border centpercent">';
1062 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1063 print
$form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0,
null, 0,
'minwidth300');
1064 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>';
1070 print
$form->buttonsSaveCancel(
"CreateDraftIntervention");
1074 } elseif ($id > 0 || !empty($ref)) {
1077 $object->fetch($id, $ref);
1078 $object->fetch_thirdparty();
1081 $soc->fetch($object->socid);
1091 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1096 if ($action ==
'delete') {
1097 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1101 if ($action ==
'validate') {
1103 $ref = substr($object->ref, 1, 4);
1104 if ($ref ==
'PROV') {
1105 $numref = $object->getNextNumRef($soc);
1106 if (empty($numref)) {
1111 $numref = $object->ref;
1113 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1115 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1119 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') {
1125 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention', $object->ref),
'confirm_reopen',
'', 0, 1);
1129 if ($action ==
'ask_deleteline') {
1130 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1134 if ($action ==
'clone') {
1136 $formquestion = array(
1142 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' =>
$form->select_company(
GETPOST(
'socid',
'int'),
'socid',
'',
'', 0, 0,
null, 0,
'minwidth200')));
1144 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1149 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1150 if (empty($reshook)) {
1152 } elseif ($reshook > 0) {
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">';
1167 $morehtmlref.=
$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'', 0, 1);
1168 $morehtmlref.=
$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'',
null,
null,
'', 1);
1170 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1173 $langs->load(
"projects");
1174 $morehtmlref .=
'<br>';
1175 if ($usercancreate) {
1176 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1177 if ($action !=
'classify') {
1178 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1180 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1182 if (!empty($object->fk_project)) {
1184 $proj->fetch($object->fk_project);
1185 $morehtmlref .= $proj->getNomUrl(1);
1187 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1192 $morehtmlref .=
'</div>';
1194 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1197 print
'<div class="fichecenter">';
1198 print
'<div class="fichehalfleft">';
1199 print
'<div class="underbanner clearboth"></div>';
1201 print
'<table class="border tableforfield centpercent">';
1203 if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) {
1205 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1207 print $object->dateo ?
dol_print_date($object->dateo,
'daytext') :
' ';
1212 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1214 print $object->datee ?
dol_print_date($object->datee,
'daytext') :
' ';
1219 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1221 print $object->datet ?
dol_print_date($object->datet,
'daytext') :
' ';
1227 print
'<tr><td class="titlefield">';
1228 print
$form->editfieldkey(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea');
1230 print
$form->editfieldval(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea:8');
1236 $langs->load(
'contracts');
1240 print
'<table class="nobordernopadding centpercent"><tr><td>';
1241 print $langs->trans(
'Contract');
1243 if ($action !=
'contrat') {
1244 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.$object->id.
'">';
1245 print
img_edit($langs->trans(
'SetContract'), 1);
1248 print
'</tr></table>';
1250 if ($action ==
'contrat') {
1252 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contrat,
'contratid', 0, 1, 1);
1254 if ($object->fk_contrat) {
1255 $contratstatic =
new Contrat($db);
1256 $contratstatic->fetch($object->fk_contrat);
1258 print $contratstatic->getNomUrl(0,
'', 1);
1269 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1274 print
'<div class="fichehalfright">';
1275 print
'<div class="underbanner clearboth"></div>';
1277 print
'<table class="border tableforfield centpercent">';
1279 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1281 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1282 print
'<td>'.convertSecondToTime($object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
' ('.
convertDurationtoHour($object->duration,
"s").
' '.$langs->trans(
"h").
')</td>';
1291 print
'<div class="clearboth"></div><br>';
1294 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
1295 $blocname =
'contacts';
1296 $title = $langs->trans(
'ContactsAddresses');
1297 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1300 if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
1301 $blocname =
'notes';
1302 $title = $langs->trans(
'Notes');
1303 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1307 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1308 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" name="addinter" method="post">';
1309 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1310 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1311 if ($action ==
'editline') {
1312 print
'<input type="hidden" name="action" value="updateline">';
1313 print
'<input type="hidden" name="line_id" value="'.GETPOST(
'line_id',
'int').
'">';
1315 print
'<input type="hidden" name="action" value="addline">';
1317 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1320 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1321 $sql .=
' ft.date as date_intervention';
1322 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1323 $sql .=
' WHERE ft.fk_fichinter = '.((int) $object->id);
1324 if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) {
1325 $sql .=
' AND ft.duree <> 0';
1327 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1329 $resql = $db->query(
$sql);
1331 $num = $db->num_rows($resql);
1336 print
'<table class="noborder centpercent">';
1337 print
'<tr class="liste_titre">';
1340 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1341 print
'<td width="5" class="center linecolnum"></td>';
1344 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1345 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1346 print
'<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1347 print
'<td class="liste_titre"> </td>';
1348 print
'<td class="liste_titre"> </td>';
1352 $objp = $db->fetch_object($resql);
1355 if ($action !=
'editline' ||
GETPOST(
'line_id',
'int') != $objp->rowid) {
1356 print
'<tr class="oddeven">';
1359 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1360 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1364 print
'<a name="'.$objp->rowid.
'"></a>';
1368 $objectline->fetch($objp->rowid);
1369 $objectline->fetch_optionals();
1371 $extrafields->fetch_name_optionals_label($objectline->table_element);
1373 if (!empty($extrafields)) {
1374 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1375 if (!empty($temps)) {
1376 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1385 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>';
1388 print
'<td class="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ?
convertSecondToTime($objp->duree) :
'').
'</td>';
1393 if ($object->statut == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1394 print
'<td class="center">';
1395 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1398 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1401 print
'<td class="center">';
1404 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1408 if ($i < $num - 1) {
1409 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1416 print
'<td colspan="2"> </td>';
1423 if ($object->statut == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOST(
'line_id',
'int') == $objp->rowid) {
1424 print
'<tr class="oddeven nohover">';
1427 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1428 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1432 print
'<a name="'.$objp->rowid.
'"></a>';
1435 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1436 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1437 $doleditor->Create();
1440 $objectline->fetch($objp->rowid);
1441 $objectline->fetch_optionals();
1443 $extrafields->fetch_name_optionals_label($objectline->table_element);
1445 if (!empty($extrafields)) {
1446 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1447 if (!empty($temps)) {
1448 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1457 print
'<td class="center nowrap">';
1458 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1459 print
$form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1461 print
$form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1466 print
'<td class="right">';
1467 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1468 $selectmode =
'select';
1469 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1470 $selectmode =
'text';
1472 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1476 print
'<td class="center" colspan="5" valign="center">';
1477 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1478 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1488 if ($object->statut == 0 && $user->hasRight(
'ficheinter',
'creer') && $action <>
'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1491 print
'<table class="noborder centpercent">';
1492 print
'<tr class="liste_titre">';
1495 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1496 print
'<td width="5" class="center linecolnum"></td>';
1500 print
'<a name="add"></a>';
1501 print $langs->trans(
'Description').
'</td>';
1502 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1503 print
'<td class="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1504 print
'<td colspan="3"> </td>';
1508 print
'<tr class="oddeven nohover">'.
"\n";
1511 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1512 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1517 if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
1518 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1519 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true, !empty($conf->global->FCKEDITOR_ENABLE_DETAILS), ROWS_2,
'90%');
1520 $doleditor->Create();
1524 $extrafields->fetch_name_optionals_label($objectline->table_element);
1526 if (is_object($objectline)) {
1527 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1529 if (!empty($temps)) {
1530 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_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 button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1580 print
'</form>'.
"\n";
1592 print
'<div class="tabsAction">';
1595 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1597 if (empty($reshook)) {
1598 if ($user->socid == 0) {
1599 if ($action !=
'editdescription' && ($action !=
'presend')) {
1601 if ($object->statut ==
Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
1602 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
'ficheinter',
'creer')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) {
1603 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate">'.$langs->trans(
"Validate").
'</a></div>';
1605 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1610 if ($object->statut ==
Fichinter::STATUS_VALIDATED && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
'ficheinter',
'creer')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate))) {
1611 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify">';
1612 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1613 print $langs->trans(
"Modify");
1615 print $langs->trans(
"SetToDraft");
1622 if ($user->rights->ficheinter->creer) {
1623 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
'ReOpen').
'</a></div>';
1625 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1630 if (empty($user->socid)) {
1632 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) {
1633 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&token='.
newToken().
'&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a></div>';
1635 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1641 if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer') && (count($object->lines) > 0)) {
1642 print
'<div class="inline-block divButAction">';
1643 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/fichinter/card-rec.php?id='.$object->id.
'&action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$object->id).
'">'.$langs->trans(
"ChangeIntoRepeatableIntervention").
'</a>';
1649 $langs->load(
"propal");
1651 if ($user->rights->propal->creer) {
1652 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>';
1654 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddProp").
'</a></div>';
1661 $langs->load(
"bills");
1663 if ($user->hasRight(
'facture',
'creer')) {
1664 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>';
1666 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddBill").
'</a></div>';
1670 if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
1672 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=classifybilled&token='.
newToken().
'">'.$langs->trans(
"InterventionClassifyBilled").
'</a></div>';
1674 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=classifyunbilled&token='.
newToken().
'">'.$langs->trans(
"InterventionClassifyUnBilled").
'</a></div>';
1681 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=classifydone&token='.
newToken().
'">'.$langs->trans(
"InterventionClassifyDone").
'</a></div>';
1685 if ($user->rights->ficheinter->creer) {
1686 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&socid='.$object->socid.
'&action=clone&token='.
newToken().
'&object=ficheinter">'.$langs->trans(
"ToClone").
'</a></div>';
1690 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
1697 if ($action !=
'presend') {
1698 print
'<div class="fichecenter"><div class="fichehalfleft">';
1704 $filedir = $conf->ficheinter->dir_output.
"/".$filename;
1705 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1706 $genallowed = $user->rights->ficheinter->lire;
1707 $delallowed = $user->rights->ficheinter->creer;
1708 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1711 $linktoelem =
$form->showLinkToObjectBlock($object,
null, array(
'fichinter'));
1712 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
1716 print
'<br><!-- Link to download main doc -->'.
"\n";
1722 print
'<br><!-- Link to sign -->';
1723 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1725 print showOnlineSignatureUrl(
'fichinter', $object->ref).
'<br>';
1728 print
'</div><div class="fichehalfright">';
1732 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.$object->id);
1735 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1737 $somethingshown =
$formactions->showactions($object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1739 print
'</div></div>';
1744 if (
GETPOST(
'modelselected')) {
1745 $action =
'presend';
1749 $modelmail =
'fichinter_send';
1750 $defaulttopic =
'SendInterventionRef';
1751 $diroutput = $conf->ficheinter->dir_output;
1752 $trackid =
'int'.$object->id;
1754 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
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 a WYSIWYG editor.
Class to manage interventions.
const STATUS_BILLED
Billed.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
const STATUS_CLOSED
Closed.
Class to manage intervention lines.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
convertDurationtoHour($duration_value, $duration_unit)
Convert duration to hour.
convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0)
Convert hours and minutes into seconds.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
fichinter_prepare_head($object)
Prepare array with list of tabs.
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_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...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
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.
showDirectDownloadLink($object)
Return string with full Url.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
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.
$formconfirm
if ($action == 'delbookkeepingyear') {
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.
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.