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';
45if (isModEnabled(
'project')) {
46 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
49if (isModEnabled(
'contract')) {
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');
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;
445 if ($prod->duration_value &&
$conf->global->FICHINTER_USE_SERVICE_DURATION) {
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 ==
'classifybilled' && $permissiontoadd) {
657 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
662 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
666 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
671 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
675 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
680 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
683 if ($objectline->fetch($lineid) <= 0) {
688 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
694 $desc =
GETPOST(
'np_desc',
'restricthtml');
698 $objectline->date = $date_inter;
699 $objectline->desc = $desc;
700 $objectline->duration = $duration;
703 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
704 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
705 if (is_array($array_options)) {
706 $objectline->array_options = array_merge($objectline->array_options, $array_options);
709 $result = $objectline->update($user);
716 $outputlangs = $langs;
719 $newlang =
GETPOST(
'lang_id',
'aZ09');
722 $newlang =
$object->thirdparty->default_lang;
724 if (!empty($newlang)) {
726 $outputlangs->setDefaultLang($newlang);
732 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
734 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
737 if ($objectline->fetch($lineid) <= 0) {
741 $result = $objectline->deleteLine($user);
743 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
749 $outputlangs = $langs;
752 $newlang =
GETPOST(
'lang_id',
'aZ09');
755 $newlang =
$object->thirdparty->default_lang;
757 if (!empty($newlang)) {
759 $outputlangs->setDefaultLang($newlang);
764 } elseif ($action ==
'up' && $permissiontoadd) {
769 $outputlangs = $langs;
772 $newlang =
GETPOST(
'lang_id',
'aZ09');
775 $newlang =
$object->thirdparty->default_lang;
777 if (!empty($newlang)) {
779 $outputlangs->setDefaultLang($newlang);
785 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
787 } elseif ($action ==
'down' && $permissiontoadd) {
791 $outputlangs = $langs;
794 $newlang =
GETPOST(
'lang_id',
'aZ09');
797 $newlang =
$object->thirdparty->default_lang;
799 if (!empty($newlang)) {
801 $outputlangs->setDefaultLang($newlang);
807 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
812 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
815 $triggersendname =
'FICHINTER_SENTBYMAIL';
816 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
817 $trackid =
'int'.$object->id;
818 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
821 $upload_dir =
$conf->ficheinter->dir_output;
822 $permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
823 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
825 if ($action ==
'update_extras' && $permissiontoeditextra) {
828 $attribute_name =
GETPOST(
'attribute',
'aZ09');
831 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
838 $result =
$object->updateExtraField($attribute_name,
'INTERVENTION_MODIFY');
846 $action =
'edit_extras';
851 if ($action ==
'addcontact' && $permissiontoadd) {
852 if ($result > 0 && $id > 0) {
855 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
859 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
862 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
863 $langs->load(
"errors");
864 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
869 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
872 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
877 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
891$form =
new Form($db);
895if (isModEnabled(
'contract')) {
898if (isModEnabled(
'project')) {
903$help_url =
'EN:Module_Interventions';
905llxHeader(
'', $langs->trans(
"Intervention"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
907if ($action ==
'create') {
912 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
921 $res = $soc->fetch($socid);
927 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
928 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
930 $subelement = $regs[2];
933 if ($element ==
'project') {
937 if ($element ==
'order' || $element ==
'commande') {
938 $element = $subelement =
'commande';
940 if ($element ==
'propal') {
941 $element =
'comm/propal';
942 $subelement =
'propal';
944 if ($element ==
'contract') {
945 $element = $subelement =
'contrat';
950 $classname = ucfirst($subelement);
951 $objectsrc =
new $classname($db);
952 '@phan-var-force Commande|Propal|Contrat $objectsrc';
954 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
955 $objectsrc->fetch_lines();
956 $lines = $objectsrc->lines;
958 $objectsrc->fetch_thirdparty();
960 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
962 $soc = $objectsrc->thirdparty;
964 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
965 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
968 $objectsrc->fetch_optionals();
969 $object->array_options = $objectsrc->array_options;
972 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
978 if (!
$conf->global->FICHEINTER_ADDON) {
979 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
995 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
996 print
'<input type="hidden" name="token" value="'.newToken().
'">';
997 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
998 print
'<input type="hidden" name="action" value="add">';
999 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1003 print
'<table class="border centpercent">';
1005 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
1008 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
1011 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
1012 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1016 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1018 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1022 if (isModEnabled(
'project')) {
1025 $langs->load(
"project");
1027 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1034 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
1035 if ($numprojet == 0) {
1036 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>';
1042 if (isModEnabled(
'contract') && is_object($formcontract)) {
1043 $langs->load(
"contracts");
1044 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1045 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1046 if ($numcontrat == 0) {
1047 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>';
1054 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1057 print $form->selectarray(
'model', $liste,
$conf->global->FICHEINTER_ADDON_PDF);
1062 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1064 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1065 print $doleditor->Create(1);
1070 if (empty($user->socid)) {
1072 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1074 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1075 print $doleditor->Create(1);
1081 $parameters = array();
1082 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1083 print $hookmanager->resPrint;
1084 if (empty($reshook)) {
1085 print
$object->showOptionals($extrafields,
'create');
1089 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1090 $newclassname = $classname;
1091 if ($newclassname ==
'Propal') {
1092 $langs->load(
'propal');
1093 $newclassname =
'CommercialProposal';
1095 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1124 if (is_object($objectsrc)) {
1125 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1126 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1127 } elseif ($origin ==
'project' && !empty($projectid)) {
1128 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1133 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1136 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1137 $title = $langs->trans(
'Services');
1140 print
'<div class="div-table-responsive-no-min">';
1141 print
'<table class="noborder centpercent">';
1143 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1151 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1152 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1153 print
'<input type="hidden" name="action" value="create">';
1154 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1158 if (is_object($objectsrc)) {
1159 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1160 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1161 } elseif ($origin ==
'project' && !empty($projectid)) {
1162 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1164 print
'<table class="border centpercent">';
1165 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1166 print $form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300');
1167 print
' <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&customer=3&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
1173 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1177} elseif ($id > 0 || !empty($ref)) {
1194 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1199 if ($action ==
'delete') {
1200 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1204 if ($action ==
'validate') {
1206 $ref = substr(
$object->ref, 1, 4);
1207 if ($ref ==
'PROV') {
1208 $numref =
$object->getNextNumRef($soc);
1209 if (empty($numref)) {
1216 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1217 if (isModEnabled(
'notification')) {
1218 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1219 $notify =
new Notify($db);
1221 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid,
$object);
1224 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1228 if ($action ==
'sign') {
1229 $text = $langs->trans(
'ConfirmSignIntervention');
1230 if (isModEnabled(
'notification')) {
1231 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1232 $notify =
new Notify($db);
1234 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1239 'name' =>
'signed_status',
1240 'select_show_empty' => 0,
1241 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1242 'values' =>
$object->getSignedStatusLocalisedArray()
1244 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1248 if ($action ==
'unsign') {
1249 $text = $langs->trans(
'ConfirmUnsignIntervention');
1250 if (isModEnabled(
'notification')) {
1251 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1252 $notify =
new Notify($db);
1254 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1256 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1260 if ($action ==
'classifydone') {
1261 $text = $langs->trans(
'ConfirmCloseIntervention');
1262 if (isModEnabled(
'notification')) {
1263 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1264 $notify =
new Notify($db);
1266 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid,
$object);
1268 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1272 if ($action ==
'modify') {
1273 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1277 if ($action ==
'reopen') {
1278 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1282 if ($action ==
'ask_deleteline') {
1283 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1287 if ($action ==
'clone') {
1289 $formquestion = array(
1295 'label' => $langs->trans(
"SelectThirdParty"),
1296 'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')
1299 'type' =>
'checkbox',
1300 'name' =>
'clone_contacts',
1301 'label' => $langs->trans(
"CloneContacts"),
1305 'type' =>
'checkbox',
1306 'name' =>
'clone_notes',
1307 'label' => $langs->trans(
"CloneNotes"),
1313 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1316 if (!$formconfirm) {
1317 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1318 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1319 if (empty($reshook)) {
1320 $formconfirm .= $hookmanager->resPrint;
1321 } elseif ($reshook > 0) {
1322 $formconfirm = $hookmanager->resPrint;
1331 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1334 $morehtmlref =
'<div class="refidno">';
1336 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'', 0, 1);
1337 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'',
null,
null,
'', 1);
1339 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1341 if (isModEnabled(
'project')) {
1342 $langs->load(
"projects");
1343 $morehtmlref .=
'<br>';
1344 if ($permissiontoadd) {
1345 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1346 if ($action !=
'classify') {
1347 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1349 $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');
1351 if (!empty(
$object->fk_project)) {
1353 $proj->fetch(
$object->fk_project);
1354 $morehtmlref .= $proj->getNomUrl(1);
1356 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1361 $morehtmlref .=
'</div>';
1363 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1366 print
'<div class="fichecenter">';
1367 print
'<div class="fichehalfleft">';
1368 print
'<div class="underbanner clearboth"></div>';
1370 print
'<table class="border tableforfield centpercent">';
1374 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1381 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1388 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1396 print
'<tr><td class="titlefield">';
1397 print $form->editfieldkey(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea');
1399 print $form->editfieldval(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea:8');
1404 if (isModEnabled(
'contract')) {
1405 $langs->load(
'contracts');
1409 print
'<table class="nobordernopadding centpercent"><tr><td>';
1410 print $langs->trans(
'Contract');
1412 if ($action !=
'editcontract') {
1413 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1414 print
img_edit($langs->trans(
'SetContract'), 1);
1417 print
'</tr></table>';
1419 if ($action ==
'editcontract') {
1421 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1424 $contratstatic =
new Contrat($db);
1425 $contratstatic->fetch(
$object->fk_contrat);
1427 print $contratstatic->getNomUrl(0, 0, 1);
1438 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1443 print
'<div class="fichehalfright">';
1444 print
'<div class="underbanner clearboth"></div>';
1446 print
'<table class="border tableforfield centpercent">';
1450 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1460 print
'<div class="clearboth"></div><br>';
1464 $blocname =
'contacts';
1465 $title = $langs->trans(
'ContactsAddresses');
1466 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1470 $blocname =
'notes';
1471 $title = $langs->trans(
'Notes');
1472 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1477 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1478 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1479 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1480 if ($action ==
'editline') {
1481 print
'<input type="hidden" name="action" value="updateline">';
1482 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1484 print
'<input type="hidden" name="action" value="addline">';
1486 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1489 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1490 $sql .=
' ft.date as date_intervention';
1491 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1492 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1494 $sql .=
' AND ft.duree <> 0';
1496 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1498 $resql = $db->query($sql);
1500 $num = $db->num_rows($resql);
1505 print
'<table class="noborder centpercent">';
1506 print
'<tr class="liste_titre">';
1510 print
'<td width="5" class="center linecolnum"></td>';
1513 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1514 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1515 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1516 print
'<td class="liste_titre"> </td>';
1517 print
'<td class="liste_titre"> </td>';
1521 $objp = $db->fetch_object($resql);
1524 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1525 print
'<tr class="oddeven">';
1529 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1533 print
'<a name="'.$objp->rowid.
'"></a>';
1537 $objectline->fetch($objp->rowid);
1538 $objectline->fetch_optionals();
1540 $extrafields->fetch_name_optionals_label($objectline->table_element);
1542 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'',
'1',
'line');
1543 if (!empty($temps)) {
1544 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objp->rowid.
'" name="extrafield_lines_area_'.$objp->rowid.
'">';
1552 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>';
1560 if (
$object->status == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1561 print
'<td class="center">';
1562 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1565 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1568 print
'<td class="center">';
1571 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1575 if ($i < $num - 1) {
1576 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1583 print
'<td colspan="2"> </td>';
1590 if (
$object->status == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1591 print
'<tr class="oddeven nohover">';
1595 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1599 print
'<a name="'.$objp->rowid.
'"></a>';
1602 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1603 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1604 $doleditor->Create();
1607 $objectline->fetch($objp->rowid);
1608 $objectline->fetch_optionals();
1610 $extrafields->fetch_name_optionals_label($objectline->table_element);
1612 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'',
'1',
'line');
1613 if (!empty($temps)) {
1614 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1622 print
'<td class="center nowrap">';
1624 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1626 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1631 print
'<td class="right">';
1633 $selectmode =
'select';
1635 $selectmode =
'text';
1637 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1641 print
'<td class="center" colspan="5" valign="center">';
1642 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1643 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1656 print
'<table class="noborder centpercent">';
1657 print
'<tr class="liste_titre">';
1661 print
'<td width="5" class="center linecolnum"></td>';
1665 print
'<a name="add"></a>';
1666 print $langs->trans(
'Description').
'</td>';
1667 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1668 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1669 print
'<td colspan="3"> </td>';
1673 print
'<tr class="oddeven nohover">'.
"\n";
1677 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1683 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1684 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1685 $doleditor->Create();
1689 $extrafields->fetch_name_optionals_label($objectline->table_element);
1691 if (is_object($objectline)) {
1692 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'',
'1',
'line');
1694 if (!empty($temps)) {
1695 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1704 print
'<td class="center nowrap">';
1709 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1711 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1717 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1719 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1724 print
'<td class="right">';
1726 $selectmode =
'select';
1728 $selectmode =
'text';
1734 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1749 print
'</form>'.
"\n";
1761 print
'<div class="tabsAction">';
1763 $parameters = array();
1764 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1766 if (empty($reshook)) {
1768 if ($user->socid == 0) {
1769 if ($action !=
'editdescription' && ($action !=
'presend')) {
1772 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1773 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1775 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1781 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
1783 print $langs->trans(
"Modify");
1785 print $langs->trans(
"SetToDraft");
1792 if ($user->hasRight(
'ficheinter',
'creer')) {
1793 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>';
1795 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1800 if (empty($user->socid)) {
1802 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1803 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>';
1805 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1812 print
'<div class="inline-block divButAction">';
1813 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>';
1817 $arrayofcreatebutton = array();
1820 $langs->load(
"propal");
1822 $arrayofcreatebutton[] = array(
1823 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1824 'label' => $langs->trans(
'AddProp'),
1826 'perm' => $user->hasRight(
'propal',
'creer'),
1834 $langs->load(
"bills");
1836 $arrayofcreatebutton[] = array(
1837 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1838 'label' => $langs->trans(
'AddBill'),
1840 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
1847 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>';
1849 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>';
1854 if (count($arrayofcreatebutton)) {
1855 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
1860 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
1861 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>';
1863 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>';
1869 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>';
1873 if ($user->hasRight(
'ficheinter',
'creer')) {
1874 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>';
1878 print
'<div class="inline-block divButAction">';
1879 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
1887 if ($action !=
'presend') {
1888 print
'<div class="fichecenter"><div class="fichehalfleft">';
1894 $filedir =
$conf->ficheinter->dir_output.
"/".$filename;
1895 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1896 $genallowed = $user->hasRight(
'ficheinter',
'lire');
1897 $delallowed = $user->hasRight(
'ficheinter',
'creer');
1898 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1901 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(
'fichinter'), 1);
1902 $linktoelem = $tmparray[
'linktoelem'];
1903 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
1904 print $htmltoenteralink;
1906 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
1910 print
'<br><!-- Link to download main doc -->'.
"\n";
1916 print
'<br><!-- Link to sign -->';
1917 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1919 print showOnlineSignatureUrl(
'fichinter',
$object->ref,
$object).
'<br>';
1922 print
'</div><div class="fichehalfright">';
1926 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
1929 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1931 $somethingshown = $formactions->showactions(
$object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1933 print
'</div></div>';
1938 if (
GETPOST(
'modelselected')) {
1939 $action =
'presend';
1943 $modelmail =
'fichinter_send';
1944 $defaulttopic =
'SendInterventionRef';
1945 $diroutput =
$conf->ficheinter->dir_output;
1946 $trackid =
'int'.$object->id;
1948 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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.
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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
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_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.