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->statut ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->hasRight(
'ficheinter',
'supprimer'));
123$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
125$usercancreate = $user->hasRight(
'ficheinter',
'creer');
132$parameters = array(
'socid' => $socid);
133$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
138if (empty($reshook)) {
139 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
141 if (empty($backtopage) || ($cancel && empty($id))) {
142 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
143 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
144 $backtopage = $backurlforlist;
146 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
152 if (!empty($backtopageforcancel)) {
153 header(
"Location: ".$backtopageforcancel);
155 } elseif (!empty($backtopage)) {
156 header(
"Location: ".$backtopage);
162 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
164 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
167 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
168 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
175 $result =
$object->createFromClone($user, $socid);
177 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
188 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
189 $result =
$object->setValid($user);
194 $outputlangs = $langs;
197 $newlang =
GETPOST(
'lang_id',
'aZ09');
200 $newlang =
$object->thirdparty->default_lang;
202 if (!empty($newlang)) {
204 $outputlangs->setDefaultLang($newlang);
209 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
214 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
215 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
219 $outputlangs = $langs;
222 $newlang =
GETPOST(
'lang_id',
'aZ09');
225 $newlang =
$object->thirdparty->default_lang;
227 if (!empty($newlang)) {
229 $outputlangs->setDefaultLang($newlang);
234 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
239 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
240 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
244 $outputlangs = $langs;
247 $newlang =
GETPOST(
'lang_id',
'aZ09');
250 $newlang =
$object->thirdparty->default_lang;
252 if (!empty($newlang)) {
254 $outputlangs->setDefaultLang($newlang);
259 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
264 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
265 $result =
$object->setDraft($user);
269 $outputlangs = $langs;
272 $newlang =
GETPOST(
'lang_id',
'aZ09');
275 $newlang =
$object->thirdparty->default_lang;
277 if (!empty($newlang)) {
279 $outputlangs->setDefaultLang($newlang);
284 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
289 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
290 $result =
$object->setClose($user);
295 $outputlangs = $langs;
298 $newlang =
GETPOST(
'lang_id',
'aZ09');
301 $newlang =
$object->thirdparty->default_lang;
303 if (!empty($newlang)) {
305 $outputlangs->setDefaultLang($newlang);
310 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
315 } elseif ($action ==
'add' && $permissiontoadd) {
316 $selectedLines =
GETPOST(
'toselect',
'array');
321 $object->user_author_id = $user->id;
324 $object->ref_client = $ref_client;
331 if (!empty($origin) && !empty($originid)) {
334 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
335 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
337 $subelement = $regs[2];
341 if ($element ==
'order') {
342 $element = $subelement =
'commande';
344 if ($element ==
'propal') {
345 $element =
'comm/propal';
346 $subelement =
'propal';
348 if ($element ==
'contract') {
349 $element = $subelement =
'contrat';
353 $object->origin_id = $originid;
358 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
364 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
378 $classname = ucfirst($subelement);
379 $srcobject =
new $classname($db);
380 '@phan-var-force Commande|Propal|Contrat $srcobject';
384 $result = $srcobject->fetch(
$object->origin_id);
386 $srcobject->fetch_thirdparty();
387 $lines = $srcobject->lines;
388 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
389 $srcobject->fetch_lines();
390 $lines = $srcobject->lines;
393 if (is_array($lines)) {
394 $num = count($lines);
396 for ($i = 0; $i < $num; $i++) {
397 if (!in_array($lines[$i]->
id, $selectedLines)) {
407 if ($lines[$i]->fk_product > 0) {
409 $prod->id = $lines[$i]->fk_product;
413 $prod->getMultiLangs();
415 $prod->fetch($lines[$i]->fk_product);
416 $outputlangs = $langs;
418 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
419 $newlang =
GETPOST(
'lang_id',
'aZ09');
421 if (empty($newlang)) {
422 $newlang = $srcobject->thirdparty->default_lang;
424 if (!empty($newlang)) {
426 $outputlangs->setDefaultLang($newlang);
428 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
430 $prod->fetch($lines[$i]->fk_product);
431 $label = $lines[$i]->product_label;
434 if ($prod->duration_value &&
$conf->global->FICHINTER_USE_SERVICE_DURATION) {
435 switch ($prod->duration_unit) {
444 $mult = 3600 * 24 * 7;
447 $mult = (int) (3600 * 24 * (365 / 12));
450 $mult = 3600 * 24 * 365;
453 $duration = (int) $prod->duration_value * $mult * $lines[$i]->qty;
456 $desc = $lines[$i]->product_ref;
464 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
467 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
476 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
477 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
496 $langs->load(
"errors");
502 $langs->load(
"errors");
509 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
517 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
519 $object->array_options = $array_options;
521 $result =
$object->create($user);
525 $langs->load(
"errors");
533 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
537 } elseif ($action ==
'update' && $permissiontoadd) {
541 $object->user_author_id = $user->id;
544 $object->ref_client = $ref_client;
546 $result =
$object->update($user);
550 } elseif ($action ==
'classin' && $permissiontoadd) {
556 } elseif ($action ==
'setcontract' && $permissiontoadd) {
562 } elseif ($action ==
'setref_client' && $permissiontoadd) {
564 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
568 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'supprimer')) {
569 $result =
$object->delete($user);
574 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
576 } elseif ($action ==
'setdescription' && $permissiontoadd) {
577 $result =
$object->set_description($user,
GETPOST(
'description'));
581 } elseif ($action ==
"addline" && $permissiontoadd) {
584 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
588 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
592 $mesg = $langs->trans(
"ErrorValueTooHigh");
598 $desc =
GETPOST(
'np_desc',
'restricthtml');
603 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
604 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
616 $outputlangs = $langs;
619 $newlang =
GETPOST(
'lang_id',
'aZ09');
622 $newlang =
$object->thirdparty->default_lang;
624 if (!empty($newlang)) {
626 $outputlangs->setDefaultLang($newlang);
635 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
642 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
646 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
651 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
655 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
660 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
664 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
669 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
672 if ($objectline->fetch($lineid) <= 0) {
677 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
683 $desc =
GETPOST(
'np_desc',
'restricthtml');
687 $objectline->date = $date_inter;
688 $objectline->desc = $desc;
689 $objectline->duration = $duration;
692 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
693 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
694 if (is_array($array_options)) {
695 $objectline->array_options = array_merge($objectline->array_options, $array_options);
698 $result = $objectline->update($user);
705 $outputlangs = $langs;
708 $newlang =
GETPOST(
'lang_id',
'aZ09');
711 $newlang =
$object->thirdparty->default_lang;
713 if (!empty($newlang)) {
715 $outputlangs->setDefaultLang($newlang);
721 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
723 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
726 if ($objectline->fetch($lineid) <= 0) {
730 $result = $objectline->deleteLine($user);
732 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
738 $outputlangs = $langs;
741 $newlang =
GETPOST(
'lang_id',
'aZ09');
744 $newlang =
$object->thirdparty->default_lang;
746 if (!empty($newlang)) {
748 $outputlangs->setDefaultLang($newlang);
753 } elseif ($action ==
'up' && $permissiontoadd) {
758 $outputlangs = $langs;
761 $newlang =
GETPOST(
'lang_id',
'aZ09');
764 $newlang =
$object->thirdparty->default_lang;
766 if (!empty($newlang)) {
768 $outputlangs->setDefaultLang($newlang);
774 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
776 } elseif ($action ==
'down' && $permissiontoadd) {
780 $outputlangs = $langs;
783 $newlang =
GETPOST(
'lang_id',
'aZ09');
786 $newlang =
$object->thirdparty->default_lang;
788 if (!empty($newlang)) {
790 $outputlangs->setDefaultLang($newlang);
796 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
801 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
804 $triggersendname =
'FICHINTER_SENTBYMAIL';
805 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
806 $trackid =
'int'.$object->id;
807 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
810 $upload_dir =
$conf->ficheinter->dir_output;
811 $permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
812 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
814 if ($action ==
'update_extras' && $permissiontoadd) {
816 $attribute_name =
GETPOST(
'attribute',
'restricthtml');
819 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
826 $result =
$object->updateExtraField($attribute_name,
'INTERVENTION_MODIFY');
834 $action =
'edit_extras';
839 if ($action ==
'addcontact' && $permissiontoadd) {
840 if ($result > 0 && $id > 0) {
843 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
847 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
850 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
851 $langs->load(
"errors");
852 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
857 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
860 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
865 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
879$form =
new Form($db);
883if (isModEnabled(
'contract')) {
886if (isModEnabled(
'project')) {
891$help_url =
'EN:Module_Interventions';
893llxHeader(
'', $langs->trans(
"Intervention"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
895if ($action ==
'create') {
900 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
909 $res = $soc->fetch($socid);
915 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
916 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
918 $subelement = $regs[2];
921 if ($element ==
'project') {
925 if ($element ==
'order' || $element ==
'commande') {
926 $element = $subelement =
'commande';
928 if ($element ==
'propal') {
929 $element =
'comm/propal';
930 $subelement =
'propal';
932 if ($element ==
'contract') {
933 $element = $subelement =
'contrat';
938 $classname = ucfirst($subelement);
939 $objectsrc =
new $classname($db);
940 '@phan-var-force Commande|Propal|Contrat $objectsrc';
941 $objectsrc->fetch(
GETPOST(
'originid'));
942 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
943 $objectsrc->fetch_lines();
944 $lines = $objectsrc->lines;
946 $objectsrc->fetch_thirdparty();
948 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
950 $soc = $objectsrc->thirdparty;
952 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
953 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
956 $objectsrc->fetch_optionals();
957 $object->array_options = $objectsrc->array_options;
960 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
966 if (!
$conf->global->FICHEINTER_ADDON) {
967 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
983 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
984 print
'<input type="hidden" name="token" value="'.newToken().
'">';
985 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
986 print
'<input type="hidden" name="action" value="add">';
987 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
991 print
'<table class="border centpercent">';
993 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
996 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
999 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
1000 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1004 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1006 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1010 if (isModEnabled(
'project')) {
1013 $langs->load(
"project");
1015 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1022 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
1023 if ($numprojet == 0) {
1024 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>';
1030 if (isModEnabled(
'contract') && is_object($formcontract)) {
1031 $langs->load(
"contracts");
1032 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1033 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1034 if ($numcontrat == 0) {
1035 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>';
1042 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1045 print $form->selectarray(
'model', $liste,
$conf->global->FICHEINTER_ADDON_PDF);
1050 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1052 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1053 print $doleditor->Create(1);
1058 if (empty($user->socid)) {
1060 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1062 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1063 print $doleditor->Create(1);
1069 $parameters = array();
1070 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1071 print $hookmanager->resPrint;
1072 if (empty($reshook)) {
1073 print
$object->showOptionals($extrafields,
'create');
1077 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1078 $newclassname = $classname;
1079 if ($newclassname ==
'Propal') {
1080 $langs->load(
'propal');
1081 $newclassname =
'CommercialProposal';
1083 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1112 if (is_object($objectsrc)) {
1113 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1114 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1115 } elseif ($origin ==
'project' && !empty($projectid)) {
1116 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1121 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1124 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1125 $title = $langs->trans(
'Services');
1128 print
'<div class="div-table-responsive-no-min">';
1129 print
'<table class="noborder centpercent">';
1131 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1139 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1140 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1141 print
'<input type="hidden" name="action" value="create">';
1142 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1146 if (is_object($objectsrc)) {
1147 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1148 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1149 } elseif ($origin ==
'project' && !empty($projectid)) {
1150 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1152 print
'<table class="border centpercent">';
1153 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1154 print $form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300');
1155 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>';
1161 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1165} elseif ($id > 0 || !empty($ref)) {
1182 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1187 if ($action ==
'delete') {
1188 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1192 if ($action ==
'validate') {
1194 $ref = substr(
$object->ref, 1, 4);
1195 if ($ref ==
'PROV') {
1196 $numref =
$object->getNextNumRef($soc);
1197 if (empty($numref)) {
1204 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1205 if (isModEnabled(
'notification')) {
1206 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1207 $notify =
new Notify($db);
1209 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid,
$object);
1212 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1216 if ($action ==
'sign') {
1217 $text = $langs->trans(
'ConfirmSignIntervention');
1218 if (isModEnabled(
'notification')) {
1219 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1220 $notify =
new Notify($db);
1222 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1227 'name' =>
'signed_status',
1228 'select_show_empty' => 0,
1229 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1230 'values' =>
$object->getSignedStatusLocalisedArray()
1232 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1236 if ($action ==
'unsign') {
1237 $text = $langs->trans(
'ConfirmUnsignIntervention');
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_MODIFY',
$object->socid,
$object);
1244 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1248 if ($action ==
'classifydone') {
1249 $text = $langs->trans(
'ConfirmCloseIntervention');
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_CLOSE',
$object->socid,
$object);
1256 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1260 if ($action ==
'modify') {
1261 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1265 if ($action ==
'reopen') {
1266 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1270 if ($action ==
'ask_deleteline') {
1271 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1275 if ($action ==
'clone') {
1277 $formquestion = array(
1283 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')));
1285 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1288 if (!$formconfirm) {
1289 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1290 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1291 if (empty($reshook)) {
1292 $formconfirm .= $hookmanager->resPrint;
1293 } elseif ($reshook > 0) {
1294 $formconfirm = $hookmanager->resPrint;
1303 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1306 $morehtmlref =
'<div class="refidno">';
1308 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'', 0, 1);
1309 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'',
null,
null,
'', 1);
1311 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1313 if (isModEnabled(
'project')) {
1314 $langs->load(
"projects");
1315 $morehtmlref .=
'<br>';
1316 if ($usercancreate) {
1317 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1318 if ($action !=
'classify') {
1319 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1321 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1323 if (!empty(
$object->fk_project)) {
1325 $proj->fetch(
$object->fk_project);
1326 $morehtmlref .= $proj->getNomUrl(1);
1328 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1333 $morehtmlref .=
'</div>';
1335 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1338 print
'<div class="fichecenter">';
1339 print
'<div class="fichehalfleft">';
1340 print
'<div class="underbanner clearboth"></div>';
1342 print
'<table class="border tableforfield centpercent">';
1346 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1353 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1360 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1368 print
'<tr><td class="titlefield">';
1369 print $form->editfieldkey(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea');
1371 print $form->editfieldval(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea:8');
1376 if (isModEnabled(
'contract')) {
1377 $langs->load(
'contracts');
1381 print
'<table class="nobordernopadding centpercent"><tr><td>';
1382 print $langs->trans(
'Contract');
1384 if ($action !=
'editcontract') {
1385 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1386 print
img_edit($langs->trans(
'SetContract'), 1);
1389 print
'</tr></table>';
1391 if ($action ==
'editcontract') {
1393 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1396 $contratstatic =
new Contrat($db);
1397 $contratstatic->fetch(
$object->fk_contrat);
1399 print $contratstatic->getNomUrl(0, 0, 1);
1410 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1415 print
'<div class="fichehalfright">';
1416 print
'<div class="underbanner clearboth"></div>';
1418 print
'<table class="border tableforfield centpercent">';
1422 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1432 print
'<div class="clearboth"></div><br>';
1436 $blocname =
'contacts';
1437 $title = $langs->trans(
'ContactsAddresses');
1438 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1442 $blocname =
'notes';
1443 $title = $langs->trans(
'Notes');
1444 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1449 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1450 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1451 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1452 if ($action ==
'editline') {
1453 print
'<input type="hidden" name="action" value="updateline">';
1454 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1456 print
'<input type="hidden" name="action" value="addline">';
1458 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1461 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1462 $sql .=
' ft.date as date_intervention';
1463 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1464 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1466 $sql .=
' AND ft.duree <> 0';
1468 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1470 $resql = $db->query($sql);
1472 $num = $db->num_rows($resql);
1477 print
'<table class="noborder centpercent">';
1478 print
'<tr class="liste_titre">';
1482 print
'<td width="5" class="center linecolnum"></td>';
1485 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1486 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1487 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1488 print
'<td class="liste_titre"> </td>';
1489 print
'<td class="liste_titre"> </td>';
1493 $objp = $db->fetch_object($resql);
1496 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1497 print
'<tr class="oddeven">';
1501 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1505 print
'<a name="'.$objp->rowid.
'"></a>';
1509 $objectline->fetch($objp->rowid);
1510 $objectline->fetch_optionals();
1512 $extrafields->fetch_name_optionals_label($objectline->table_element);
1514 if (!empty($extrafields)) {
1515 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1516 if (!empty($temps)) {
1517 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1526 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>';
1534 if (
$object->statut == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1535 print
'<td class="center">';
1536 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1539 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1542 print
'<td class="center">';
1545 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1549 if ($i < $num - 1) {
1550 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1557 print
'<td colspan="2"> </td>';
1564 if (
$object->statut == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1565 print
'<tr class="oddeven nohover">';
1569 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1573 print
'<a name="'.$objp->rowid.
'"></a>';
1576 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1577 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1578 $doleditor->Create();
1581 $objectline->fetch($objp->rowid);
1582 $objectline->fetch_optionals();
1584 $extrafields->fetch_name_optionals_label($objectline->table_element);
1586 if (!empty($extrafields)) {
1587 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1588 if (!empty($temps)) {
1589 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1598 print
'<td class="center nowrap">';
1600 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1602 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1607 print
'<td class="right">';
1609 $selectmode =
'select';
1611 $selectmode =
'text';
1613 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1617 print
'<td class="center" colspan="5" valign="center">';
1618 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1619 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1632 print
'<table class="noborder centpercent">';
1633 print
'<tr class="liste_titre">';
1637 print
'<td width="5" class="center linecolnum"></td>';
1641 print
'<a name="add"></a>';
1642 print $langs->trans(
'Description').
'</td>';
1643 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1644 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1645 print
'<td colspan="3"> </td>';
1649 print
'<tr class="oddeven nohover">'.
"\n";
1653 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1659 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1660 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1661 $doleditor->Create();
1665 $extrafields->fetch_name_optionals_label($objectline->table_element);
1667 if (is_object($objectline)) {
1668 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1670 if (!empty($temps)) {
1671 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1680 print
'<td class="center nowrap">';
1685 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1687 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1693 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1695 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1700 print
'<td class="right">';
1702 $selectmode =
'select';
1704 $selectmode =
'text';
1710 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1725 print
'</form>'.
"\n";
1737 print
'<div class="tabsAction">';
1739 $parameters = array();
1740 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1742 if (empty($reshook)) {
1744 if ($user->socid == 0) {
1745 if ($action !=
'editdescription' && ($action !=
'presend')) {
1748 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1749 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1751 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1757 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
1759 print $langs->trans(
"Modify");
1761 print $langs->trans(
"SetToDraft");
1768 if ($user->hasRight(
'ficheinter',
'creer')) {
1769 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>';
1771 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1776 if (empty($user->socid)) {
1778 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1779 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>';
1781 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1788 print
'<div class="inline-block divButAction">';
1789 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>';
1793 $arrayofcreatebutton = array();
1796 $langs->load(
"propal");
1798 $arrayofcreatebutton[] = array(
1799 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1800 'label' => $langs->trans(
'AddProp'),
1802 'perm' => $user->hasRight(
'propal',
'creer'),
1810 $langs->load(
"bills");
1812 $arrayofcreatebutton[] = array(
1813 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1814 'label' => $langs->trans(
'AddBill'),
1816 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
1823 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>';
1825 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>';
1830 if (count($arrayofcreatebutton)) {
1831 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
1836 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
1837 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>';
1839 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>';
1845 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>';
1849 if ($user->hasRight(
'ficheinter',
'creer')) {
1850 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>';
1854 print
'<div class="inline-block divButAction">';
1855 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
1863 if ($action !=
'presend') {
1864 print
'<div class="fichecenter"><div class="fichehalfleft">';
1870 $filedir =
$conf->ficheinter->dir_output.
"/".$filename;
1871 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1872 $genallowed = $user->hasRight(
'ficheinter',
'lire');
1873 $delallowed = $user->hasRight(
'ficheinter',
'creer');
1874 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1877 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(
'fichinter'), 1);
1878 $linktoelem = $tmparray[
'linktoelem'];
1879 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
1880 print $htmltoenteralink;
1882 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
1886 print
'<br><!-- Link to download main doc -->'.
"\n";
1892 print
'<br><!-- Link to sign -->';
1893 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1895 print showOnlineSignatureUrl(
'fichinter',
$object->ref,
$object).
'<br>';
1898 print
'</div><div class="fichehalfright">';
1902 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
1905 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1907 $somethingshown = $formactions->showactions(
$object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1909 print
'</div></div>';
1914 if (
GETPOST(
'modelselected')) {
1915 $action =
'presend';
1919 $modelmail =
'fichinter_send';
1920 $defaulttopic =
'SendInterventionRef';
1921 $diroutput =
$conf->ficheinter->dir_output;
1922 $trackid =
'int'.$object->id;
1924 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
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)
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'.
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.