39require
'../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
46 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
50 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcontract.class.php";
51 require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
54 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_" .
getDolGlobalString(
'FICHEINTER_ADDON').
'.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
68$langs->loadLangs(array(
'bills',
'companies',
'interventions',
'stocks'));
72$ref_client =
GETPOST(
'ref_client',
'alpha');
75$action =
GETPOST(
'action',
'alpha');
76$cancel =
GETPOST(
'cancel',
'alpha');
77$confirm =
GETPOST(
'confirm',
'alpha');
78$backtopage =
GETPOST(
'backtopage',
'alpha');
81$origin =
GETPOST(
'origin',
'alpha');
83$note_public =
GETPOST(
'note_public',
'restricthtml');
84$note_private =
GETPOST(
'note_private',
'restricthtml');
95$hookmanager->initHooks(array(
'interventioncard',
'globalcard'));
101$extrafields->fetch_name_optionals_label(
$object->table_element);
104if ($id > 0 || !empty($ref)) {
105 $ret =
$object->fetch($id, $ref);
107 $ret =
$object->fetch_thirdparty();
116 $socid = $user->socid;
120$permissionnote = $user->hasRight(
'ficheinter',
'creer');
121$permissiondellink = $user->hasRight(
'ficheinter',
'creer');
122$permissiontodelete = ((
$object->status ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->hasRight(
'ficheinter',
'supprimer'));
123$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
124$permissiontoeditextra = $permissiontoadd;
125if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
127 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
135$parameters = array(
'socid' => $socid);
136$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
141if (empty($reshook)) {
142 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
144 if (empty($backtopage) || ($cancel && empty($id))) {
145 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
146 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
147 $backtopage = $backurlforlist;
149 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
155 if (!empty($backtopageforcancel)) {
156 header(
"Location: ".$backtopageforcancel);
158 } elseif (!empty($backtopage)) {
159 header(
"Location: ".$backtopage);
165 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
167 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
170 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
171 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
177 $clone_notes =
false;
178 if (GETPOSTISSET(
'clone_notes') &&
GETPOST(
'clone_notes') ===
'on') {
181 $clone_contacts =
false;
182 if (GETPOSTISSET(
'clone_contacts') &&
GETPOST(
'clone_contacts') ===
'on') {
183 $clone_contacts =
true;
186 $result =
$object->createFromClone($user, $socid, $clone_contacts, $clone_notes);
188 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
199 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
200 $result =
$object->setValid($user);
205 $outputlangs = $langs;
208 $newlang =
GETPOST(
'lang_id',
'aZ09');
211 $newlang =
$object->thirdparty->default_lang;
213 if (!empty($newlang)) {
215 $outputlangs->setDefaultLang($newlang);
220 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
225 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
226 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
230 $outputlangs = $langs;
233 $newlang =
GETPOST(
'lang_id',
'aZ09');
236 $newlang =
$object->thirdparty->default_lang;
238 if (!empty($newlang)) {
240 $outputlangs->setDefaultLang($newlang);
245 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
250 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
251 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
255 $outputlangs = $langs;
258 $newlang =
GETPOST(
'lang_id',
'aZ09');
261 $newlang =
$object->thirdparty->default_lang;
263 if (!empty($newlang)) {
265 $outputlangs->setDefaultLang($newlang);
270 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
275 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
276 $result =
$object->setDraft($user);
280 $outputlangs = $langs;
283 $newlang =
GETPOST(
'lang_id',
'aZ09');
286 $newlang =
$object->thirdparty->default_lang;
288 if (!empty($newlang)) {
290 $outputlangs->setDefaultLang($newlang);
295 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
300 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
301 $result =
$object->setClose($user);
306 $outputlangs = $langs;
309 $newlang =
GETPOST(
'lang_id',
'aZ09');
312 $newlang =
$object->thirdparty->default_lang;
314 if (!empty($newlang)) {
316 $outputlangs->setDefaultLang($newlang);
321 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
326 } elseif ($action ==
'add' && $permissiontoadd) {
327 $selectedLines =
GETPOST(
'toselect',
'array:int');
332 $object->user_author_id = $user->id;
335 $object->ref_client = $ref_client;
342 if (!empty($origin) && !empty($originid)) {
345 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
346 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
348 $subelement = $regs[2];
352 if ($element ==
'order') {
353 $element = $subelement =
'commande';
355 if ($element ==
'propal') {
356 $element =
'comm/propal';
357 $subelement =
'propal';
359 if ($element ==
'contract') {
360 $element = $subelement =
'contrat';
364 $object->origin_id = $originid;
369 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
375 $ret = $extrafields->setOptionalsFromPost(
null, $object);
389 $classname = ucfirst($subelement);
390 $srcobject =
new $classname($db);
391 '@phan-var-force Commande|Propal|Contrat $srcobject';
395 $result = $srcobject->fetch(
$object->origin_id);
397 $srcobject->fetch_thirdparty();
398 $lines = $srcobject->lines;
399 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
400 $srcobject->fetch_lines();
401 $lines = $srcobject->lines;
404 if (is_array($lines)) {
405 $num = count($lines);
407 for ($i = 0; $i < $num; $i++) {
408 if (!in_array($lines[$i]->
id, $selectedLines)) {
418 if ($lines[$i]->fk_product > 0) {
420 $prod->id = $lines[$i]->fk_product;
424 $prod->getMultiLangs();
426 $prod->fetch($lines[$i]->fk_product);
427 $outputlangs = $langs;
429 if (
GETPOST(
'lang_id',
'aZ09')) {
430 $newlang =
GETPOST(
'lang_id',
'aZ09');
432 if (empty($newlang)) {
433 $newlang = $srcobject->thirdparty->default_lang;
435 if (!empty($newlang)) {
437 $outputlangs->setDefaultLang($newlang);
439 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
441 $prod->fetch($lines[$i]->fk_product);
442 $label = $lines[$i]->product_label;
446 switch ($prod->duration_unit) {
455 $mult = 3600 * 24 * 7;
458 $mult = (int) (3600 * 24 * (365 / 12));
461 $mult = 3600 * 24 * 365;
464 $duration = (int) $prod->duration_value * $mult * $lines[$i]->qty;
467 $desc = $lines[$i]->product_ref;
475 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
478 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
487 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
488 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
507 $langs->load(
"errors");
513 $langs->load(
"errors");
520 $ret = $extrafields->setOptionalsFromPost(
null, $object);
528 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
530 $object->array_options = $array_options;
532 $result =
$object->create($user);
536 $langs->load(
"errors");
544 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
548 } elseif ($action ==
'update' && $permissiontoadd) {
552 $object->user_author_id = $user->id;
555 $object->ref_client = $ref_client;
557 $result =
$object->update($user);
561 } elseif ($action ==
'classin' && $permissiontoadd) {
567 } elseif ($action ==
'setcontract' && $permissiontoadd) {
573 } elseif ($action ==
'setref_client' && $permissiontoadd) {
575 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
579 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'supprimer')) {
580 $result =
$object->delete($user);
585 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
587 } elseif ($action ==
'setdescription' && $permissiontoadd) {
588 $result =
$object->set_description($user,
GETPOST(
'description'));
592 } elseif ($action ==
"addline" && $permissiontoadd) {
595 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
599 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
603 $mesg = $langs->trans(
"ErrorValueTooHigh");
609 $desc =
GETPOST(
'np_desc',
'restricthtml');
614 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
615 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
627 $outputlangs = $langs;
630 $newlang =
GETPOST(
'lang_id',
'aZ09');
633 $newlang =
$object->thirdparty->default_lang;
635 if (!empty($newlang)) {
637 $outputlangs->setDefaultLang($newlang);
646 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
653 } elseif ($action ==
'confirm_addtitleline' && $permissiontoadd) {
656 $langs->load(
'subtotals');
658 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
659 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
661 $subtotal_options = array();
663 foreach (Fichinter::$TITLE_OPTIONS as $option) {
664 $value =
GETPOST($option,
'alphanohtml');
666 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
671 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
682 $outputlangs = $langs;
683 $newlang =
GETPOST(
'lang_id',
'alpha');
685 $newlang =
$object->thirdparty->default_lang;
687 if (!empty($newlang)) {
689 $outputlangs->setDefaultLang($newlang);
692 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
697 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
699 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
703 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
708 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
712 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
717 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
721 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
726 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
729 if ($objectline->fetch($lineid) <= 0) {
734 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
740 $desc =
GETPOST(
'np_desc',
'restricthtml');
744 $objectline->date = $date_inter;
745 $objectline->desc = $desc;
746 $objectline->duration = $duration;
749 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
750 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
751 if (is_array($array_options)) {
752 $objectline->array_options = array_merge($objectline->array_options, $array_options);
755 $result = $objectline->update($user);
764 $outputlangs = $langs;
767 $newlang =
GETPOST(
'lang_id',
'aZ09');
770 $newlang =
$object->thirdparty->default_lang;
772 if (!empty($newlang)) {
774 $outputlangs->setDefaultLang($newlang);
780 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
782 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
785 if ($objectline->fetch($lineid) <= 0) {
789 $result = $objectline->deleteLine($user);
791 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
797 $outputlangs = $langs;
800 $newlang =
GETPOST(
'lang_id',
'aZ09');
803 $newlang =
$object->thirdparty->default_lang;
805 if (!empty($newlang)) {
807 $outputlangs->setDefaultLang($newlang);
812 } elseif ($action ==
'up' && $permissiontoadd) {
817 $outputlangs = $langs;
820 $newlang =
GETPOST(
'lang_id',
'aZ09');
823 $newlang =
$object->thirdparty->default_lang;
825 if (!empty($newlang)) {
827 $outputlangs->setDefaultLang($newlang);
833 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
835 } elseif ($action ==
'down' && $permissiontoadd) {
839 $outputlangs = $langs;
842 $newlang =
GETPOST(
'lang_id',
'aZ09');
845 $newlang =
$object->thirdparty->default_lang;
847 if (!empty($newlang)) {
849 $outputlangs->setDefaultLang($newlang);
855 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
860 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
863 $triggersendname =
'FICHINTER_SENTBYMAIL';
864 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
865 $trackid =
'int'.$object->id;
866 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
869 $upload_dir = $conf->ficheinter->dir_output;
870 $permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
871 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
873 if ($action ==
'update_extras' && $permissiontoeditextra) {
876 $attribute_name =
GETPOST(
'attribute',
'aZ09');
879 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
886 $result =
$object->updateExtraField($attribute_name,
'INTERVENTION_MODIFY');
894 $action =
'edit_extras';
899 if ($action ==
'addcontact' && $permissiontoadd) {
900 if ($result > 0 && $id > 0) {
903 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
907 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
910 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
911 $langs->load(
"errors");
912 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
917 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
920 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
925 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
939$form =
new Form($db);
951$help_url =
'EN:Module_Interventions';
953llxHeader(
'', $langs->trans(
"Intervention"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
955if ($action ==
'create') {
960 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
969 $res = $soc->fetch($socid);
975 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
976 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
978 $subelement = $regs[2];
981 if ($element ==
'project') {
985 if ($element ==
'order' || $element ==
'commande') {
986 $element = $subelement =
'commande';
988 if ($element ==
'propal') {
989 $element =
'comm/propal';
990 $subelement =
'propal';
992 if ($element ==
'contract') {
993 $element = $subelement =
'contrat';
998 $classname = ucfirst($subelement);
999 $objectsrc =
new $classname($db);
1000 '@phan-var-force Commande|Propal|Contrat $objectsrc';
1002 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
1003 $objectsrc->fetch_lines();
1004 $lines = $objectsrc->lines;
1006 $objectsrc->fetch_thirdparty();
1008 $projectid = (int) $objectsrc->fk_project;
1010 $soc = $objectsrc->thirdparty;
1012 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
1013 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
1016 $objectsrc->fetch_optionals();
1017 $object->array_options = $objectsrc->array_options;
1020 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
1026 if (!$conf->global->FICHEINTER_ADDON) {
1027 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
1041 $soc->fetch($socid);
1043 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1044 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1045 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
1046 print
'<input type="hidden" name="action" value="add">';
1047 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1051 print
'<table class="border centpercent">';
1053 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
1056 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
1059 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
1060 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1064 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1066 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1073 $langs->load(
"project");
1075 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1082 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth500 widthcentpercentminusxx');
1083 if ($numprojet == 0) {
1084 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>';
1090 if (
isModEnabled(
'contract') && is_object($formcontract)) {
1091 $langs->load(
"contracts");
1092 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1093 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1094 if ($numcontrat == 0) {
1095 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>';
1102 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1105 print $form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
1110 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1112 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1113 print $doleditor->Create(1);
1118 if (empty($user->socid)) {
1120 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1122 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1123 print $doleditor->Create(1);
1129 $parameters = array();
1130 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1131 print $hookmanager->resPrint;
1132 if (empty($reshook)) {
1133 print
$object->showOptionals($extrafields,
'create');
1137 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1138 $newclassname = $classname;
1139 if ($newclassname ==
'Propal') {
1140 $langs->load(
'propal');
1141 $newclassname =
'CommercialProposal';
1143 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1172 if (is_object($objectsrc)) {
1173 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1174 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1175 } elseif ($origin ==
'project' && !empty($projectid)) {
1176 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1181 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1184 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1185 $title = $langs->trans(
'Services');
1188 print
'<div class="div-table-responsive-no-min">';
1189 print
'<table class="noborder centpercent">';
1191 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1199 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1200 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1201 print
'<input type="hidden" name="action" value="create">';
1202 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1206 if (is_object($objectsrc)) {
1207 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1208 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1209 } elseif ($origin ==
'project' && !empty($projectid)) {
1210 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1212 print
'<table class="border centpercent">';
1213 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1214 $filter =
'(s.status:=:1)';
1216 print $form->select_company(
'',
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300');
1217 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>';
1223 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1227} elseif ($id > 0 || !empty($ref)) {
1249 if ($action ==
'delete') {
1250 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1254 if ($action ==
'validate') {
1256 $ref = substr(
$object->ref, 1, 4);
1257 if ($ref ==
'PROV') {
1258 $numref =
$object->getNextNumRef($soc);
1259 if (empty($numref)) {
1264 $numref = (string)
$object->ref;
1266 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1268 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1269 $notify =
new Notify($db);
1271 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid, $object);
1274 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1278 if ($action ==
'sign') {
1279 $text = $langs->trans(
'ConfirmSignIntervention');
1281 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1282 $notify =
new Notify($db);
1284 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1289 'name' =>
'signed_status',
1290 'select_show_empty' => 0,
1291 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1292 'values' =>
$object->getSignedStatusLocalisedArray()
1294 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1298 if ($action ==
'unsign') {
1299 $text = $langs->trans(
'ConfirmUnsignIntervention');
1301 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1302 $notify =
new Notify($db);
1304 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1306 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1310 if ($action ==
'classifydone') {
1311 $text = $langs->trans(
'ConfirmCloseIntervention');
1313 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1314 $notify =
new Notify($db);
1316 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid, $object);
1318 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1322 if ($action ==
'modify') {
1323 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1327 if ($action ==
'reopen') {
1328 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1332 if ($action ==
'ask_deleteline') {
1333 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1337 if ($action ==
'clone') {
1339 $formquestion = array(
1345 'label' => $langs->trans(
"SelectThirdParty"),
1346 'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')
1349 'type' =>
'checkbox',
1350 'name' =>
'clone_contacts',
1351 'label' => $langs->trans(
"CloneContacts"),
1355 'type' =>
'checkbox',
1356 'name' =>
'clone_notes',
1357 'label' => $langs->trans(
"CloneNotes"),
1363 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1367 if ($action ==
'add_title_line') {
1368 $langs->load(
'subtotals');
1370 $depth_array =
$object->getPossibleLevels($langs);
1372 } elseif ($action ==
'add_subtotal_line') {
1373 $langs->load(
'subtotals');
1375 $titles =
$object->getPossibleTitles();
1379 if (!$formconfirm) {
1380 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1381 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1382 if (empty($reshook)) {
1383 $formconfirm .= $hookmanager->resPrint;
1384 } elseif ($reshook > 0) {
1385 $formconfirm = $hookmanager->resPrint;
1394 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1397 $morehtmlref =
'<div class="refidno">';
1399 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'', 0, 1);
1400 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'',
null,
null,
'', 1);
1402 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1405 $langs->load(
"projects");
1406 $morehtmlref .=
'<br>';
1407 if ($permissiontoadd) {
1408 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1409 if ($action !=
'classify') {
1410 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1412 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1414 if (!empty(
$object->fk_project)) {
1416 $proj->fetch(
$object->fk_project);
1417 $morehtmlref .= $proj->getNomUrl(1);
1419 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1424 $morehtmlref .=
'</div>';
1426 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1429 print
'<div class="fichecenter">';
1430 print
'<div class="fichehalfleft">';
1431 print
'<div class="underbanner clearboth"></div>';
1433 print
'<table class="border tableforfield centpercent">';
1437 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1444 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1451 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1459 print
'<tr><td class="titlefield">';
1460 print $form->editfieldkey(
"Description",
'description',
$object->description, $object, $user->hasRight(
'ficheinter',
'creer'),
'textarea');
1462 print $form->editfieldval(
"Description",
'description',
$object->description, $object, $user->hasRight(
'ficheinter',
'creer'),
'textarea:8');
1468 $langs->load(
'contracts');
1472 print
'<table class="nobordernopadding centpercent"><tr><td>';
1473 print $langs->trans(
'Contract');
1475 if ($action !=
'editcontract') {
1476 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1477 print
img_edit($langs->trans(
'SetContract'), 1);
1480 print
'</tr></table>';
1482 if ($action ==
'editcontract') {
1484 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1487 $contratstatic =
new Contrat($db);
1488 $contratstatic->fetch(
$object->fk_contrat);
1490 print $contratstatic->getNomUrl(0, 0, 1);
1501 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1506 print
'<div class="fichehalfright">';
1507 print
'<div class="underbanner clearboth"></div>';
1509 print
'<table class="border tableforfield centpercent">';
1513 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1514 print
'<td>'.convertSecondToTime(
$object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
' ('.
convertDurationtoHour(
$object->duration,
"s").
' '.$langs->trans(
"HourShort").
')</td>';
1523 print
'<div class="clearboth"></div><br>';
1527 $blocname =
'contacts';
1528 $title = $langs->trans(
'ContactsAddresses');
1529 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1533 $blocname =
'notes';
1534 $title = $langs->trans(
'Notes');
1535 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1540 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1541 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1542 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1543 if ($action ==
'editline') {
1544 print
'<input type="hidden" name="action" value="updateline">';
1545 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1547 print
'<input type="hidden" name="action" value="addline">';
1549 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1552 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1553 $sql .=
' ft.special_code, ft.product_type,';
1554 $sql .=
' ft.date as date_intervention';
1555 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1556 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1558 $sql .=
' AND ft.duree <> 0';
1560 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1562 $resql = $db->query($sql);
1564 $num = $db->num_rows($resql);
1569 print
'<table class="noborder centpercent">';
1570 print
'<tr class="liste_titre">';
1574 print
'<td width="5" class="center linecolnum"></td>';
1577 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1578 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1579 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1580 print
'<td class="liste_titre"> </td>';
1581 print
'<td class="liste_titre"> </td>';
1585 $objp = $db->fetch_object($resql);
1588 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1589 print
'<tr class="oddeven">';
1593 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1595 if (!empty($objp->special_code) || $objp->product_type == 9) {
1596 $line_color =
$object->getSubtotalColors($objp->duree);
1597 $line_options = json_decode($objp->extraparams,
true);
1598 $line_options = is_array($line_options) ? $line_options[
'subtotal'] : array();
1599 print
'<td colspan="3" ><strong>'.dol_htmlentitiesbr($objp->description).
'</strong>';
1600 if (array_key_exists(
'titleshowuponpdf', $line_options)) {
1601 echo
' ' .
img_picto($langs->trans(
"ShowUPOnPDF"),
'invoicing');
1603 if (array_key_exists(
'titleshowtotalexludingvatonpdf', $line_options)) {
1604 echo
' <span title="' . $langs->trans(
"ShowTotalExludingVATOnPDF") .
'">%</span>';
1606 if (array_key_exists(
'titleforcepagebreak', $line_options)) {
1607 echo
' ' .
img_picto($langs->trans(
"ForcePageBreak"),
'file');
1612 print
'<a name="'.$objp->rowid.
'"></a>';
1616 $objectline->fetch($objp->rowid);
1617 $objectline->fetch_optionals();
1619 $extrafields->fetch_name_optionals_label($objectline->table_element);
1621 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'',
'1',
'line');
1622 if (!empty($temps)) {
1623 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objp->rowid.
'" name="extrafield_lines_area_'.$objp->rowid.
'">';
1631 print
'<td class="center" width="150">'.(!
getDolGlobalString(
'FICHINTER_DATE_WITHOUT_HOUR') ?
dol_print_date($db->jdate($objp->date_intervention),
'dayhour') :
dol_print_date($db->jdate($objp->date_intervention),
'day')).
'</td>';
1639 if (
$object->status == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1640 print
'<td class="center">';
1641 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1644 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1647 print
'<td class="center">';
1650 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1654 if ($i < $num - 1) {
1655 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1662 print
'<td colspan="2"> </td>';
1669 if (
$object->status == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1670 print
'<tr class="oddeven nohover">';
1674 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1678 print
'<a name="'.$objp->rowid.
'"></a>';
1681 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1682 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1683 $doleditor->Create();
1686 $objectline->fetch($objp->rowid);
1687 $objectline->fetch_optionals();
1689 $extrafields->fetch_name_optionals_label($objectline->table_element);
1691 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'',
'1',
'line');
1692 if (!empty($temps)) {
1693 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objectline->id.
'" name="extrafield_lines_area_'.$objectline->id.
'">';
1701 print
'<td class="center nowrap">';
1703 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1705 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1710 print
'<td class="right">';
1712 $selectmode =
'select';
1714 $selectmode =
'text';
1716 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1720 print
'<td class="center" colspan="5" valign="center">';
1721 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1722 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1735 print
'<table class="noborder centpercent">';
1736 print
'<tr class="liste_titre">';
1740 print
'<td width="5" class="center linecolnum"></td>';
1744 print
'<a name="add"></a>';
1745 print $langs->trans(
'Description').
'</td>';
1746 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1747 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1748 print
'<td colspan="3"> </td>';
1752 print
'<tr class="oddeven nohover">'.
"\n";
1756 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1762 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1763 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1764 $doleditor->Create();
1768 $extrafields->fetch_name_optionals_label($objectline->table_element);
1770 if (is_object($objectline)) {
1771 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'',
'1',
'line');
1773 if (!empty($temps)) {
1774 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1783 print
'<td class="center nowrap">';
1788 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1790 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1796 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1798 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1803 print
'<td class="right">';
1805 $selectmode =
'select';
1807 $selectmode =
'text';
1813 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1828 print
'</form>'.
"\n";
1840 print
'<div class="tabsAction">';
1842 $parameters = array();
1843 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1845 if (empty($reshook)) {
1847 if ($user->socid == 0) {
1848 if ($action !=
'editdescription' && ($action !=
'presend')) {
1851 $langs->load(
'subtotals');
1853 $url_button = array();
1854 $url_button[] = array(
1855 'lang' =>
'subtotals',
1857 'perm' => (
bool) $user->hasRight(
'intervention',
'creer'),
1858 'label' => $langs->trans(
'AddTitleLine'),
1859 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_title_line&token='.
newToken()
1862 $url_button[] = array(
1863 'lang' =>
'subtotals',
1865 'perm' => (
bool) $user->hasRight(
'intervention',
'creer'),
1866 'label' => $langs->trans(
'AddSubtotalLine'),
1867 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_subtotal_line&token='.
newToken()
1869 print
dolGetButtonAction(
'', $langs->trans(
'Subtotal'),
'default', $url_button,
'',
true);
1874 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1875 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1877 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1883 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
1885 print $langs->trans(
"Modify");
1887 print $langs->trans(
"SetToDraft");
1894 if ($user->hasRight(
'ficheinter',
'creer')) {
1895 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>';
1897 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1902 if (empty($user->socid)) {
1904 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1905 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
1914 print
'<div class="inline-block divButAction">';
1915 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>';
1919 $arrayofcreatebutton = array();
1922 $langs->load(
"propal");
1924 $arrayofcreatebutton[] = array(
1925 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1926 'label' => $langs->trans(
'AddProp'),
1928 'perm' => $user->hasRight(
'propal',
'creer'),
1936 $langs->load(
"bills");
1938 $arrayofcreatebutton[] = array(
1939 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1940 'label' => $langs->trans(
'AddBill'),
1942 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
1949 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>';
1951 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>';
1956 if (count($arrayofcreatebutton)) {
1957 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
1962 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
1963 print
'<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=sign&token=' .
newToken() .
'">' . $langs->trans(
"InterventionSign") .
'</a></div>';
1965 print
'<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=unsign&token=' .
newToken() .
'">' . $langs->trans(
"InterventionUnsign") .
'</a></div>';
1971 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>';
1975 if ($user->hasRight(
'ficheinter',
'creer')) {
1976 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>';
1980 print
'<div class="inline-block divButAction">';
1981 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
1989 if ($action !=
'presend') {
1990 print
'<div class="fichecenter"><div class="fichehalfleft">';
1996 $filedir = $conf->ficheinter->dir_output.
"/".$filename;
1997 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1998 $genallowed = $user->hasRight(
'ficheinter',
'lire');
1999 $delallowed = $user->hasRight(
'ficheinter',
'creer');
2000 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2003 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'fichinter'), 1);
2004 $linktoelem = $tmparray[
'linktoelem'];
2005 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2006 print $htmltoenteralink;
2008 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2012 print
'<br><!-- Link to download main doc -->'.
"\n";
2018 print
'<br><!-- Link to sign -->';
2019 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2021 print showOnlineSignatureUrl(
'fichinter',
$object->ref, $object).
'<br>';
2024 print
'</div><div class="fichehalfright">';
2028 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
2031 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2033 $somethingshown = $formactions->showactions($object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
2035 print
'</div></div>';
2040 if (
GETPOST(
'modelselected')) {
2041 $action =
'presend';
2045 $modelmail =
'fichinter_send';
2046 $defaulttopic =
'SendInterventionRef';
2047 $diroutput = $conf->ficheinter->dir_output;
2048 $trackid =
'int'.$object->id;
2050 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
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 the table of subscription to notifications.
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.
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_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
showDirectDownloadLink($object)
Return string with full Url.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted 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.
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.