39require
'../main.inc.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
54 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
58 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcontract.class.php";
59 require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
62 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_" .
getDolGlobalString(
'FICHEINTER_ADDON').
'.php';
65 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
67require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
70$langs->loadLangs(array(
'bills',
'companies',
'interventions',
'stocks'));
74$ref_client =
GETPOST(
'ref_client',
'alpha');
77$action =
GETPOST(
'action',
'alpha');
78$cancel =
GETPOST(
'cancel',
'alpha');
79$confirm =
GETPOST(
'confirm',
'alpha');
80$backtopage =
GETPOST(
'backtopage',
'alpha');
83$origin =
GETPOST(
'origin',
'alpha');
85$note_public =
GETPOST(
'note_public',
'restricthtml');
86$note_private =
GETPOST(
'note_private',
'restricthtml');
97$hookmanager->initHooks(array(
'fichintercard',
'interventioncard',
'globalcard'));
103$extrafields->fetch_name_optionals_label(
$object->table_element);
106if ($id > 0 || !empty($ref)) {
107 $ret =
$object->fetch($id, $ref);
109 $ret =
$object->fetch_thirdparty();
117if ($user->isExternalUser()) {
118 $socid = $user->isExternalUser();
122$permissionnote = $user->hasRight(
'ficheinter',
'creer');
123$permissiondellink = $user->hasRight(
'ficheinter',
'creer');
124$permissiontodelete = ((
$object->status ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->hasRight(
'ficheinter',
'supprimer'));
125$permissiontoread = $user->hasRight(
'ficheinter',
'lire');
126$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
127$permissiontoeditextra = $permissiontoadd;
128if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
130 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
140$parameters = array(
'socid' => $socid);
141$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
146if (empty($reshook)) {
147 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
149 if (empty($backtopage) || ($cancel && empty($id))) {
150 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
151 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
152 $backtopage = $backurlforlist;
154 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
160 if (!empty($backtopageforcancel)) {
161 header(
"Location: ".$backtopageforcancel);
163 } elseif (!empty($backtopage)) {
164 header(
"Location: ".$backtopage);
170 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
172 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
175 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
176 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
182 $clone_notes =
false;
186 $clone_contacts =
false;
188 $clone_contacts =
true;
191 $result =
$object->createFromClone($user, $socid, $clone_contacts, $clone_notes);
193 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
204 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
205 $result =
$object->setValid($user);
210 $outputlangs = $langs;
213 $newlang =
GETPOST(
'lang_id',
'aZ09');
216 $newlang =
$object->thirdparty->default_lang;
218 if (!empty($newlang)) {
220 $outputlangs->setDefaultLang($newlang);
225 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
230 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
231 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
235 $outputlangs = $langs;
238 $newlang =
GETPOST(
'lang_id',
'aZ09');
241 $newlang =
$object->thirdparty->default_lang;
243 if (!empty($newlang)) {
245 $outputlangs->setDefaultLang($newlang);
250 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
255 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
256 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
260 $outputlangs = $langs;
263 $newlang =
GETPOST(
'lang_id',
'aZ09');
266 $newlang =
$object->thirdparty->default_lang;
268 if (!empty($newlang)) {
270 $outputlangs->setDefaultLang($newlang);
275 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
280 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
281 $result =
$object->setDraft($user);
285 $outputlangs = $langs;
288 $newlang =
GETPOST(
'lang_id',
'aZ09');
291 $newlang =
$object->thirdparty->default_lang;
293 if (!empty($newlang)) {
295 $outputlangs->setDefaultLang($newlang);
300 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
305 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
306 $result =
$object->setClose($user);
311 $outputlangs = $langs;
314 $newlang =
GETPOST(
'lang_id',
'aZ09');
317 $newlang =
$object->thirdparty->default_lang;
319 if (!empty($newlang)) {
321 $outputlangs->setDefaultLang($newlang);
326 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
331 } elseif ($action ==
'add' && $permissiontoadd) {
332 $selectedLines =
GETPOST(
'toselect',
'array:int');
337 $object->user_author_id = $user->id;
340 $object->ref_client = $ref_client;
347 if (!empty($origin) && !empty($originid)) {
350 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
351 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
353 $subelement = $regs[2];
357 if ($element ==
'order') {
358 $element = $subelement =
'commande';
360 if ($element ==
'propal') {
361 $element =
'comm/propal';
362 $subelement =
'propal';
364 if ($element ==
'contract') {
365 $element = $subelement =
'contrat';
369 $object->origin_id = $originid;
374 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
380 $ret = $extrafields->setOptionalsFromPost(
null, $object);
394 $classname = ucfirst($subelement);
395 $srcobject =
new $classname(
$db);
396 '@phan-var-force Commande|Propal|Contrat $srcobject';
400 $result = $srcobject->fetch(
$object->origin_id);
402 $srcobject->fetch_thirdparty();
403 $lines = $srcobject->lines;
404 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
405 $srcobject->fetch_lines();
406 $lines = $srcobject->lines;
409 if (is_array($lines)) {
410 $num = count($lines);
412 for ($i = 0; $i < $num; $i++) {
413 if (!in_array($lines[$i]->
id, $selectedLines)) {
423 if ($lines[$i]->fk_product > 0) {
425 $prod->id = $lines[$i]->fk_product;
429 $prod->getMultiLangs();
431 $prod->fetch($lines[$i]->fk_product);
432 $outputlangs = $langs;
434 if (
GETPOST(
'lang_id',
'aZ09')) {
435 $newlang =
GETPOST(
'lang_id',
'aZ09');
437 if (empty($newlang)) {
438 $newlang = $srcobject->thirdparty->default_lang;
440 if (!empty($newlang)) {
442 $outputlangs->setDefaultLang($newlang);
444 $label = (!empty(
$prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ?
$prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
446 $prod->fetch($lines[$i]->fk_product);
447 $label = $lines[$i]->product_label;
451 switch (
$prod->duration_unit) {
460 $mult = 3600 * 24 * 7;
463 $mult = (int) (3600 * 24 * (365 / 12));
466 $mult = 3600 * 24 * 365;
469 $duration = (int)
$prod->duration_value * $mult * $lines[$i]->qty;
472 $desc = $lines[$i]->product_ref;
480 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
483 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
492 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
493 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
512 $langs->load(
"errors");
518 $langs->load(
"errors");
525 $ret = $extrafields->setOptionalsFromPost(
null, $object);
533 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
535 $object->array_options = $array_options;
537 $result =
$object->create($user);
543 $categories =
GETPOST(
'categories',
'array');
544 $object->setCategories($categories);
546 $langs->load(
"errors");
554 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
558 } elseif ($action ==
'update' && $permissiontoadd) {
562 $object->user_author_id = $user->id;
565 $object->ref_client = $ref_client;
567 $result =
$object->update($user);
571 } elseif ($action ==
'classin' && $permissiontoadd) {
577 } elseif ($action ==
'setcontract' && $permissiontoadd) {
583 } elseif ($action ==
'settags' &&
isModEnabled(
'category') && $permissiontoadd) {
589 } elseif ($action ==
'setref_client' && $permissiontoadd) {
591 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
595 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
596 $result =
$object->delete($user);
601 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
603 } elseif ($action ==
'setdescription' && $permissiontoadd) {
604 $result =
$object->set_description($user,
GETPOST(
'description'));
608 } elseif ($action ==
"addline" && $permissiontoadd) {
611 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
615 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
619 $mesg = $langs->trans(
"ErrorValueTooHigh");
625 $desc =
GETPOST(
'np_desc',
'restricthtml');
630 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
631 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
643 $outputlangs = $langs;
646 $newlang =
GETPOST(
'lang_id',
'aZ09');
649 $newlang =
$object->thirdparty->default_lang;
651 if (!empty($newlang)) {
653 $outputlangs->setDefaultLang($newlang);
662 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
669 } elseif ($action ==
'confirm_addtitleline' && $permissiontoadd) {
672 $langs->load(
'subtotals');
674 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
675 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
677 $subtotal_options = array();
679 foreach (Fichinter::$TITLE_OPTIONS as $option) {
680 $value =
GETPOST($option,
'alphanohtml');
682 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
687 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
698 $outputlangs = $langs;
699 $newlang =
GETPOST(
'lang_id',
'alpha');
701 $newlang =
$object->thirdparty->default_lang;
703 if (!empty($newlang)) {
705 $outputlangs->setDefaultLang($newlang);
708 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
713 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
715 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
719 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
724 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
728 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
733 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
737 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
742 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
745 if ($objectline->fetch($lineid) <= 0) {
750 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
756 $desc =
GETPOST(
'np_desc',
'restricthtml');
760 $objectline->date = $date_inter;
761 $objectline->desc = $desc;
762 $objectline->duration = $duration;
765 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
766 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
767 if (is_array($array_options)) {
768 $objectline->array_options = array_merge($objectline->array_options, $array_options);
771 $result = $objectline->update($user);
780 $outputlangs = $langs;
783 $newlang =
GETPOST(
'lang_id',
'aZ09');
786 $newlang =
$object->thirdparty->default_lang;
788 if (!empty($newlang)) {
790 $outputlangs->setDefaultLang($newlang);
796 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
798 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
801 if ($objectline->fetch($lineid) <= 0) {
805 $result = $objectline->deleteLine($user);
807 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
813 $outputlangs = $langs;
816 $newlang =
GETPOST(
'lang_id',
'aZ09');
819 $newlang =
$object->thirdparty->default_lang;
821 if (!empty($newlang)) {
823 $outputlangs->setDefaultLang($newlang);
828 } elseif ($action ==
'up' && $permissiontoadd) {
833 $outputlangs = $langs;
836 $newlang =
GETPOST(
'lang_id',
'aZ09');
839 $newlang =
$object->thirdparty->default_lang;
841 if (!empty($newlang)) {
843 $outputlangs->setDefaultLang($newlang);
849 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
851 } elseif ($action ==
'down' && $permissiontoadd) {
855 $outputlangs = $langs;
858 $newlang =
GETPOST(
'lang_id',
'aZ09');
861 $newlang =
$object->thirdparty->default_lang;
863 if (!empty($newlang)) {
865 $outputlangs->setDefaultLang($newlang);
871 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
876 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
879 $triggersendname =
'FICHINTER_SENTBYMAIL';
880 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
881 $trackid =
'int'.$object->id;
882 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
886 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
888 if ($action ==
'update_extras' && $permissiontoeditextra) {
891 $attribute_name =
GETPOST(
'attribute',
'aZ09');
894 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
901 $result =
$object->updateExtraField($attribute_name,
'INTERVENTION_MODIFY');
909 $action =
'edit_extras';
914 if ($action ==
'addcontact' && $permissiontoadd) {
915 if ($result > 0 && $id > 0) {
918 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
922 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
925 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
926 $langs->load(
"errors");
927 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
932 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
935 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
940 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
965$title =
$object->ref .
" - " . $langs->trans(
'Card');
966if ($action ==
'create') {
967 $title = $langs->trans(
"NewIntervention");
969$help_url =
'EN:Module_Interventions|FR:Module_Fiches_d\'interventions';
971llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
974if ($action ==
'create') {
980 print
load_fiche_titre($langs->trans(
"NewIntervention"),
'',
'intervention');
991 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
992 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
994 $subelement = $regs[2];
997 if ($element ==
'project') {
1001 if ($element ==
'order' || $element ==
'commande') {
1002 $element = $subelement =
'commande';
1004 if ($element ==
'propal') {
1005 $element =
'comm/propal';
1006 $subelement =
'propal';
1008 if ($element ==
'contract') {
1009 $element = $subelement =
'contrat';
1014 $classname = ucfirst($subelement);
1015 $objectsrc =
new $classname(
$db);
1016 '@phan-var-force Commande|Propal|Contrat $objectsrc';
1018 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
1019 $objectsrc->fetch_lines();
1020 $lines = $objectsrc->lines;
1022 $objectsrc->fetch_thirdparty();
1024 $projectid = (int) $objectsrc->fk_project;
1026 $soc = $objectsrc->thirdparty;
1028 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
1029 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
1032 $objectsrc->fetch_optionals();
1033 $object->array_options = $objectsrc->array_options;
1036 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
1040 $note_private =
GETPOST(
"note_private",
"alpha");
1041 $note_public =
GETPOST(
"note_public",
"alpha");
1044 if (!
$conf->global->FICHEINTER_ADDON) {
1045 dol_print_error(
$db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
1057 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1058 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1059 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
1060 print
'<input type="hidden" name="action" value="add">';
1061 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">'.
"\n";
1062 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1066 print
'<table class="border centpercent">';
1069 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
1072 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
1073 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1078 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
1081 print $soc->getNomUrl(1);
1082 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">';
1086 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
1087 $filter =
'(s.status:=:1)';
1088 print $form->select_company(
'',
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth150 widthcentpercentminusxx maxwidth500');
1089 print
' <a href="'.dolBuildUrl(DOL_URL_ROOT .
'/societe/card.php', [
'action' =>
'create',
'customer' => 3,
'backtopage' =>
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'create'])]).
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
1095 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1097 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1104 $langs->load(
"project");
1106 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1107 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1114 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth500 widthcentpercentminusxx');
1115 if ($numprojet == 0) {
1116 print
' <a href="' .
dolBuildUrl(DOL_URL_ROOT .
'/projet/card.php', [
'socid' => $soc->id,
'action' =>
'create',
'status' => 1,
'backtopage' =>
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'create',
'socid' => $soc->id])]) .
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProject").
'"></span></a>';
1124 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1125 print $form->selectCategories(Categorie::TYPE_FICHINTER,
'categories', $object);
1130 if (
isModEnabled(
'contract') && is_object($formcontract)) {
1134 $langs->load(
"contracts");
1135 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1136 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1137 if ($numcontrat == 0) {
1138 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>';
1146 if (count($liste) > 0) {
1148 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1150 print $form->selectarray(
'model', $liste,
getDolGlobalString(
'FICHEINTER_ADDON_PDF'));
1156 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1158 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1159 print $doleditor->Create(1);
1164 if (empty($user->socid)) {
1166 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1168 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1169 print $doleditor->Create(1);
1175 $parameters = array();
1176 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1177 print $hookmanager->resPrint;
1178 if (empty($reshook)) {
1179 print
$object->showOptionals($extrafields,
'create');
1183 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1184 $newclassname = $classname;
1185 if ($newclassname ==
'Propal') {
1186 $langs->load(
'propal');
1187 $newclassname =
'CommercialProposal';
1189 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1218 if (is_object($objectsrc)) {
1219 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1220 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1221 } elseif ($origin ==
'project' && !empty($projectid)) {
1222 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1227 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1230 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1231 $title = $langs->trans(
'Services');
1234 print
'<div class="div-table-responsive-no-min">';
1235 print
'<table class="noborder centpercent">';
1237 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1244} elseif ($id > 0 || !empty($ref)) {
1261 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
$object->picto, 0,
'',
'', 0,
'', 1);
1266 if ($action ==
'delete') {
1267 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1271 if ($action ==
'validate') {
1273 $ref = substr(
$object->ref, 1, 4);
1274 if ($ref ==
'PROV') {
1275 $numref =
$object->getNextNumRef($soc);
1276 if (empty($numref)) {
1283 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1285 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1288 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid, $object);
1291 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1295 if ($action ==
'sign') {
1296 $text = $langs->trans(
'ConfirmSignIntervention');
1298 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1301 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1306 'name' =>
'signed_status',
1307 'select_show_empty' => 0,
1308 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1309 'values' =>
$object->getSignedStatusLocalisedArray()
1311 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1315 if ($action ==
'unsign') {
1316 $text = $langs->trans(
'ConfirmUnsignIntervention');
1318 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1321 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1323 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1327 if ($action ==
'classifydone') {
1328 $text = $langs->trans(
'ConfirmCloseIntervention');
1330 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1333 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid, $object);
1335 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1339 if ($action ==
'modify') {
1340 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1344 if ($action ==
'reopen') {
1345 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1349 if ($action ==
'ask_deleteline') {
1350 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1354 if ($action ==
'clone') {
1356 $formquestion = array(
1362 'label' => $langs->trans(
"SelectThirdParty"),
1363 'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')
1366 'type' =>
'checkbox',
1367 'name' =>
'clone_contacts',
1368 'label' => $langs->trans(
"CloneContacts"),
1372 'type' =>
'checkbox',
1373 'name' =>
'clone_notes',
1374 'label' => $langs->trans(
"CloneNotes"),
1380 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1384 if ($action ==
'add_title_line') {
1385 $langs->load(
'subtotals');
1387 $depth_array =
$object->getPossibleLevels($langs);
1389 } elseif ($action ==
'add_subtotal_line') {
1390 $langs->load(
'subtotals');
1392 $titles =
$object->getPossibleTitles();
1396 if (!$formconfirm) {
1397 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1398 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1399 if (empty($reshook)) {
1400 $formconfirm .= $hookmanager->resPrint;
1401 } elseif ($reshook > 0) {
1402 $formconfirm = $hookmanager->resPrint;
1411 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1414 $morehtmlref =
'<div class="refidno">';
1416 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $permissiontoadd,
'string',
'', 0, 1);
1417 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $permissiontoadd,
'string',
'',
null,
null,
'', 1);
1419 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1422 $langs->load(
"projects");
1423 $morehtmlref .=
'<br>';
1424 if ($permissiontoadd) {
1425 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1426 if ($action !=
'classify') {
1427 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1429 $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');
1431 if (!empty(
$object->fk_project)) {
1433 $proj->fetch(
$object->fk_project);
1434 $morehtmlref .= $proj->getNomUrl(1);
1436 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1441 $morehtmlref .=
'</div>';
1443 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1446 print
'<div class="fichecenter">';
1447 print
'<div class="fichehalfleft">';
1448 print
'<div class="underbanner clearboth"></div>';
1450 print
'<table class="border tableforfield centpercent">';
1454 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1461 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1468 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1476 print
'<tr><td class="titlefield">';
1477 print $form->editfieldkey(
"Description",
'description',
$object->description, $object, $permissiontoadd,
'textarea');
1479 print $form->editfieldval(
"Description",
'description',
$object->description, $object, $permissiontoadd,
'textarea:8');
1486 print
'<table class="nobordernopadding centpercent"><tr><td>';
1487 print $langs->trans(
"Categories");
1488 print
'<td><td class="right">';
1489 if ($permissiontoadd) {
1490 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/fichinter/card.php?id='.
$object->id.
'&action=edittags&token='.
newToken().
'">'.
img_edit().
'</a>';
1494 print
'</td></tr></table>';
1497 if ($action ==
'edittags') {
1498 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
1499 print
'<input type="hidden" name="action" value="settags">';
1500 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1501 print $form->selectCategories(Categorie::TYPE_FICHINTER,
'categories', $object);
1502 print
'<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
1505 print $form->showCategories(
$object->id, Categorie::TYPE_FICHINTER, 1);
1515 $langs->load(
'contracts');
1519 print
'<table class="nobordernopadding centpercent"><tr><td>';
1520 print $langs->trans(
'Contract');
1522 if ($action !=
'editcontract') {
1523 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1524 print
img_edit($langs->trans(
'SetContract'), 1);
1527 print
'</tr></table>';
1529 if ($action ==
'editcontract') {
1531 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1535 $contratstatic->fetch(
$object->fk_contrat);
1537 print $contratstatic->getNomUrl(0, 0, 1);
1549 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1554 print
'<div class="fichehalfright">';
1555 print
'<div class="underbanner clearboth"></div>';
1557 print
'<table class="border tableforfield centpercent">';
1561 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1571 print
'<div class="clearboth"></div><br>';
1575 $blocname =
'contacts';
1576 $title = $langs->trans(
'ContactsAddresses');
1577 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1581 $blocname =
'notes';
1582 $title = $langs->trans(
'Notes');
1583 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1588 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1589 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1590 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1591 if ($action ==
'editline') {
1592 print
'<input type="hidden" name="action" value="updateline">';
1593 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1595 print
'<input type="hidden" name="action" value="addline">';
1597 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1600 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1601 $sql .=
' ft.special_code, ft.product_type,';
1602 $sql .=
' ft.date as date_intervention';
1603 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1604 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1606 $sql .=
' AND ft.duree <> 0';
1608 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1610 $resql =
$db->query($sql);
1612 $num =
$db->num_rows($resql);
1617 print
'<table class="noborder centpercent">';
1618 print
'<tr class="liste_titre">';
1622 print
'<td width="5" class="center linecolnum"></td>';
1625 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1626 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1627 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1628 print
'<td class="liste_titre"> </td>';
1629 print
'<td class="liste_titre"> </td>';
1633 $objp =
$db->fetch_object($resql);
1636 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1637 print
'<tr class="oddeven">';
1641 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1643 if (!empty($objp->special_code) || $objp->product_type == 9) {
1644 $line_color =
$object->getSubtotalColors($objp->duree);
1645 $line_options = json_decode($objp->extraparams,
true);
1646 $line_options = is_array($line_options) ? $line_options[
'subtotal'] : array();
1647 print
'<td colspan="3" ><strong>'.dol_htmlentitiesbr($objp->description).
'</strong>';
1648 if (array_key_exists(
'titleshowuponpdf', $line_options)) {
1649 echo
' ' .
img_picto($langs->trans(
"ShowUPOnPDF"),
'invoicing');
1651 if (array_key_exists(
'titleshowtotalexludingvatonpdf', $line_options)) {
1652 echo
' <span title="' . $langs->trans(
"ShowTotalExludingVATOnPDF") .
'">%</span>';
1654 if (array_key_exists(
'titleforcepagebreak', $line_options)) {
1655 echo
' ' .
img_picto($langs->trans(
"ForcePageBreak"),
'file');
1660 print
'<a name="'.$objp->rowid.
'"></a>';
1664 $objectline->fetch($objp->rowid);
1665 $objectline->fetch_optionals();
1667 $extrafields->fetch_name_optionals_label($objectline->table_element);
1669 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'',
'1',
'line');
1670 if (!empty($temps)) {
1671 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objp->rowid.
'" name="extrafield_lines_area_'.$objp->rowid.
'">';
1687 if (
$object->status == 0 && $permissiontoadd) {
1688 print
'<td class="center">';
1689 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1692 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1695 print
'<td class="center">';
1698 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1702 if ($i < $num - 1) {
1703 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1710 print
'<td colspan="2"> </td>';
1717 if (
$object->status == 0 && $action ==
'editline' && $permissiontoadd &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1718 print
'<tr class="oddeven nohover">';
1722 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1726 print
'<a name="'.$objp->rowid.
'"></a>';
1729 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1730 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1731 $doleditor->Create();
1734 $objectline->fetch($objp->rowid);
1735 $objectline->fetch_optionals();
1737 $extrafields->fetch_name_optionals_label($objectline->table_element);
1739 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'',
'1',
'line');
1740 if (!empty($temps)) {
1741 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objectline->id.
'" name="extrafield_lines_area_'.$objectline->id.
'">';
1749 print
'<td class="center nowrap">';
1751 print $form->selectDate(
$db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1753 print $form->selectDate(
$db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1758 print
'<td class="right">';
1760 $selectmode =
'select';
1762 $selectmode =
'text';
1764 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1768 print
'<td class="center" colspan="5" valign="center">';
1769 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1770 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1783 print
'<table class="noborder centpercent">';
1784 print
'<tr class="liste_titre">';
1788 print
'<td width="5" class="center linecolnum"></td>';
1792 print
'<a name="add"></a>';
1793 print $langs->trans(
'Description').
'</td>';
1794 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1795 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1796 print
'<td colspan="3"> </td>';
1800 print
'<tr class="oddeven nohover">'.
"\n";
1804 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1810 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1811 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1812 $doleditor->Create();
1816 $extrafields->fetch_name_optionals_label($objectline->table_element);
1818 if (is_object($objectline)) {
1819 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'',
'1',
'line');
1821 if (!empty($temps)) {
1822 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1831 print
'<td class="center nowrap">';
1836 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1838 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1844 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1846 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1851 print
'<td class="right">';
1853 $selectmode =
'select';
1855 $selectmode =
'text';
1861 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1876 print
'</form>'.
"\n";
1888 print
'<div class="tabsAction">';
1890 $parameters = array();
1891 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1893 if (empty($reshook)) {
1895 if ($user->socid == 0) {
1896 if ($action !=
'editdescription' && ($action !=
'presend')) {
1899 $langs->load(
'subtotals');
1901 $url_button = array();
1902 $url_button[] = array(
1903 'lang' =>
'subtotals',
1905 'perm' => (
bool) $permissiontoadd,
1906 'label' => $langs->trans(
'AddTitleLine'),
1907 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_title_line&token='.
newToken()
1910 $url_button[] = array(
1911 'lang' =>
'subtotals',
1913 'perm' => (
bool) $permissiontoadd,
1914 'label' => $langs->trans(
'AddSubtotalLine'),
1915 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_subtotal_line&token='.
newToken()
1917 print
dolGetButtonAction(
'', $langs->trans(
'Subtotal'),
'default', $url_button,
'',
true);
1922 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1923 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1925 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1931 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
1933 print $langs->trans(
"Modify");
1935 print $langs->trans(
"SetToDraft");
1942 if ($permissiontoadd) {
1943 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>';
1945 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1950 if (empty($user->socid)) {
1952 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1953 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
1962 print
'<div class="inline-block divButAction">';
1963 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>';
1967 $arrayofcreatebutton = array();
1970 $langs->load(
"propal");
1972 $arrayofcreatebutton[] = array(
1973 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1974 'label' => $langs->trans(
'AddProp'),
1976 'perm' => $user->hasRight(
'propal',
'creer'),
1984 $langs->load(
"bills");
1986 $arrayofcreatebutton[] = array(
1987 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1988 'label' => $langs->trans(
'AddBill'),
1990 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
1997 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>';
1999 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>';
2004 if (count($arrayofcreatebutton)) {
2005 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
2010 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
2011 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>';
2013 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>';
2019 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>';
2023 if ($permissiontoadd) {
2024 print
'<div class="inline-block divButAction"><a class="butAction butActionClone" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&socid='.
$object->socid.
'&action=clone&token='.
newToken().
'&object=ficheinter">'.$langs->trans(
"ToClone").
'</a></div>';
2028 print
'<div class="inline-block divButAction">';
2029 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
2037 if ($action !=
'presend') {
2038 print
'<div class="fichecenter"><div class="fichehalfleft">';
2045 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2046 $genallowed = $permissiontoread;
2047 $delallowed = $permissiontoadd;
2048 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang,
'', $object);
2051 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'fichinter'), 1);
2052 $linktoelem = $tmparray[
'linktoelem'];
2053 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2054 print $htmltoenteralink;
2056 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2060 print
'<br><!-- Link to download main doc -->'.
"\n";
2066 print
'<br><!-- Link to sign -->';
2067 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2069 print showOnlineSignatureUrl(
'fichinter',
$object->ref, $object).
'<br>';
2072 print
'</div><div class="fichehalfright">';
2076 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
2079 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2081 $somethingshown = $formactions->showactions($object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
2083 print
'</div></div>';
2088 if (
GETPOST(
'modelselected')) {
2089 $action =
'presend';
2093 $modelmail =
'fichinter_send';
2094 $defaulttopic =
'SendInterventionRef';
2095 $diroutput =
$conf->ficheinter->multidir_output[
$object->entity];
2096 $trackid =
'int'.$object->id;
2098 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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_now($mode='gmt')
Return date for now.
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...
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.
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.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
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.