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);
108 $ret =
$object->fetch_thirdparty();
117 $socid = $user->socid;
121$permissionnote = $user->hasRight(
'ficheinter',
'creer');
122$permissiondellink = $user->hasRight(
'ficheinter',
'creer');
123$permissiontodelete = ((
$object->status ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->hasRight(
'ficheinter',
'supprimer'));
124$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
125$permissiontoeditextra = $permissiontoadd;
126if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
128 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
136$parameters = array(
'socid' => $socid);
137$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
142if (empty($reshook)) {
143 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
145 if (empty($backtopage) || ($cancel && empty($id))) {
146 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
147 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
148 $backtopage = $backurlforlist;
150 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
156 if (!empty($backtopageforcancel)) {
157 header(
"Location: ".$backtopageforcancel);
159 } elseif (!empty($backtopage)) {
160 header(
"Location: ".$backtopage);
166 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
168 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
171 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
172 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
178 $clone_notes =
false;
179 if (GETPOSTISSET(
'clone_notes') &&
GETPOST(
'clone_notes') ===
'on') {
182 $clone_contacts =
false;
183 if (GETPOSTISSET(
'clone_contacts') &&
GETPOST(
'clone_contacts') ===
'on') {
184 $clone_contacts =
true;
187 $result =
$object->createFromClone($user, $socid, $clone_contacts, $clone_notes);
189 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
200 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
201 $result =
$object->setValid($user);
206 $outputlangs = $langs;
209 $newlang =
GETPOST(
'lang_id',
'aZ09');
212 $newlang =
$object->thirdparty->default_lang;
214 if (!empty($newlang)) {
216 $outputlangs->setDefaultLang($newlang);
221 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
226 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
227 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
231 $outputlangs = $langs;
234 $newlang =
GETPOST(
'lang_id',
'aZ09');
237 $newlang =
$object->thirdparty->default_lang;
239 if (!empty($newlang)) {
241 $outputlangs->setDefaultLang($newlang);
246 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
251 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
252 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
256 $outputlangs = $langs;
259 $newlang =
GETPOST(
'lang_id',
'aZ09');
262 $newlang =
$object->thirdparty->default_lang;
264 if (!empty($newlang)) {
266 $outputlangs->setDefaultLang($newlang);
271 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
276 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
277 $result =
$object->setDraft($user);
281 $outputlangs = $langs;
284 $newlang =
GETPOST(
'lang_id',
'aZ09');
287 $newlang =
$object->thirdparty->default_lang;
289 if (!empty($newlang)) {
291 $outputlangs->setDefaultLang($newlang);
296 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
301 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
302 $result =
$object->setClose($user);
307 $outputlangs = $langs;
310 $newlang =
GETPOST(
'lang_id',
'aZ09');
313 $newlang =
$object->thirdparty->default_lang;
315 if (!empty($newlang)) {
317 $outputlangs->setDefaultLang($newlang);
322 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
327 } elseif ($action ==
'add' && $permissiontoadd) {
328 $selectedLines =
GETPOST(
'toselect',
'array');
333 $object->user_author_id = $user->id;
336 $object->ref_client = $ref_client;
343 if (!empty($origin) && !empty($originid)) {
346 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
347 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
349 $subelement = $regs[2];
353 if ($element ==
'order') {
354 $element = $subelement =
'commande';
356 if ($element ==
'propal') {
357 $element =
'comm/propal';
358 $subelement =
'propal';
360 if ($element ==
'contract') {
361 $element = $subelement =
'contrat';
365 $object->origin_id = $originid;
370 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
376 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
390 $classname = ucfirst($subelement);
391 $srcobject =
new $classname($db);
392 '@phan-var-force Commande|Propal|Contrat $srcobject';
396 $result = $srcobject->fetch(
$object->origin_id);
398 $srcobject->fetch_thirdparty();
399 $lines = $srcobject->lines;
400 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
401 $srcobject->fetch_lines();
402 $lines = $srcobject->lines;
405 if (is_array($lines)) {
406 $num = count($lines);
408 for ($i = 0; $i < $num; $i++) {
409 if (!in_array($lines[$i]->
id, $selectedLines)) {
419 if ($lines[$i]->fk_product > 0) {
421 $prod->id = $lines[$i]->fk_product;
425 $prod->getMultiLangs();
427 $prod->fetch($lines[$i]->fk_product);
428 $outputlangs = $langs;
430 if (
GETPOST(
'lang_id',
'aZ09')) {
431 $newlang =
GETPOST(
'lang_id',
'aZ09');
433 if (empty($newlang)) {
434 $newlang = $srcobject->thirdparty->default_lang;
436 if (!empty($newlang)) {
438 $outputlangs->setDefaultLang($newlang);
440 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
442 $prod->fetch($lines[$i]->fk_product);
443 $label = $lines[$i]->product_label;
446 if ($prod->duration_value &&
$conf->global->FICHINTER_USE_SERVICE_DURATION) {
447 switch ($prod->duration_unit) {
456 $mult = 3600 * 24 * 7;
459 $mult = (int) (3600 * 24 * (365 / 12));
462 $mult = 3600 * 24 * 365;
465 $duration = (int) $prod->duration_value * $mult * $lines[$i]->qty;
468 $desc = $lines[$i]->product_ref;
476 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
479 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
488 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
489 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
508 $langs->load(
"errors");
514 $langs->load(
"errors");
521 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
529 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
531 $object->array_options = $array_options;
533 $result =
$object->create($user);
537 $langs->load(
"errors");
545 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
549 } elseif ($action ==
'update' && $permissiontoadd) {
553 $object->user_author_id = $user->id;
556 $object->ref_client = $ref_client;
558 $result =
$object->update($user);
562 } elseif ($action ==
'classin' && $permissiontoadd) {
568 } elseif ($action ==
'setcontract' && $permissiontoadd) {
574 } elseif ($action ==
'setref_client' && $permissiontoadd) {
576 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
580 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'supprimer')) {
581 $result =
$object->delete($user);
586 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
588 } elseif ($action ==
'setdescription' && $permissiontoadd) {
589 $result =
$object->set_description($user,
GETPOST(
'description'));
593 } elseif ($action ==
"addline" && $permissiontoadd) {
596 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
600 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
604 $mesg = $langs->trans(
"ErrorValueTooHigh");
610 $desc =
GETPOST(
'np_desc',
'restricthtml');
615 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
616 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
628 $outputlangs = $langs;
631 $newlang =
GETPOST(
'lang_id',
'aZ09');
634 $newlang =
$object->thirdparty->default_lang;
636 if (!empty($newlang)) {
638 $outputlangs->setDefaultLang($newlang);
647 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
654 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
658 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
663 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
667 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
672 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
676 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
681 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
684 if ($objectline->fetch($lineid) <= 0) {
689 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
695 $desc =
GETPOST(
'np_desc',
'restricthtml');
699 $objectline->date = $date_inter;
700 $objectline->desc = $desc;
701 $objectline->duration = $duration;
704 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
705 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
706 if (is_array($array_options)) {
707 $objectline->array_options = array_merge($objectline->array_options, $array_options);
710 $result = $objectline->update($user);
719 $outputlangs = $langs;
722 $newlang =
GETPOST(
'lang_id',
'aZ09');
725 $newlang =
$object->thirdparty->default_lang;
727 if (!empty($newlang)) {
729 $outputlangs->setDefaultLang($newlang);
735 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
737 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
740 if ($objectline->fetch($lineid) <= 0) {
744 $result = $objectline->deleteLine($user);
746 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
752 $outputlangs = $langs;
755 $newlang =
GETPOST(
'lang_id',
'aZ09');
758 $newlang =
$object->thirdparty->default_lang;
760 if (!empty($newlang)) {
762 $outputlangs->setDefaultLang($newlang);
767 } elseif ($action ==
'up' && $permissiontoadd) {
772 $outputlangs = $langs;
775 $newlang =
GETPOST(
'lang_id',
'aZ09');
778 $newlang =
$object->thirdparty->default_lang;
780 if (!empty($newlang)) {
782 $outputlangs->setDefaultLang($newlang);
788 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
790 } elseif ($action ==
'down' && $permissiontoadd) {
794 $outputlangs = $langs;
797 $newlang =
GETPOST(
'lang_id',
'aZ09');
800 $newlang =
$object->thirdparty->default_lang;
802 if (!empty($newlang)) {
804 $outputlangs->setDefaultLang($newlang);
810 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
815 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
818 $triggersendname =
'FICHINTER_SENTBYMAIL';
819 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
820 $trackid =
'int'.$object->id;
821 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
825 $permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
826 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
828 if ($action ==
'update_extras' && $permissiontoeditextra) {
831 $attribute_name =
GETPOST(
'attribute',
'aZ09');
834 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
841 $result =
$object->updateExtraField($attribute_name,
'FICHINTER_MODIFY');
849 $action =
'edit_extras';
854 if ($action ==
'addcontact' && $permissiontoadd) {
855 if ($result > 0 && $id > 0) {
858 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
862 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
865 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
866 $langs->load(
"errors");
867 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
872 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
875 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
880 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
894$form =
new Form($db);
898if (isModEnabled(
'contract')) {
901if (isModEnabled(
'project')) {
906$help_url =
'EN:Module_Interventions';
908llxHeader(
'', $langs->trans(
"Intervention"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
910if ($action ==
'create') {
915 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
924 $res = $soc->fetch($socid);
930 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
931 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
933 $subelement = $regs[2];
936 if ($element ==
'project') {
940 if ($element ==
'order' || $element ==
'commande') {
941 $element = $subelement =
'commande';
943 if ($element ==
'propal') {
944 $element =
'comm/propal';
945 $subelement =
'propal';
947 if ($element ==
'contract') {
948 $element = $subelement =
'contrat';
953 $classname = ucfirst($subelement);
954 $objectsrc =
new $classname($db);
955 '@phan-var-force Commande|Propal|Contrat $objectsrc';
957 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
958 $objectsrc->fetch_lines();
959 $lines = $objectsrc->lines;
961 $objectsrc->fetch_thirdparty();
963 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
965 $soc = $objectsrc->thirdparty;
967 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
968 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
971 $objectsrc->fetch_optionals();
972 $object->array_options = $objectsrc->array_options;
975 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
981 if (!
$conf->global->FICHEINTER_ADDON) {
982 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
998 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
999 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1000 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
1001 print
'<input type="hidden" name="action" value="add">';
1002 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1006 print
'<table class="border centpercent">';
1008 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
1011 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
1014 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
1015 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1019 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1021 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1025 if (isModEnabled(
'project')) {
1028 $langs->load(
"project");
1030 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1037 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
1038 if ($numprojet == 0) {
1039 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>';
1045 if (isModEnabled(
'contract') && is_object($formcontract)) {
1046 $langs->load(
"contracts");
1047 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1048 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1049 if ($numcontrat == 0) {
1050 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>';
1057 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1060 print $form->selectarray(
'model', $liste,
$conf->global->FICHEINTER_ADDON_PDF);
1065 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1067 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1068 print $doleditor->Create(1);
1073 if (empty($user->socid)) {
1075 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1077 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1078 print $doleditor->Create(1);
1084 $parameters = array();
1085 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1086 print $hookmanager->resPrint;
1087 if (empty($reshook)) {
1088 print
$object->showOptionals($extrafields,
'create');
1092 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1093 $newclassname = $classname;
1094 if ($newclassname ==
'Propal') {
1095 $langs->load(
'propal');
1096 $newclassname =
'CommercialProposal';
1098 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1127 if (is_object($objectsrc)) {
1128 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1129 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1130 } elseif ($origin ==
'project' && !empty($projectid)) {
1131 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1136 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1139 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1140 $title = $langs->trans(
'Services');
1143 print
'<div class="div-table-responsive-no-min">';
1144 print
'<table class="noborder centpercent">';
1146 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1154 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1155 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1156 print
'<input type="hidden" name="action" value="create">';
1157 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1161 if (is_object($objectsrc)) {
1162 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1163 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1164 } elseif ($origin ==
'project' && !empty($projectid)) {
1165 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1167 print
'<table class="border centpercent">';
1168 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1169 $filter =
'(s.status:=:1)';
1171 print $form->select_company(
'',
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300');
1172 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>';
1178 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1182} elseif ($id > 0 || !empty($ref)) {
1199 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1204 if ($action ==
'delete') {
1205 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1209 if ($action ==
'validate') {
1211 $ref = substr(
$object->ref, 1, 4);
1212 if ($ref ==
'PROV') {
1213 $numref =
$object->getNextNumRef($soc);
1214 if (empty($numref)) {
1221 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1222 if (isModEnabled(
'notification')) {
1223 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1224 $notify =
new Notify($db);
1226 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid,
$object);
1229 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1233 if ($action ==
'sign') {
1234 $text = $langs->trans(
'ConfirmSignIntervention');
1235 if (isModEnabled(
'notification')) {
1236 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1237 $notify =
new Notify($db);
1239 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1244 'name' =>
'signed_status',
1245 'select_show_empty' => 0,
1246 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1247 'values' =>
$object->getSignedStatusLocalisedArray()
1249 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1253 if ($action ==
'unsign') {
1254 $text = $langs->trans(
'ConfirmUnsignIntervention');
1255 if (isModEnabled(
'notification')) {
1256 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1257 $notify =
new Notify($db);
1259 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid,
$object);
1261 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1265 if ($action ==
'classifydone') {
1266 $text = $langs->trans(
'ConfirmCloseIntervention');
1267 if (isModEnabled(
'notification')) {
1268 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1269 $notify =
new Notify($db);
1271 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid,
$object);
1273 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1277 if ($action ==
'modify') {
1278 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1282 if ($action ==
'reopen') {
1283 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1287 if ($action ==
'ask_deleteline') {
1288 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1292 if ($action ==
'clone') {
1294 $formquestion = array(
1300 'label' => $langs->trans(
"SelectThirdParty"),
1301 'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')
1304 'type' =>
'checkbox',
1305 'name' =>
'clone_contacts',
1306 'label' => $langs->trans(
"CloneContacts"),
1310 'type' =>
'checkbox',
1311 'name' =>
'clone_notes',
1312 'label' => $langs->trans(
"CloneNotes"),
1318 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1321 if (!$formconfirm) {
1322 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1323 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1324 if (empty($reshook)) {
1325 $formconfirm .= $hookmanager->resPrint;
1326 } elseif ($reshook > 0) {
1327 $formconfirm = $hookmanager->resPrint;
1336 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1339 $morehtmlref =
'<div class="refidno">';
1341 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'', 0, 1);
1342 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client,
$object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'',
null,
null,
'', 1);
1344 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1346 if (isModEnabled(
'project')) {
1347 $langs->load(
"projects");
1348 $morehtmlref .=
'<br>';
1349 if ($permissiontoadd) {
1350 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1351 if ($action !=
'classify') {
1352 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1354 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1356 if (!empty(
$object->fk_project)) {
1358 $proj->fetch(
$object->fk_project);
1359 $morehtmlref .= $proj->getNomUrl(1);
1361 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1366 $morehtmlref .=
'</div>';
1368 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1371 print
'<div class="fichecenter">';
1372 print
'<div class="fichehalfleft">';
1373 print
'<div class="underbanner clearboth"></div>';
1375 print
'<table class="border tableforfield centpercent">';
1379 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1386 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1393 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1401 print
'<tr><td class="titlefield">';
1402 print $form->editfieldkey(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea');
1404 print $form->editfieldval(
"Description",
'description',
$object->description,
$object, $user->hasRight(
'ficheinter',
'creer'),
'textarea:8');
1409 if (isModEnabled(
'contract')) {
1410 $langs->load(
'contracts');
1414 print
'<table class="nobordernopadding centpercent"><tr><td>';
1415 print $langs->trans(
'Contract');
1417 if ($action !=
'editcontract') {
1418 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1419 print
img_edit($langs->trans(
'SetContract'), 1);
1422 print
'</tr></table>';
1424 if ($action ==
'editcontract') {
1426 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1429 $contratstatic =
new Contrat($db);
1430 $contratstatic->fetch(
$object->fk_contrat);
1432 print $contratstatic->getNomUrl(0, 0, 1);
1443 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1448 print
'<div class="fichehalfright">';
1449 print
'<div class="underbanner clearboth"></div>';
1451 print
'<table class="border tableforfield centpercent">';
1455 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1465 print
'<div class="clearboth"></div><br>';
1469 $blocname =
'contacts';
1470 $title = $langs->trans(
'ContactsAddresses');
1471 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1475 $blocname =
'notes';
1476 $title = $langs->trans(
'Notes');
1477 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1482 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1483 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1484 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1485 if ($action ==
'editline') {
1486 print
'<input type="hidden" name="action" value="updateline">';
1487 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1489 print
'<input type="hidden" name="action" value="addline">';
1491 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1494 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1495 $sql .=
' ft.date as date_intervention';
1496 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1497 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1499 $sql .=
' AND ft.duree <> 0';
1501 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1503 $resql = $db->query($sql);
1505 $num = $db->num_rows($resql);
1510 print
'<table class="noborder centpercent">';
1511 print
'<tr class="liste_titre">';
1515 print
'<td width="5" class="center linecolnum"></td>';
1518 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1519 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1520 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1521 print
'<td class="liste_titre"> </td>';
1522 print
'<td class="liste_titre"> </td>';
1526 $objp = $db->fetch_object($resql);
1529 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1530 print
'<tr class="oddeven">';
1534 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1538 print
'<a name="'.$objp->rowid.
'"></a>';
1542 $objectline->fetch($objp->rowid);
1543 $objectline->fetch_optionals();
1545 $extrafields->fetch_name_optionals_label($objectline->table_element);
1547 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'',
'1',
'line');
1548 if (!empty($temps)) {
1549 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objp->rowid.
'" name="extrafield_lines_area_'.$objp->rowid.
'">';
1557 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>';
1565 if (
$object->status == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1566 print
'<td class="center">';
1567 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1570 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1573 print
'<td class="center">';
1576 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1580 if ($i < $num - 1) {
1581 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1588 print
'<td colspan="2"> </td>';
1595 if (
$object->status == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1596 print
'<tr class="oddeven nohover">';
1600 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1604 print
'<a name="'.$objp->rowid.
'"></a>';
1607 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1608 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1609 $doleditor->Create();
1612 $objectline->fetch($objp->rowid);
1613 $objectline->fetch_optionals();
1615 $extrafields->fetch_name_optionals_label($objectline->table_element);
1617 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'',
'1',
'line');
1618 if (!empty($temps)) {
1619 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1627 print
'<td class="center nowrap">';
1629 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1631 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1636 print
'<td class="right">';
1638 $selectmode =
'select';
1640 $selectmode =
'text';
1642 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1646 print
'<td class="center" colspan="5" valign="center">';
1647 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1648 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1661 print
'<table class="noborder centpercent">';
1662 print
'<tr class="liste_titre">';
1666 print
'<td width="5" class="center linecolnum"></td>';
1670 print
'<a name="add"></a>';
1671 print $langs->trans(
'Description').
'</td>';
1672 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1673 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1674 print
'<td colspan="3"> </td>';
1678 print
'<tr class="oddeven nohover">'.
"\n";
1682 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1688 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1689 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1690 $doleditor->Create();
1694 $extrafields->fetch_name_optionals_label($objectline->table_element);
1696 if (is_object($objectline)) {
1697 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'',
'1',
'line');
1699 if (!empty($temps)) {
1700 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1709 print
'<td class="center nowrap">';
1714 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1716 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1722 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1724 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1729 print
'<td class="right">';
1731 $selectmode =
'select';
1733 $selectmode =
'text';
1739 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1754 print
'</form>'.
"\n";
1766 print
'<div class="tabsAction">';
1768 $parameters = array();
1769 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1771 if (empty($reshook)) {
1773 if ($user->socid == 0) {
1774 if ($action !=
'editdescription' && ($action !=
'presend')) {
1777 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1778 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1780 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1786 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
1788 print $langs->trans(
"Modify");
1790 print $langs->trans(
"SetToDraft");
1797 if ($user->hasRight(
'ficheinter',
'creer')) {
1798 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>';
1800 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1805 if (empty($user->socid)) {
1807 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1808 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>';
1810 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1817 print
'<div class="inline-block divButAction">';
1818 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>';
1822 $arrayofcreatebutton = array();
1825 $langs->load(
"propal");
1827 $arrayofcreatebutton[] = array(
1828 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1829 'label' => $langs->trans(
'AddProp'),
1831 'perm' => $user->hasRight(
'propal',
'creer'),
1839 $langs->load(
"bills");
1841 $arrayofcreatebutton[] = array(
1842 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1843 'label' => $langs->trans(
'AddBill'),
1845 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
1852 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>';
1854 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>';
1859 if (count($arrayofcreatebutton)) {
1860 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
1865 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
1866 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>';
1868 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>';
1874 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>';
1878 if ($user->hasRight(
'ficheinter',
'creer')) {
1879 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>';
1883 print
'<div class="inline-block divButAction">';
1884 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
1893 if (
GETPOST(
'modelselected')) {
1894 $action =
'presend';
1897 if ($action !=
'presend') {
1898 print
'<div class="fichecenter"><div class="fichehalfleft">';
1905 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1906 $genallowed = $user->hasRight(
'ficheinter',
'lire');
1907 $delallowed = $user->hasRight(
'ficheinter',
'creer');
1908 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang,
'',
$object);
1911 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(
'fichinter'), 1);
1912 $linktoelem = $tmparray[
'linktoelem'];
1913 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
1914 print $htmltoenteralink;
1916 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
1920 print
'<br><!-- Link to download main doc -->'.
"\n";
1926 print
'<br><!-- Link to sign -->';
1927 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1929 print showOnlineSignatureUrl(
'fichinter',
$object->ref,
$object).
'<br>';
1932 print
'</div><div class="fichehalfright">';
1936 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
1939 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1941 $somethingshown = $formactions->showactions(
$object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1943 print
'</div></div>';
1947 $modelmail =
'fichinter_send';
1948 $defaulttopic =
'SendInterventionRef';
1949 $diroutput =
$conf->ficheinter->multidir_output[
$object->entity];
1950 $trackid =
'int'.$object->id;
1952 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
const STATUS_BILLED
Billed.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
const STATUS_CLOSED
Closed.
Class to manage intervention lines.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage the table of subscription to notifications.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
convertDurationtoHour($duration_value, $duration_unit)
Convert duration to hour.
convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0)
Convert hours and minutes into seconds.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
fichinter_prepare_head($object)
Prepare array with list of tabs.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!function_exists( 'utf8_encode')) if(!function_exists('utf8_decode')) if(!function_exists( 'str_starts_with')) if(!function_exists('str_ends_with')) if(!function_exists( 'str_contains')) getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
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.