38require
'../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44if (isModEnabled(
'project')) {
45 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
48if (isModEnabled(
'contract')) {
49 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcontract.class.php";
50 require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
53 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_" .
getDolGlobalString(
'FICHEINTER_ADDON').
'.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
59$langs->loadLangs(array(
'bills',
'companies',
'interventions',
'stocks'));
63$ref_client =
GETPOST(
'ref_client',
'alpha');
66$action =
GETPOST(
'action',
'alpha');
67$cancel =
GETPOST(
'cancel',
'alpha');
68$confirm =
GETPOST(
'confirm',
'alpha');
69$backtopage =
GETPOST(
'backtopage',
'alpha');
72$origin =
GETPOST(
'origin',
'alpha');
74$note_public =
GETPOST(
'note_public',
'restricthtml');
75$note_private =
GETPOST(
'note_private',
'restricthtml');
86$hookmanager->initHooks(array(
'interventioncard',
'globalcard'));
92$extrafields->fetch_name_optionals_label(
$object->table_element);
95if ($id > 0 || !empty($ref)) {
96 $ret =
$object->fetch($id, $ref);
98 $ret =
$object->fetch_thirdparty();
107 $socid = $user->socid;
111$permissionnote = $user->hasRight(
'ficheinter',
'creer');
112$permissiondellink = $user->hasRight(
'ficheinter',
'creer');
113$permissiontodelete = ((
$object->statut ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->hasRight(
'ficheinter',
'supprimer'));
114$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
116$usercancreate = $user->hasRight(
'ficheinter',
'creer');
123$parameters = array(
'socid' => $socid);
124$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
129if (empty($reshook)) {
130 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
132 if (empty($backtopage) || ($cancel && empty($id))) {
133 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
134 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
135 $backtopage = $backurlforlist;
137 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
143 if (!empty($backtopageforcancel)) {
144 header(
"Location: ".$backtopageforcancel);
146 } elseif (!empty($backtopage)) {
147 header(
"Location: ".$backtopage);
153 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
155 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
158 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
159 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
166 $result =
$object->createFromClone($user, $socid);
168 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
179 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
180 $result =
$object->setValid($user);
185 $outputlangs = $langs;
188 $newlang =
GETPOST(
'lang_id',
'aZ09');
191 $newlang =
$object->thirdparty->default_lang;
193 if (!empty($newlang)) {
195 $outputlangs->setDefaultLang($newlang);
200 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
205 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
206 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
210 $outputlangs = $langs;
213 $newlang =
GETPOST(
'lang_id',
'aZ09');
216 $newlang =
$object->thirdparty->default_lang;
218 if (!empty($newlang)) {
220 $outputlangs->setDefaultLang($newlang);
225 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
230 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
231 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
235 $outputlangs = $langs;
238 $newlang =
GETPOST(
'lang_id',
'aZ09');
241 $newlang =
$object->thirdparty->default_lang;
243 if (!empty($newlang)) {
245 $outputlangs->setDefaultLang($newlang);
250 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
255 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
256 $result =
$object->setDraft($user);
260 $outputlangs = $langs;
263 $newlang =
GETPOST(
'lang_id',
'aZ09');
266 $newlang =
$object->thirdparty->default_lang;
268 if (!empty($newlang)) {
270 $outputlangs->setDefaultLang($newlang);
275 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
280 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
281 $result =
$object->setClose($user);
286 $outputlangs = $langs;
289 $newlang =
GETPOST(
'lang_id',
'aZ09');
292 $newlang =
$object->thirdparty->default_lang;
294 if (!empty($newlang)) {
296 $outputlangs->setDefaultLang($newlang);
301 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
306 } elseif ($action ==
'add' && $permissiontoadd) {
307 $selectedLines =
GETPOST(
'toselect',
'array');
312 $object->user_author_id = $user->id;
315 $object->ref_client = $ref_client;
322 if (!empty($origin) && !empty($originid)) {
325 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
326 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
328 $subelement = $regs[2];
332 if ($element ==
'order') {
333 $element = $subelement =
'commande';
335 if ($element ==
'propal') {
336 $element =
'comm/propal';
337 $subelement =
'propal';
339 if ($element ==
'contract') {
340 $element = $subelement =
'contrat';
344 $object->origin_id = $originid;
349 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
355 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
369 $classname = ucfirst($subelement);
370 $srcobject =
new $classname($db);
371 '@phan-var-force Commande|Propal|Contrat $srcobject';
374 $result = $srcobject->fetch(
$object->origin_id);
376 $srcobject->fetch_thirdparty();
377 $lines = $srcobject->lines;
378 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
379 $srcobject->fetch_lines();
380 $lines = $srcobject->lines;
383 if (is_array($lines)) {
384 $num = count($lines);
386 for ($i = 0; $i < $num; $i++) {
387 if (!in_array($lines[$i]->
id, $selectedLines)) {
397 if ($lines[$i]->fk_product > 0) {
399 $prod->id = $lines[$i]->fk_product;
403 $prod->getMultiLangs();
405 $prod->fetch($lines[$i]->fk_product);
406 $outputlangs = $langs;
408 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
409 $newlang =
GETPOST(
'lang_id',
'aZ09');
411 if (empty($newlang)) {
412 $newlang = $srcobject->thirdparty->default_lang;
414 if (!empty($newlang)) {
416 $outputlangs->setDefaultLang($newlang);
418 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
420 $prod->fetch($lines[$i]->fk_product);
421 $label = $lines[$i]->product_label;
424 if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
425 switch ($prod->duration_unit) {
434 $mult = 3600 * 24 * 7;
437 $mult = (int) (3600 * 24 * (365 / 12));
440 $mult = 3600 * 24 * 365;
443 $duration = (int) $prod->duration_value * $mult * $lines[$i]->qty;
446 $desc = $lines[$i]->product_ref;
454 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
457 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
466 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
467 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
486 $langs->load(
"errors");
492 $langs->load(
"errors");
499 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
507 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
509 $object->array_options = $array_options;
511 $result =
$object->create($user);
515 $langs->load(
"errors");
523 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
527 } elseif ($action ==
'update' && $permissiontoadd) {
531 $object->user_author_id = $user->id;
534 $object->ref_client = $ref_client;
536 $result =
$object->update($user);
540 } elseif ($action ==
'classin' && $permissiontoadd) {
546 } elseif ($action ==
'setcontract' && $permissiontoadd) {
552 } elseif ($action ==
'setref_client' && $permissiontoadd) {
554 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
558 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'supprimer')) {
559 $result =
$object->delete($user);
564 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
566 } elseif ($action ==
'setdescription' && $permissiontoadd) {
567 $result =
$object->set_description($user,
GETPOST(
'description'));
571 } elseif ($action ==
"addline" && $permissiontoadd) {
574 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
578 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
582 $mesg = $langs->trans(
"ErrorValueTooHigh");
588 $desc =
GETPOST(
'np_desc',
'restricthtml');
593 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
594 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
606 $outputlangs = $langs;
609 $newlang =
GETPOST(
'lang_id',
'aZ09');
612 $newlang =
$object->thirdparty->default_lang;
614 if (!empty($newlang)) {
616 $outputlangs->setDefaultLang($newlang);
625 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
632 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
636 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
641 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
645 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
650 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
654 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
659 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
662 if ($objectline->fetch($lineid) <= 0) {
667 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
673 $desc =
GETPOST(
'np_desc',
'restricthtml');
677 $objectline->date = $date_inter;
678 $objectline->desc = $desc;
679 $objectline->duration = $duration;
682 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
683 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
684 if (is_array($array_options)) {
685 $objectline->array_options = array_merge($objectline->array_options, $array_options);
688 $result = $objectline->update($user);
695 $outputlangs = $langs;
698 $newlang =
GETPOST(
'lang_id',
'aZ09');
701 $newlang =
$object->thirdparty->default_lang;
703 if (!empty($newlang)) {
705 $outputlangs->setDefaultLang($newlang);
711 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
713 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
716 if ($objectline->fetch($lineid) <= 0) {
720 $result = $objectline->deleteLine($user);
722 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
728 $outputlangs = $langs;
731 $newlang =
GETPOST(
'lang_id',
'aZ09');
734 $newlang =
$object->thirdparty->default_lang;
736 if (!empty($newlang)) {
738 $outputlangs->setDefaultLang($newlang);
743 } elseif ($action ==
'up' && $permissiontoadd) {
748 $outputlangs = $langs;
751 $newlang =
GETPOST(
'lang_id',
'aZ09');
754 $newlang =
$object->thirdparty->default_lang;
756 if (!empty($newlang)) {
758 $outputlangs->setDefaultLang($newlang);
764 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
766 } elseif ($action ==
'down' && $permissiontoadd) {
770 $outputlangs = $langs;
773 $newlang =
GETPOST(
'lang_id',
'aZ09');
776 $newlang =
$object->thirdparty->default_lang;
778 if (!empty($newlang)) {
780 $outputlangs->setDefaultLang($newlang);
786 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
791 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
794 $triggersendname =
'FICHINTER_SENTBYMAIL';
795 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
796 $trackid =
'int'.$object->id;
797 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
800 $upload_dir = $conf->ficheinter->dir_output;
801 $permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
802 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
804 if ($action ==
'update_extras' && $permissiontoadd) {
806 $attribute_name =
GETPOST(
'attribute',
'restricthtml');
809 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
816 $result =
$object->updateExtraField($attribute_name,
'INTERVENTION_MODIFY');
824 $action =
'edit_extras';
829 if ($action ==
'addcontact' && $permissiontoadd) {
830 if ($result > 0 && $id > 0) {
833 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
837 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
840 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
841 $langs->load(
"errors");
842 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
847 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
850 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
855 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
869$form =
new Form($db);
873if (isModEnabled(
'contract')) {
876if (isModEnabled(
'project')) {
881$help_url =
'EN:Module_Interventions';
883llxHeader(
'', $langs->trans(
"Intervention"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
885if ($action ==
'create') {
890 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
899 $res = $soc->fetch($socid);
905 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
906 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
908 $subelement = $regs[2];
911 if ($element ==
'project') {
915 if ($element ==
'order' || $element ==
'commande') {
916 $element = $subelement =
'commande';
918 if ($element ==
'propal') {
919 $element =
'comm/propal';
920 $subelement =
'propal';
922 if ($element ==
'contract') {
923 $element = $subelement =
'contrat';
928 $classname = ucfirst($subelement);
929 $objectsrc =
new $classname($db);
930 '@phan-var-force Commande|Propal|Contrat $objectsrc';
931 $objectsrc->fetch(
GETPOST(
'originid'));
932 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
933 $objectsrc->fetch_lines();
934 $lines = $objectsrc->lines;
936 $objectsrc->fetch_thirdparty();
938 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
940 $soc = $objectsrc->thirdparty;
942 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
943 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
946 $objectsrc->fetch_optionals();
947 $object->array_options = $objectsrc->array_options;
950 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
956 if (!$conf->global->FICHEINTER_ADDON) {
957 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
973 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
974 print
'<input type="hidden" name="token" value="'.newToken().
'">';
975 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
976 print
'<input type="hidden" name="action" value="add">';
977 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
981 print
'<table class="border centpercent">';
983 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
986 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
989 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
990 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
994 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
996 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1000 if (isModEnabled(
'project')) {
1003 $langs->load(
"project");
1005 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1012 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
1013 if ($numprojet == 0) {
1014 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>';
1020 if (isModEnabled(
'contract') && is_object($formcontract)) {
1021 $langs->load(
"contracts");
1022 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1023 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1024 if ($numcontrat == 0) {
1025 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>';
1032 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1035 print $form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
1040 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1042 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1043 print $doleditor->Create(1);
1048 if (empty($user->socid)) {
1050 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1052 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1053 print $doleditor->Create(1);
1059 $parameters = array();
1060 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1061 print $hookmanager->resPrint;
1062 if (empty($reshook)) {
1063 print
$object->showOptionals($extrafields,
'create');
1067 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1068 $newclassname = $classname;
1069 if ($newclassname ==
'Propal') {
1070 $newclassname =
'CommercialProposal';
1072 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1101 if (is_object($objectsrc)) {
1102 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1103 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1104 } elseif ($origin ==
'project' && !empty($projectid)) {
1105 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1110 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1113 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1114 $title = $langs->trans(
'Services');
1117 print
'<div class="div-table-responsive-no-min">';
1118 print
'<table class="noborder centpercent">';
1120 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1128 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1129 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1130 print
'<input type="hidden" name="action" value="create">';
1131 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1135 if (is_object($objectsrc)) {
1136 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1137 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1138 } elseif ($origin ==
'project' && !empty($projectid)) {
1139 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1141 print
'<table class="border centpercent">';
1142 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1143 print $form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300');
1144 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>';
1150 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1154} elseif ($id > 0 || !empty($ref)) {
1171 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1176 if ($action ==
'delete') {
1177 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1181 if ($action ==
'validate') {
1183 $ref = substr(
$object->ref, 1, 4);
1184 if ($ref ==
'PROV') {
1185 $numref =
$object->getNextNumRef($soc);
1186 if (empty($numref)) {
1193 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1194 if (isModEnabled(
'notification')) {
1195 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1196 $notify =
new Notify($db);
1198 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid,
$object);
1201 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1205 if ($action ==
'sign') {
1206 $text = $langs->trans(
'ConfirmSignIntervention');
1207 if (isModEnabled(
'notification')) {
1208 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1209 $notify =
new Notify($db);
1211 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1216 'name' =>
'signed_status',
1217 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1218 'values' =>
$object->getSignedStatusLocalisedArray()
1220 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1224 if ($action ==
'unsign') {
1225 $text = $langs->trans(
'ConfirmUnsignIntervention');
1226 if (isModEnabled(
'notification')) {
1227 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1228 $notify =
new Notify($db);
1230 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1232 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1236 if ($action ==
'classifydone') {
1237 $text = $langs->trans(
'ConfirmCloseIntervention');
1238 if (isModEnabled(
'notification')) {
1239 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1240 $notify =
new Notify($db);
1242 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid,
$object);
1244 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1248 if ($action ==
'modify') {
1249 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1253 if ($action ==
'reopen') {
1254 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1258 if ($action ==
'ask_deleteline') {
1259 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1263 if ($action ==
'clone') {
1265 $formquestion = array(
1271 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')));
1273 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1276 if (!$formconfirm) {
1277 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1278 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1279 if (empty($reshook)) {
1280 $formconfirm .= $hookmanager->resPrint;
1281 } elseif ($reshook > 0) {
1282 $formconfirm = $hookmanager->resPrint;
1291 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1294 $morehtmlref =
'<div class="refidno">';
1296 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'', 0, 1);
1297 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'',
null,
null,
'', 1);
1299 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1301 if (isModEnabled(
'project')) {
1302 $langs->load(
"projects");
1303 $morehtmlref .=
'<br>';
1304 if ($usercancreate) {
1305 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1306 if ($action !=
'classify') {
1307 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1309 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1311 if (!empty(
$object->fk_project)) {
1313 $proj->fetch(
$object->fk_project);
1314 $morehtmlref .= $proj->getNomUrl(1);
1316 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1321 $morehtmlref .=
'</div>';
1323 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1326 print
'<div class="fichecenter">';
1327 print
'<div class="fichehalfleft">';
1328 print
'<div class="underbanner clearboth"></div>';
1330 print
'<table class="border tableforfield centpercent">';
1334 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1341 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1348 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1356 print
'<tr><td class="titlefield">';
1357 print $form->editfieldkey(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea');
1359 print $form->editfieldval(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea:8');
1364 if (isModEnabled(
'contract')) {
1365 $langs->load(
'contracts');
1369 print
'<table class="nobordernopadding centpercent"><tr><td>';
1370 print $langs->trans(
'Contract');
1372 if ($action !=
'editcontract') {
1373 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1374 print
img_edit($langs->trans(
'SetContract'), 1);
1377 print
'</tr></table>';
1379 if ($action ==
'editcontract') {
1381 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1384 $contratstatic =
new Contrat($db);
1385 $contratstatic->fetch(
$object->fk_contrat);
1387 print $contratstatic->getNomUrl(0, 0, 1);
1398 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1403 print
'<div class="fichehalfright">';
1404 print
'<div class="underbanner clearboth"></div>';
1406 print
'<table class="border tableforfield centpercent">';
1410 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1411 print
'<td>'.convertSecondToTime(
$object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
' ('.
convertDurationtoHour(
$object->duration,
"s").
' '.$langs->trans(
"h").
')</td>';
1420 print
'<div class="clearboth"></div><br>';
1424 $blocname =
'contacts';
1425 $title = $langs->trans(
'ContactsAddresses');
1426 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1430 $blocname =
'notes';
1431 $title = $langs->trans(
'Notes');
1432 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1437 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1438 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1439 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1440 if ($action ==
'editline') {
1441 print
'<input type="hidden" name="action" value="updateline">';
1442 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1444 print
'<input type="hidden" name="action" value="addline">';
1446 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1449 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1450 $sql .=
' ft.date as date_intervention';
1451 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1452 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1454 $sql .=
' AND ft.duree <> 0';
1456 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1458 $resql = $db->query($sql);
1460 $num = $db->num_rows($resql);
1465 print
'<table class="noborder centpercent">';
1466 print
'<tr class="liste_titre">';
1470 print
'<td width="5" class="center linecolnum"></td>';
1473 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1474 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1475 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1476 print
'<td class="liste_titre"> </td>';
1477 print
'<td class="liste_titre"> </td>';
1481 $objp = $db->fetch_object($resql);
1484 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1485 print
'<tr class="oddeven">';
1489 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1493 print
'<a name="'.$objp->rowid.
'"></a>';
1497 $objectline->fetch($objp->rowid);
1498 $objectline->fetch_optionals();
1500 $extrafields->fetch_name_optionals_label($objectline->table_element);
1502 if (!empty($extrafields)) {
1503 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1504 if (!empty($temps)) {
1505 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1514 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>';
1522 if (
$object->statut == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1523 print
'<td class="center">';
1524 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1527 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1530 print
'<td class="center">';
1533 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1537 if ($i < $num - 1) {
1538 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1545 print
'<td colspan="2"> </td>';
1552 if (
$object->statut == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1553 print
'<tr class="oddeven nohover">';
1557 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1561 print
'<a name="'.$objp->rowid.
'"></a>';
1564 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1565 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1566 $doleditor->Create();
1569 $objectline->fetch($objp->rowid);
1570 $objectline->fetch_optionals();
1572 $extrafields->fetch_name_optionals_label($objectline->table_element);
1574 if (!empty($extrafields)) {
1575 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1576 if (!empty($temps)) {
1577 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1586 print
'<td class="center nowrap">';
1588 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1590 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1595 print
'<td class="right">';
1597 $selectmode =
'select';
1599 $selectmode =
'text';
1601 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1605 print
'<td class="center" colspan="5" valign="center">';
1606 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1607 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1620 print
'<table class="noborder centpercent">';
1621 print
'<tr class="liste_titre">';
1625 print
'<td width="5" class="center linecolnum"></td>';
1629 print
'<a name="add"></a>';
1630 print $langs->trans(
'Description').
'</td>';
1631 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1632 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1633 print
'<td colspan="3"> </td>';
1637 print
'<tr class="oddeven nohover">'.
"\n";
1641 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1647 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1648 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1649 $doleditor->Create();
1653 $extrafields->fetch_name_optionals_label($objectline->table_element);
1655 if (is_object($objectline)) {
1656 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1658 if (!empty($temps)) {
1659 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1668 print
'<td class="center nowrap">';
1673 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1675 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1681 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1683 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1688 print
'<td class="right">';
1690 $selectmode =
'select';
1692 $selectmode =
'text';
1698 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1713 print
'</form>'.
"\n";
1725 print
'<div class="tabsAction">';
1727 $parameters = array();
1728 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1730 if (empty($reshook)) {
1732 if ($user->socid == 0) {
1733 if ($action !=
'editdescription' && ($action !=
'presend')) {
1736 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1737 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1739 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1745 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
1747 print $langs->trans(
"Modify");
1749 print $langs->trans(
"SetToDraft");
1756 if ($user->hasRight(
'ficheinter',
'creer')) {
1757 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>';
1759 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1764 if (empty($user->socid)) {
1766 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1767 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>';
1769 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1776 print
'<div class="inline-block divButAction">';
1777 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>';
1781 $arrayofcreatebutton = array();
1784 $langs->load(
"propal");
1786 $arrayofcreatebutton[] = array(
1787 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1788 'label' => $langs->trans(
'AddProp'),
1790 'perm' => $user->hasRight(
'propal',
'creer'),
1798 $langs->load(
"bills");
1800 $arrayofcreatebutton[] = array(
1801 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1802 'label' => $langs->trans(
'AddBill'),
1804 'perm' => $user->hasRight(
'facture',
'creer'),
1811 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>';
1813 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>';
1818 if (count($arrayofcreatebutton)) {
1819 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
1824 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
1825 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>';
1827 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>';
1833 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>';
1837 if ($user->hasRight(
'ficheinter',
'creer')) {
1838 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>';
1842 print
'<div class="inline-block divButAction">';
1843 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
1851 if ($action !=
'presend') {
1852 print
'<div class="fichecenter"><div class="fichehalfleft">';
1858 $filedir = $conf->ficheinter->dir_output.
"/".$filename;
1859 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1860 $genallowed = $user->hasRight(
'ficheinter',
'lire');
1861 $delallowed = $user->hasRight(
'ficheinter',
'creer');
1862 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1865 $linktoelem = $form->showLinkToObjectBlock(
$object, array(), array(
'fichinter'));
1866 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
1870 print
'<br><!-- Link to download main doc -->'.
"\n";
1876 print
'<br><!-- Link to sign -->';
1877 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1879 print showOnlineSignatureUrl(
'fichinter',
$object->ref,
$object).
'<br>';
1882 print
'</div><div class="fichehalfright">';
1886 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
1889 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1891 $somethingshown = $formactions->showactions(
$object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1893 print
'</div></div>';
1898 if (
GETPOST(
'modelselected')) {
1899 $action =
'presend';
1903 $modelmail =
'fichinter_send';
1904 $defaulttopic =
'SendInterventionRef';
1905 $diroutput = $conf->ficheinter->dir_output;
1906 $trackid =
'int'.$object->id;
1908 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
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.
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'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
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.
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.