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';
67$langs->loadLangs(array(
'bills',
'companies',
'interventions',
'stocks'));
71$ref_client =
GETPOST(
'ref_client',
'alpha');
74$action =
GETPOST(
'action',
'alpha');
75$cancel =
GETPOST(
'cancel',
'alpha');
76$confirm =
GETPOST(
'confirm',
'alpha');
77$backtopage =
GETPOST(
'backtopage',
'alpha');
80$origin =
GETPOST(
'origin',
'alpha');
82$note_public =
GETPOST(
'note_public',
'restricthtml');
83$note_private =
GETPOST(
'note_private',
'restricthtml');
94$hookmanager->initHooks(array(
'interventioncard',
'globalcard'));
100$extrafields->fetch_name_optionals_label(
$object->table_element);
103if ($id > 0 || !empty($ref)) {
104 $ret =
$object->fetch($id, $ref);
106 $ret =
$object->fetch_thirdparty();
115 $socid = $user->socid;
119$permissionnote = $user->hasRight(
'ficheinter',
'creer');
120$permissiondellink = $user->hasRight(
'ficheinter',
'creer');
121$permissiontodelete = ((
$object->statut ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->hasRight(
'ficheinter',
'supprimer'));
122$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
124$usercancreate = $user->hasRight(
'ficheinter',
'creer');
131$parameters = array(
'socid' => $socid);
132$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
137if (empty($reshook)) {
138 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
140 if (empty($backtopage) || ($cancel && empty($id))) {
141 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
142 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
143 $backtopage = $backurlforlist;
145 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
151 if (!empty($backtopageforcancel)) {
152 header(
"Location: ".$backtopageforcancel);
154 } elseif (!empty($backtopage)) {
155 header(
"Location: ".$backtopage);
161 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
163 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
166 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
167 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
174 $result =
$object->createFromClone($user, $socid);
176 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
187 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
188 $result =
$object->setValid($user);
193 $outputlangs = $langs;
196 $newlang =
GETPOST(
'lang_id',
'aZ09');
199 $newlang =
$object->thirdparty->default_lang;
201 if (!empty($newlang)) {
203 $outputlangs->setDefaultLang($newlang);
208 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
213 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
214 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
218 $outputlangs = $langs;
221 $newlang =
GETPOST(
'lang_id',
'aZ09');
224 $newlang =
$object->thirdparty->default_lang;
226 if (!empty($newlang)) {
228 $outputlangs->setDefaultLang($newlang);
233 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
238 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
239 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
243 $outputlangs = $langs;
246 $newlang =
GETPOST(
'lang_id',
'aZ09');
249 $newlang =
$object->thirdparty->default_lang;
251 if (!empty($newlang)) {
253 $outputlangs->setDefaultLang($newlang);
258 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
263 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
264 $result =
$object->setDraft($user);
268 $outputlangs = $langs;
271 $newlang =
GETPOST(
'lang_id',
'aZ09');
274 $newlang =
$object->thirdparty->default_lang;
276 if (!empty($newlang)) {
278 $outputlangs->setDefaultLang($newlang);
283 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
288 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
289 $result =
$object->setClose($user);
294 $outputlangs = $langs;
297 $newlang =
GETPOST(
'lang_id',
'aZ09');
300 $newlang =
$object->thirdparty->default_lang;
302 if (!empty($newlang)) {
304 $outputlangs->setDefaultLang($newlang);
309 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
314 } elseif ($action ==
'add' && $permissiontoadd) {
315 $selectedLines =
GETPOST(
'toselect',
'array');
320 $object->user_author_id = $user->id;
323 $object->ref_client = $ref_client;
330 if (!empty($origin) && !empty($originid)) {
333 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
334 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
336 $subelement = $regs[2];
340 if ($element ==
'order') {
341 $element = $subelement =
'commande';
343 if ($element ==
'propal') {
344 $element =
'comm/propal';
345 $subelement =
'propal';
347 if ($element ==
'contract') {
348 $element = $subelement =
'contrat';
352 $object->origin_id = $originid;
357 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
363 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
377 $classname = ucfirst($subelement);
378 $srcobject =
new $classname($db);
379 '@phan-var-force Commande|Propal|Contrat $srcobject';
383 $result = $srcobject->fetch(
$object->origin_id);
385 $srcobject->fetch_thirdparty();
386 $lines = $srcobject->lines;
387 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
388 $srcobject->fetch_lines();
389 $lines = $srcobject->lines;
392 if (is_array($lines)) {
393 $num = count($lines);
395 for ($i = 0; $i < $num; $i++) {
396 if (!in_array($lines[$i]->
id, $selectedLines)) {
406 if ($lines[$i]->fk_product > 0) {
408 $prod->id = $lines[$i]->fk_product;
412 $prod->getMultiLangs();
414 $prod->fetch($lines[$i]->fk_product);
415 $outputlangs = $langs;
417 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
418 $newlang =
GETPOST(
'lang_id',
'aZ09');
420 if (empty($newlang)) {
421 $newlang = $srcobject->thirdparty->default_lang;
423 if (!empty($newlang)) {
425 $outputlangs->setDefaultLang($newlang);
427 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
429 $prod->fetch($lines[$i]->fk_product);
430 $label = $lines[$i]->product_label;
433 if ($prod->duration_value &&
$conf->global->FICHINTER_USE_SERVICE_DURATION) {
434 switch ($prod->duration_unit) {
443 $mult = 3600 * 24 * 7;
446 $mult = (int) (3600 * 24 * (365 / 12));
449 $mult = 3600 * 24 * 365;
452 $duration = (int) $prod->duration_value * $mult * $lines[$i]->qty;
455 $desc = $lines[$i]->product_ref;
463 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
466 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
475 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
476 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
495 $langs->load(
"errors");
501 $langs->load(
"errors");
508 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
516 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
518 $object->array_options = $array_options;
520 $result =
$object->create($user);
524 $langs->load(
"errors");
532 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
536 } elseif ($action ==
'update' && $permissiontoadd) {
540 $object->user_author_id = $user->id;
543 $object->ref_client = $ref_client;
545 $result =
$object->update($user);
549 } elseif ($action ==
'classin' && $permissiontoadd) {
555 } elseif ($action ==
'setcontract' && $permissiontoadd) {
561 } elseif ($action ==
'setref_client' && $permissiontoadd) {
563 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
567 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'supprimer')) {
568 $result =
$object->delete($user);
573 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
575 } elseif ($action ==
'setdescription' && $permissiontoadd) {
576 $result =
$object->set_description($user,
GETPOST(
'description'));
580 } elseif ($action ==
"addline" && $permissiontoadd) {
583 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
587 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
591 $mesg = $langs->trans(
"ErrorValueTooHigh");
597 $desc =
GETPOST(
'np_desc',
'restricthtml');
602 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
603 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
615 $outputlangs = $langs;
618 $newlang =
GETPOST(
'lang_id',
'aZ09');
621 $newlang =
$object->thirdparty->default_lang;
623 if (!empty($newlang)) {
625 $outputlangs->setDefaultLang($newlang);
634 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
641 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
645 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
650 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
654 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
659 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
663 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
668 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
671 if ($objectline->fetch($lineid) <= 0) {
676 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
682 $desc =
GETPOST(
'np_desc',
'restricthtml');
686 $objectline->date = $date_inter;
687 $objectline->desc = $desc;
688 $objectline->duration = $duration;
691 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
692 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
693 if (is_array($array_options)) {
694 $objectline->array_options = array_merge($objectline->array_options, $array_options);
697 $result = $objectline->update($user);
704 $outputlangs = $langs;
707 $newlang =
GETPOST(
'lang_id',
'aZ09');
710 $newlang =
$object->thirdparty->default_lang;
712 if (!empty($newlang)) {
714 $outputlangs->setDefaultLang($newlang);
720 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
722 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
725 if ($objectline->fetch($lineid) <= 0) {
729 $result = $objectline->deleteLine($user);
731 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
737 $outputlangs = $langs;
740 $newlang =
GETPOST(
'lang_id',
'aZ09');
743 $newlang =
$object->thirdparty->default_lang;
745 if (!empty($newlang)) {
747 $outputlangs->setDefaultLang($newlang);
752 } elseif ($action ==
'up' && $permissiontoadd) {
757 $outputlangs = $langs;
760 $newlang =
GETPOST(
'lang_id',
'aZ09');
763 $newlang =
$object->thirdparty->default_lang;
765 if (!empty($newlang)) {
767 $outputlangs->setDefaultLang($newlang);
773 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
775 } elseif ($action ==
'down' && $permissiontoadd) {
779 $outputlangs = $langs;
782 $newlang =
GETPOST(
'lang_id',
'aZ09');
785 $newlang =
$object->thirdparty->default_lang;
787 if (!empty($newlang)) {
789 $outputlangs->setDefaultLang($newlang);
795 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
800 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
803 $triggersendname =
'FICHINTER_SENTBYMAIL';
804 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
805 $trackid =
'int'.$object->id;
806 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
809 $upload_dir =
$conf->ficheinter->dir_output;
810 $permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
811 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
813 if ($action ==
'update_extras' && $permissiontoadd) {
815 $attribute_name =
GETPOST(
'attribute',
'restricthtml');
818 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
825 $result =
$object->updateExtraField($attribute_name,
'INTERVENTION_MODIFY');
833 $action =
'edit_extras';
838 if ($action ==
'addcontact' && $permissiontoadd) {
839 if ($result > 0 && $id > 0) {
842 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
846 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
849 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
850 $langs->load(
"errors");
851 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
856 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
859 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
864 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
878$form =
new Form($db);
882if (isModEnabled(
'contract')) {
885if (isModEnabled(
'project')) {
890$help_url =
'EN:Module_Interventions';
892llxHeader(
'', $langs->trans(
"Intervention"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
894if ($action ==
'create') {
899 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
908 $res = $soc->fetch($socid);
914 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
915 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
917 $subelement = $regs[2];
920 if ($element ==
'project') {
924 if ($element ==
'order' || $element ==
'commande') {
925 $element = $subelement =
'commande';
927 if ($element ==
'propal') {
928 $element =
'comm/propal';
929 $subelement =
'propal';
931 if ($element ==
'contract') {
932 $element = $subelement =
'contrat';
937 $classname = ucfirst($subelement);
938 $objectsrc =
new $classname($db);
939 '@phan-var-force Commande|Propal|Contrat $objectsrc';
940 $objectsrc->fetch(
GETPOST(
'originid'));
941 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
942 $objectsrc->fetch_lines();
943 $lines = $objectsrc->lines;
945 $objectsrc->fetch_thirdparty();
947 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
949 $soc = $objectsrc->thirdparty;
951 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
952 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
955 $objectsrc->fetch_optionals();
956 $object->array_options = $objectsrc->array_options;
959 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
965 if (!
$conf->global->FICHEINTER_ADDON) {
966 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
982 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
983 print
'<input type="hidden" name="token" value="'.newToken().
'">';
984 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
985 print
'<input type="hidden" name="action" value="add">';
986 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
990 print
'<table class="border centpercent">';
992 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
995 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
998 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
999 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1003 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1005 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1009 if (isModEnabled(
'project')) {
1012 $langs->load(
"project");
1014 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1021 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
1022 if ($numprojet == 0) {
1023 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>';
1029 if (isModEnabled(
'contract') && is_object($formcontract)) {
1030 $langs->load(
"contracts");
1031 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1032 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1033 if ($numcontrat == 0) {
1034 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>';
1041 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1044 print $form->selectarray(
'model', $liste,
$conf->global->FICHEINTER_ADDON_PDF);
1049 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1051 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1052 print $doleditor->Create(1);
1057 if (empty($user->socid)) {
1059 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1061 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1062 print $doleditor->Create(1);
1068 $parameters = array();
1069 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1070 print $hookmanager->resPrint;
1071 if (empty($reshook)) {
1072 print
$object->showOptionals($extrafields,
'create');
1076 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1077 $newclassname = $classname;
1078 if ($newclassname ==
'Propal') {
1079 $langs->load(
'propal');
1080 $newclassname =
'CommercialProposal';
1082 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1111 if (is_object($objectsrc)) {
1112 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1113 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1114 } elseif ($origin ==
'project' && !empty($projectid)) {
1115 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1120 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1123 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1124 $title = $langs->trans(
'Services');
1127 print
'<div class="div-table-responsive-no-min">';
1128 print
'<table class="noborder centpercent">';
1130 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1138 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1139 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1140 print
'<input type="hidden" name="action" value="create">';
1141 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1145 if (is_object($objectsrc)) {
1146 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1147 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1148 } elseif ($origin ==
'project' && !empty($projectid)) {
1149 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1151 print
'<table class="border centpercent">';
1152 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1153 print $form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300');
1154 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>';
1160 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1164} elseif ($id > 0 || !empty($ref)) {
1181 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1186 if ($action ==
'delete') {
1187 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1191 if ($action ==
'validate') {
1193 $ref = substr(
$object->ref, 1, 4);
1194 if ($ref ==
'PROV') {
1195 $numref =
$object->getNextNumRef($soc);
1196 if (empty($numref)) {
1203 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1204 if (isModEnabled(
'notification')) {
1205 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1206 $notify =
new Notify($db);
1208 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid,
$object);
1211 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1215 if ($action ==
'sign') {
1216 $text = $langs->trans(
'ConfirmSignIntervention');
1217 if (isModEnabled(
'notification')) {
1218 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1219 $notify =
new Notify($db);
1221 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1226 'name' =>
'signed_status',
1227 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1228 'values' =>
$object->getSignedStatusLocalisedArray()
1230 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1234 if ($action ==
'unsign') {
1235 $text = $langs->trans(
'ConfirmUnsignIntervention');
1236 if (isModEnabled(
'notification')) {
1237 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1238 $notify =
new Notify($db);
1240 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1242 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1246 if ($action ==
'classifydone') {
1247 $text = $langs->trans(
'ConfirmCloseIntervention');
1248 if (isModEnabled(
'notification')) {
1249 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1250 $notify =
new Notify($db);
1252 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid,
$object);
1254 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1258 if ($action ==
'modify') {
1259 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1263 if ($action ==
'reopen') {
1264 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1268 if ($action ==
'ask_deleteline') {
1269 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1273 if ($action ==
'clone') {
1275 $formquestion = array(
1281 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')));
1283 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1286 if (!$formconfirm) {
1287 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1288 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1289 if (empty($reshook)) {
1290 $formconfirm .= $hookmanager->resPrint;
1291 } elseif ($reshook > 0) {
1292 $formconfirm = $hookmanager->resPrint;
1301 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1304 $morehtmlref =
'<div class="refidno">';
1306 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'', 0, 1);
1307 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'',
null,
null,
'', 1);
1309 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1311 if (isModEnabled(
'project')) {
1312 $langs->load(
"projects");
1313 $morehtmlref .=
'<br>';
1314 if ($usercancreate) {
1315 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1316 if ($action !=
'classify') {
1317 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1319 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1321 if (!empty(
$object->fk_project)) {
1323 $proj->fetch(
$object->fk_project);
1324 $morehtmlref .= $proj->getNomUrl(1);
1326 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1331 $morehtmlref .=
'</div>';
1333 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1336 print
'<div class="fichecenter">';
1337 print
'<div class="fichehalfleft">';
1338 print
'<div class="underbanner clearboth"></div>';
1340 print
'<table class="border tableforfield centpercent">';
1344 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1351 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1358 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1366 print
'<tr><td class="titlefield">';
1367 print $form->editfieldkey(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea');
1369 print $form->editfieldval(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea:8');
1374 if (isModEnabled(
'contract')) {
1375 $langs->load(
'contracts');
1379 print
'<table class="nobordernopadding centpercent"><tr><td>';
1380 print $langs->trans(
'Contract');
1382 if ($action !=
'editcontract') {
1383 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1384 print
img_edit($langs->trans(
'SetContract'), 1);
1387 print
'</tr></table>';
1389 if ($action ==
'editcontract') {
1391 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1394 $contratstatic =
new Contrat($db);
1395 $contratstatic->fetch(
$object->fk_contrat);
1397 print $contratstatic->getNomUrl(0, 0, 1);
1408 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1413 print
'<div class="fichehalfright">';
1414 print
'<div class="underbanner clearboth"></div>';
1416 print
'<table class="border tableforfield centpercent">';
1420 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1430 print
'<div class="clearboth"></div><br>';
1434 $blocname =
'contacts';
1435 $title = $langs->trans(
'ContactsAddresses');
1436 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1440 $blocname =
'notes';
1441 $title = $langs->trans(
'Notes');
1442 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1447 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1448 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1449 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1450 if ($action ==
'editline') {
1451 print
'<input type="hidden" name="action" value="updateline">';
1452 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1454 print
'<input type="hidden" name="action" value="addline">';
1456 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1459 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1460 $sql .=
' ft.date as date_intervention';
1461 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1462 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1464 $sql .=
' AND ft.duree <> 0';
1466 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1468 $resql = $db->query($sql);
1470 $num = $db->num_rows($resql);
1475 print
'<table class="noborder centpercent">';
1476 print
'<tr class="liste_titre">';
1480 print
'<td width="5" class="center linecolnum"></td>';
1483 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1484 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1485 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1486 print
'<td class="liste_titre"> </td>';
1487 print
'<td class="liste_titre"> </td>';
1491 $objp = $db->fetch_object($resql);
1494 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1495 print
'<tr class="oddeven">';
1499 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1503 print
'<a name="'.$objp->rowid.
'"></a>';
1507 $objectline->fetch($objp->rowid);
1508 $objectline->fetch_optionals();
1510 $extrafields->fetch_name_optionals_label($objectline->table_element);
1512 if (!empty($extrafields)) {
1513 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1514 if (!empty($temps)) {
1515 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1524 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>';
1532 if (
$object->statut == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1533 print
'<td class="center">';
1534 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1537 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1540 print
'<td class="center">';
1543 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1547 if ($i < $num - 1) {
1548 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1555 print
'<td colspan="2"> </td>';
1562 if (
$object->statut == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1563 print
'<tr class="oddeven nohover">';
1567 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1571 print
'<a name="'.$objp->rowid.
'"></a>';
1574 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1575 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1576 $doleditor->Create();
1579 $objectline->fetch($objp->rowid);
1580 $objectline->fetch_optionals();
1582 $extrafields->fetch_name_optionals_label($objectline->table_element);
1584 if (!empty($extrafields)) {
1585 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1586 if (!empty($temps)) {
1587 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1596 print
'<td class="center nowrap">';
1598 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1600 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1605 print
'<td class="right">';
1607 $selectmode =
'select';
1609 $selectmode =
'text';
1611 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1615 print
'<td class="center" colspan="5" valign="center">';
1616 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1617 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1630 print
'<table class="noborder centpercent">';
1631 print
'<tr class="liste_titre">';
1635 print
'<td width="5" class="center linecolnum"></td>';
1639 print
'<a name="add"></a>';
1640 print $langs->trans(
'Description').
'</td>';
1641 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1642 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1643 print
'<td colspan="3"> </td>';
1647 print
'<tr class="oddeven nohover">'.
"\n";
1651 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1657 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1658 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1659 $doleditor->Create();
1663 $extrafields->fetch_name_optionals_label($objectline->table_element);
1665 if (is_object($objectline)) {
1666 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1668 if (!empty($temps)) {
1669 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1678 print
'<td class="center nowrap">';
1683 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1685 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1691 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1693 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1698 print
'<td class="right">';
1700 $selectmode =
'select';
1702 $selectmode =
'text';
1708 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1723 print
'</form>'.
"\n";
1735 print
'<div class="tabsAction">';
1737 $parameters = array();
1738 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1740 if (empty($reshook)) {
1742 if ($user->socid == 0) {
1743 if ($action !=
'editdescription' && ($action !=
'presend')) {
1746 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1747 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1749 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1755 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
1757 print $langs->trans(
"Modify");
1759 print $langs->trans(
"SetToDraft");
1766 if ($user->hasRight(
'ficheinter',
'creer')) {
1767 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>';
1769 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1774 if (empty($user->socid)) {
1776 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1777 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>';
1779 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1786 print
'<div class="inline-block divButAction">';
1787 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>';
1791 $arrayofcreatebutton = array();
1794 $langs->load(
"propal");
1796 $arrayofcreatebutton[] = array(
1797 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1798 'label' => $langs->trans(
'AddProp'),
1800 'perm' => $user->hasRight(
'propal',
'creer'),
1808 $langs->load(
"bills");
1810 $arrayofcreatebutton[] = array(
1811 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1812 'label' => $langs->trans(
'AddBill'),
1814 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
1821 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>';
1823 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>';
1828 if (count($arrayofcreatebutton)) {
1829 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
1834 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
1835 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>';
1837 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>';
1843 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>';
1847 if ($user->hasRight(
'ficheinter',
'creer')) {
1848 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>';
1852 print
'<div class="inline-block divButAction">';
1853 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
1861 if ($action !=
'presend') {
1862 print
'<div class="fichecenter"><div class="fichehalfleft">';
1868 $filedir =
$conf->ficheinter->dir_output.
"/".$filename;
1869 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1870 $genallowed = $user->hasRight(
'ficheinter',
'lire');
1871 $delallowed = $user->hasRight(
'ficheinter',
'creer');
1872 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1875 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(
'fichinter'), 1);
1876 $linktoelem = $tmparray[
'linktoelem'];
1877 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
1878 print $htmltoenteralink;
1880 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
1884 print
'<br><!-- Link to download main doc -->'.
"\n";
1890 print
'<br><!-- Link to sign -->';
1891 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1893 print showOnlineSignatureUrl(
'fichinter',
$object->ref,
$object).
'<br>';
1896 print
'</div><div class="fichehalfright">';
1900 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
1903 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1905 $somethingshown = $formactions->showactions(
$object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1907 print
'</div></div>';
1912 if (
GETPOST(
'modelselected')) {
1913 $action =
'presend';
1917 $modelmail =
'fichinter_send';
1918 $defaulttopic =
'SendInterventionRef';
1919 $diroutput =
$conf->ficheinter->dir_output;
1920 $trackid =
'int'.$object->id;
1922 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'.
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_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.
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.