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$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
126$permissiontoeditextra = $permissiontoadd;
127if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
129 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
139$parameters = array(
'socid' => $socid);
140$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
145if (empty($reshook)) {
146 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
148 if (empty($backtopage) || ($cancel && empty($id))) {
149 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
150 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
151 $backtopage = $backurlforlist;
153 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
159 if (!empty($backtopageforcancel)) {
160 header(
"Location: ".$backtopageforcancel);
162 } elseif (!empty($backtopage)) {
163 header(
"Location: ".$backtopage);
169 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
171 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
174 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
175 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
181 $clone_notes =
false;
182 if (GETPOSTISSET(
'clone_notes') &&
GETPOST(
'clone_notes') ===
'on') {
185 $clone_contacts =
false;
186 if (GETPOSTISSET(
'clone_contacts') &&
GETPOST(
'clone_contacts') ===
'on') {
187 $clone_contacts =
true;
190 $result =
$object->createFromClone($user, $socid, $clone_contacts, $clone_notes);
192 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
203 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
204 $result =
$object->setValid($user);
209 $outputlangs = $langs;
212 $newlang =
GETPOST(
'lang_id',
'aZ09');
215 $newlang =
$object->thirdparty->default_lang;
217 if (!empty($newlang)) {
219 $outputlangs->setDefaultLang($newlang);
224 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
229 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
230 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
234 $outputlangs = $langs;
237 $newlang =
GETPOST(
'lang_id',
'aZ09');
240 $newlang =
$object->thirdparty->default_lang;
242 if (!empty($newlang)) {
244 $outputlangs->setDefaultLang($newlang);
249 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
254 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
255 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
259 $outputlangs = $langs;
262 $newlang =
GETPOST(
'lang_id',
'aZ09');
265 $newlang =
$object->thirdparty->default_lang;
267 if (!empty($newlang)) {
269 $outputlangs->setDefaultLang($newlang);
274 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
279 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
280 $result =
$object->setDraft($user);
284 $outputlangs = $langs;
287 $newlang =
GETPOST(
'lang_id',
'aZ09');
290 $newlang =
$object->thirdparty->default_lang;
292 if (!empty($newlang)) {
294 $outputlangs->setDefaultLang($newlang);
299 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
304 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
305 $result =
$object->setClose($user);
310 $outputlangs = $langs;
313 $newlang =
GETPOST(
'lang_id',
'aZ09');
316 $newlang =
$object->thirdparty->default_lang;
318 if (!empty($newlang)) {
320 $outputlangs->setDefaultLang($newlang);
325 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
330 } elseif ($action ==
'add' && $permissiontoadd) {
331 $selectedLines =
GETPOST(
'toselect',
'array:int');
336 $object->user_author_id = $user->id;
339 $object->ref_client = $ref_client;
346 if (!empty($origin) && !empty($originid)) {
349 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
350 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
352 $subelement = $regs[2];
356 if ($element ==
'order') {
357 $element = $subelement =
'commande';
359 if ($element ==
'propal') {
360 $element =
'comm/propal';
361 $subelement =
'propal';
363 if ($element ==
'contract') {
364 $element = $subelement =
'contrat';
368 $object->origin_id = $originid;
373 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
379 $ret = $extrafields->setOptionalsFromPost(
null, $object);
393 $classname = ucfirst($subelement);
394 $srcobject =
new $classname(
$db);
395 '@phan-var-force Commande|Propal|Contrat $srcobject';
399 $result = $srcobject->fetch(
$object->origin_id);
401 $srcobject->fetch_thirdparty();
402 $lines = $srcobject->lines;
403 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
404 $srcobject->fetch_lines();
405 $lines = $srcobject->lines;
408 if (is_array($lines)) {
409 $num = count($lines);
411 for ($i = 0; $i < $num; $i++) {
412 if (!in_array($lines[$i]->
id, $selectedLines)) {
422 if ($lines[$i]->fk_product > 0) {
424 $prod->id = $lines[$i]->fk_product;
428 $prod->getMultiLangs();
430 $prod->fetch($lines[$i]->fk_product);
431 $outputlangs = $langs;
433 if (
GETPOST(
'lang_id',
'aZ09')) {
434 $newlang =
GETPOST(
'lang_id',
'aZ09');
436 if (empty($newlang)) {
437 $newlang = $srcobject->thirdparty->default_lang;
439 if (!empty($newlang)) {
441 $outputlangs->setDefaultLang($newlang);
443 $label = (!empty(
$prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ?
$prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
445 $prod->fetch($lines[$i]->fk_product);
446 $label = $lines[$i]->product_label;
450 switch (
$prod->duration_unit) {
459 $mult = 3600 * 24 * 7;
462 $mult = (int) (3600 * 24 * (365 / 12));
465 $mult = 3600 * 24 * 365;
468 $duration = (int)
$prod->duration_value * $mult * $lines[$i]->qty;
471 $desc = $lines[$i]->product_ref;
479 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
482 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
491 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
492 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
511 $langs->load(
"errors");
517 $langs->load(
"errors");
524 $ret = $extrafields->setOptionalsFromPost(
null, $object);
532 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
534 $object->array_options = $array_options;
536 $result =
$object->create($user);
542 $categories =
GETPOST(
'categories',
'array');
543 $object->setCategories($categories);
545 $langs->load(
"errors");
553 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
557 } elseif ($action ==
'update' && $permissiontoadd) {
561 $object->user_author_id = $user->id;
564 $object->ref_client = $ref_client;
566 $result =
$object->update($user);
570 } elseif ($action ==
'classin' && $permissiontoadd) {
576 } elseif ($action ==
'setcontract' && $permissiontoadd) {
582 } elseif ($action ==
'settags' &&
isModEnabled(
'category') && $permissiontoadd) {
588 } elseif ($action ==
'setref_client' && $permissiontoadd) {
590 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
594 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
595 $result =
$object->delete($user);
600 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
602 } elseif ($action ==
'setdescription' && $permissiontoadd) {
603 $result =
$object->set_description($user,
GETPOST(
'description'));
607 } elseif ($action ==
"addline" && $permissiontoadd) {
610 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
614 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
618 $mesg = $langs->trans(
"ErrorValueTooHigh");
624 $desc =
GETPOST(
'np_desc',
'restricthtml');
629 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
630 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
642 $outputlangs = $langs;
645 $newlang =
GETPOST(
'lang_id',
'aZ09');
648 $newlang =
$object->thirdparty->default_lang;
650 if (!empty($newlang)) {
652 $outputlangs->setDefaultLang($newlang);
661 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
668 } elseif ($action ==
'confirm_addtitleline' && $permissiontoadd) {
671 $langs->load(
'subtotals');
673 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
674 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
676 $subtotal_options = array();
678 foreach (Fichinter::$TITLE_OPTIONS as $option) {
679 $value =
GETPOST($option,
'alphanohtml');
681 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
686 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
697 $outputlangs = $langs;
698 $newlang =
GETPOST(
'lang_id',
'alpha');
700 $newlang =
$object->thirdparty->default_lang;
702 if (!empty($newlang)) {
704 $outputlangs->setDefaultLang($newlang);
707 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
712 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
714 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
718 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
723 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
727 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
732 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
736 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
741 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
744 if ($objectline->fetch($lineid) <= 0) {
749 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
755 $desc =
GETPOST(
'np_desc',
'restricthtml');
759 $objectline->date = $date_inter;
760 $objectline->desc = $desc;
761 $objectline->duration = $duration;
764 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
765 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
766 if (is_array($array_options)) {
767 $objectline->array_options = array_merge($objectline->array_options, $array_options);
770 $result = $objectline->update($user);
779 $outputlangs = $langs;
782 $newlang =
GETPOST(
'lang_id',
'aZ09');
785 $newlang =
$object->thirdparty->default_lang;
787 if (!empty($newlang)) {
789 $outputlangs->setDefaultLang($newlang);
795 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
797 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
800 if ($objectline->fetch($lineid) <= 0) {
804 $result = $objectline->deleteLine($user);
806 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
812 $outputlangs = $langs;
815 $newlang =
GETPOST(
'lang_id',
'aZ09');
818 $newlang =
$object->thirdparty->default_lang;
820 if (!empty($newlang)) {
822 $outputlangs->setDefaultLang($newlang);
827 } elseif ($action ==
'up' && $permissiontoadd) {
832 $outputlangs = $langs;
835 $newlang =
GETPOST(
'lang_id',
'aZ09');
838 $newlang =
$object->thirdparty->default_lang;
840 if (!empty($newlang)) {
842 $outputlangs->setDefaultLang($newlang);
848 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
850 } elseif ($action ==
'down' && $permissiontoadd) {
854 $outputlangs = $langs;
857 $newlang =
GETPOST(
'lang_id',
'aZ09');
860 $newlang =
$object->thirdparty->default_lang;
862 if (!empty($newlang)) {
864 $outputlangs->setDefaultLang($newlang);
870 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
875 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
878 $triggersendname =
'FICHINTER_SENTBYMAIL';
879 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
880 $trackid =
'int'.$object->id;
881 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
884 $upload_dir =
$conf->ficheinter->dir_output;
885 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
887 if ($action ==
'update_extras' && $permissiontoeditextra) {
890 $attribute_name =
GETPOST(
'attribute',
'aZ09');
893 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
900 $result =
$object->updateExtraField($attribute_name,
'INTERVENTION_MODIFY');
908 $action =
'edit_extras';
913 if ($action ==
'addcontact' && $permissiontoadd) {
914 if ($result > 0 && $id > 0) {
917 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
921 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
924 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
925 $langs->load(
"errors");
926 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
931 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
934 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
939 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
964$title =
$object->ref .
" - " . $langs->trans(
'Card');
965if ($action ==
'create') {
966 $title = $langs->trans(
"NewIntervention");
968$help_url =
'EN:Module_Interventions|FR:Module_Fiches_d\'interventions';
970llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
973if ($action ==
'create') {
979 print
load_fiche_titre($langs->trans(
"NewIntervention"),
'',
'intervention');
990 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
991 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
993 $subelement = $regs[2];
996 if ($element ==
'project') {
1000 if ($element ==
'order' || $element ==
'commande') {
1001 $element = $subelement =
'commande';
1003 if ($element ==
'propal') {
1004 $element =
'comm/propal';
1005 $subelement =
'propal';
1007 if ($element ==
'contract') {
1008 $element = $subelement =
'contrat';
1013 $classname = ucfirst($subelement);
1014 $objectsrc =
new $classname(
$db);
1015 '@phan-var-force Commande|Propal|Contrat $objectsrc';
1017 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
1018 $objectsrc->fetch_lines();
1019 $lines = $objectsrc->lines;
1021 $objectsrc->fetch_thirdparty();
1023 $projectid = (int) $objectsrc->fk_project;
1025 $soc = $objectsrc->thirdparty;
1027 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
1028 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
1031 $objectsrc->fetch_optionals();
1032 $object->array_options = $objectsrc->array_options;
1035 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
1039 $note_private =
GETPOST(
"note_private",
"alpha");
1040 $note_public =
GETPOST(
"note_public",
"alpha");
1043 if (!
$conf->global->FICHEINTER_ADDON) {
1044 dol_print_error(
$db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
1056 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1057 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1058 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
1059 print
'<input type="hidden" name="action" value="add">';
1060 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">'.
"\n";
1061 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1065 print
'<table class="border centpercent">';
1068 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
1071 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
1072 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1077 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
1080 print $soc->getNomUrl(1);
1081 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">';
1085 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
1086 $filter =
'(s.status:=:1)';
1087 print $form->select_company(
'',
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth150 widthcentpercentminusxx maxwidth500');
1088 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>';
1094 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1096 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1103 $langs->load(
"project");
1105 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1106 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1113 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth500 widthcentpercentminusxx');
1114 if ($numprojet == 0) {
1115 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>';
1123 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1124 print $form->selectCategories(Categorie::TYPE_FICHINTER,
'categories', $object);
1129 if (
isModEnabled(
'contract') && is_object($formcontract)) {
1133 $langs->load(
"contracts");
1134 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1135 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1136 if ($numcontrat == 0) {
1137 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>';
1145 if (count($liste) > 0) {
1147 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1149 print $form->selectarray(
'model', $liste,
getDolGlobalString(
'FICHEINTER_ADDON_PDF'));
1155 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1157 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1158 print $doleditor->Create(1);
1163 if (empty($user->socid)) {
1165 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1167 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1168 print $doleditor->Create(1);
1174 $parameters = array();
1175 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1176 print $hookmanager->resPrint;
1177 if (empty($reshook)) {
1178 print
$object->showOptionals($extrafields,
'create');
1182 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1183 $newclassname = $classname;
1184 if ($newclassname ==
'Propal') {
1185 $langs->load(
'propal');
1186 $newclassname =
'CommercialProposal';
1188 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1217 if (is_object($objectsrc)) {
1218 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1219 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1220 } elseif ($origin ==
'project' && !empty($projectid)) {
1221 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1226 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1229 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1230 $title = $langs->trans(
'Services');
1233 print
'<div class="div-table-responsive-no-min">';
1234 print
'<table class="noborder centpercent">';
1236 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1243} elseif ($id > 0 || !empty($ref)) {
1260 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
$object->picto, 0,
'',
'', 0,
'', 1);
1265 if ($action ==
'delete') {
1266 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1270 if ($action ==
'validate') {
1272 $ref = substr(
$object->ref, 1, 4);
1273 if ($ref ==
'PROV') {
1274 $numref =
$object->getNextNumRef($soc);
1275 if (empty($numref)) {
1282 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1284 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1287 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid, $object);
1290 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1294 if ($action ==
'sign') {
1295 $text = $langs->trans(
'ConfirmSignIntervention');
1297 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1300 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1305 'name' =>
'signed_status',
1306 'select_show_empty' => 0,
1307 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1308 'values' =>
$object->getSignedStatusLocalisedArray()
1310 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1314 if ($action ==
'unsign') {
1315 $text = $langs->trans(
'ConfirmUnsignIntervention');
1317 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1320 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1322 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1326 if ($action ==
'classifydone') {
1327 $text = $langs->trans(
'ConfirmCloseIntervention');
1329 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1332 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid, $object);
1334 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1338 if ($action ==
'modify') {
1339 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1343 if ($action ==
'reopen') {
1344 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1348 if ($action ==
'ask_deleteline') {
1349 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1353 if ($action ==
'clone') {
1355 $formquestion = array(
1361 'label' => $langs->trans(
"SelectThirdParty"),
1362 'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')
1365 'type' =>
'checkbox',
1366 'name' =>
'clone_contacts',
1367 'label' => $langs->trans(
"CloneContacts"),
1371 'type' =>
'checkbox',
1372 'name' =>
'clone_notes',
1373 'label' => $langs->trans(
"CloneNotes"),
1379 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1383 if ($action ==
'add_title_line') {
1384 $langs->load(
'subtotals');
1386 $depth_array =
$object->getPossibleLevels($langs);
1388 } elseif ($action ==
'add_subtotal_line') {
1389 $langs->load(
'subtotals');
1391 $titles =
$object->getPossibleTitles();
1395 if (!$formconfirm) {
1396 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1397 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1398 if (empty($reshook)) {
1399 $formconfirm .= $hookmanager->resPrint;
1400 } elseif ($reshook > 0) {
1401 $formconfirm = $hookmanager->resPrint;
1410 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1413 $morehtmlref =
'<div class="refidno">';
1415 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $permissiontoadd,
'string',
'', 0, 1);
1416 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $permissiontoadd,
'string',
'',
null,
null,
'', 1);
1418 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1421 $langs->load(
"projects");
1422 $morehtmlref .=
'<br>';
1423 if ($permissiontoadd) {
1424 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1425 if ($action !=
'classify') {
1426 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1428 $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');
1430 if (!empty(
$object->fk_project)) {
1432 $proj->fetch(
$object->fk_project);
1433 $morehtmlref .= $proj->getNomUrl(1);
1435 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1440 $morehtmlref .=
'</div>';
1442 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1445 print
'<div class="fichecenter">';
1446 print
'<div class="fichehalfleft">';
1447 print
'<div class="underbanner clearboth"></div>';
1449 print
'<table class="border tableforfield centpercent">';
1453 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1460 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1467 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1475 print
'<tr><td class="titlefield">';
1476 print $form->editfieldkey(
"Description",
'description',
$object->description, $object, $permissiontoadd,
'textarea');
1478 print $form->editfieldval(
"Description",
'description',
$object->description, $object, $permissiontoadd,
'textarea:8');
1485 print
'<table class="nobordernopadding centpercent"><tr><td>';
1486 print $langs->trans(
"Categories");
1487 print
'<td><td class="right">';
1488 if ($permissiontoadd) {
1489 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/fichinter/card.php?id='.
$object->id.
'&action=edittags&token='.newToken().
'">'.
img_edit().
'</a>';
1493 print
'</td></tr></table>';
1496 if ($action ==
'edittags') {
1497 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
1498 print
'<input type="hidden" name="action" value="settags">';
1499 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1500 print $form->selectCategories(Categorie::TYPE_FICHINTER,
'categories', $object);
1501 print
'<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
1504 print $form->showCategories(
$object->id, Categorie::TYPE_FICHINTER, 1);
1514 $langs->load(
'contracts');
1518 print
'<table class="nobordernopadding centpercent"><tr><td>';
1519 print $langs->trans(
'Contract');
1521 if ($action !=
'editcontract') {
1522 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1523 print
img_edit($langs->trans(
'SetContract'), 1);
1526 print
'</tr></table>';
1528 if ($action ==
'editcontract') {
1530 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1534 $contratstatic->fetch(
$object->fk_contrat);
1536 print $contratstatic->getNomUrl(0, 0, 1);
1548 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1553 print
'<div class="fichehalfright">';
1554 print
'<div class="underbanner clearboth"></div>';
1556 print
'<table class="border tableforfield centpercent">';
1560 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1570 print
'<div class="clearboth"></div><br>';
1574 $blocname =
'contacts';
1575 $title = $langs->trans(
'ContactsAddresses');
1576 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1580 $blocname =
'notes';
1581 $title = $langs->trans(
'Notes');
1582 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1587 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1588 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1589 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1590 if ($action ==
'editline') {
1591 print
'<input type="hidden" name="action" value="updateline">';
1592 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1594 print
'<input type="hidden" name="action" value="addline">';
1596 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1599 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1600 $sql .=
' ft.special_code, ft.product_type,';
1601 $sql .=
' ft.date as date_intervention';
1602 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1603 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1605 $sql .=
' AND ft.duree <> 0';
1607 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1609 $resql =
$db->query($sql);
1611 $num =
$db->num_rows($resql);
1616 print
'<table class="noborder centpercent">';
1617 print
'<tr class="liste_titre">';
1621 print
'<td width="5" class="center linecolnum"></td>';
1624 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1625 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1626 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1627 print
'<td class="liste_titre"> </td>';
1628 print
'<td class="liste_titre"> </td>';
1632 $objp =
$db->fetch_object($resql);
1635 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1636 print
'<tr class="oddeven">';
1640 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1642 if (!empty($objp->special_code) || $objp->product_type == 9) {
1643 $line_color =
$object->getSubtotalColors($objp->duree);
1644 $line_options = json_decode($objp->extraparams,
true);
1645 $line_options = is_array($line_options) ? $line_options[
'subtotal'] : array();
1646 print
'<td colspan="3" ><strong>'.dol_htmlentitiesbr($objp->description).
'</strong>';
1647 if (array_key_exists(
'titleshowuponpdf', $line_options)) {
1648 echo
' ' .
img_picto($langs->trans(
"ShowUPOnPDF"),
'invoicing');
1650 if (array_key_exists(
'titleshowtotalexludingvatonpdf', $line_options)) {
1651 echo
' <span title="' . $langs->trans(
"ShowTotalExludingVATOnPDF") .
'">%</span>';
1653 if (array_key_exists(
'titleforcepagebreak', $line_options)) {
1654 echo
' ' .
img_picto($langs->trans(
"ForcePageBreak"),
'file');
1659 print
'<a name="'.$objp->rowid.
'"></a>';
1663 $objectline->fetch($objp->rowid);
1664 $objectline->fetch_optionals();
1666 $extrafields->fetch_name_optionals_label($objectline->table_element);
1668 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'',
'1',
'line');
1669 if (!empty($temps)) {
1670 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objp->rowid.
'" name="extrafield_lines_area_'.$objp->rowid.
'">';
1686 if (
$object->status == 0 && $permissiontoadd) {
1687 print
'<td class="center">';
1688 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1691 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1694 print
'<td class="center">';
1697 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1701 if ($i < $num - 1) {
1702 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1709 print
'<td colspan="2"> </td>';
1716 if (
$object->status == 0 && $action ==
'editline' && $permissiontoadd &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1717 print
'<tr class="oddeven nohover">';
1721 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1725 print
'<a name="'.$objp->rowid.
'"></a>';
1728 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1729 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1730 $doleditor->Create();
1733 $objectline->fetch($objp->rowid);
1734 $objectline->fetch_optionals();
1736 $extrafields->fetch_name_optionals_label($objectline->table_element);
1738 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'',
'1',
'line');
1739 if (!empty($temps)) {
1740 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objectline->id.
'" name="extrafield_lines_area_'.$objectline->id.
'">';
1748 print
'<td class="center nowrap">';
1750 print $form->selectDate(
$db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1752 print $form->selectDate(
$db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1757 print
'<td class="right">';
1759 $selectmode =
'select';
1761 $selectmode =
'text';
1763 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1767 print
'<td class="center" colspan="5" valign="center">';
1768 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1769 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1782 print
'<table class="noborder centpercent">';
1783 print
'<tr class="liste_titre">';
1787 print
'<td width="5" class="center linecolnum"></td>';
1791 print
'<a name="add"></a>';
1792 print $langs->trans(
'Description').
'</td>';
1793 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1794 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1795 print
'<td colspan="3"> </td>';
1799 print
'<tr class="oddeven nohover">'.
"\n";
1803 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1809 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1810 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1811 $doleditor->Create();
1815 $extrafields->fetch_name_optionals_label($objectline->table_element);
1817 if (is_object($objectline)) {
1818 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'',
'1',
'line');
1820 if (!empty($temps)) {
1821 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1830 print
'<td class="center nowrap">';
1835 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1837 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1843 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1845 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1850 print
'<td class="right">';
1852 $selectmode =
'select';
1854 $selectmode =
'text';
1860 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1875 print
'</form>'.
"\n";
1887 print
'<div class="tabsAction">';
1889 $parameters = array();
1890 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1892 if (empty($reshook)) {
1894 if ($user->socid == 0) {
1895 if ($action !=
'editdescription' && ($action !=
'presend')) {
1898 $langs->load(
'subtotals');
1900 $url_button = array();
1901 $url_button[] = array(
1902 'lang' =>
'subtotals',
1904 'perm' => (
bool) $permissiontoadd,
1905 'label' => $langs->trans(
'AddTitleLine'),
1906 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_title_line&token='.newToken()
1909 $url_button[] = array(
1910 'lang' =>
'subtotals',
1912 'perm' => (
bool) $permissiontoadd,
1913 'label' => $langs->trans(
'AddSubtotalLine'),
1914 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_subtotal_line&token='.newToken()
1916 print dolGetButtonAction(
'', $langs->trans(
'Subtotal'),
'default', $url_button,
'',
true);
1921 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1922 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1924 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1930 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.newToken().
'">';
1932 print $langs->trans(
"Modify");
1934 print $langs->trans(
"SetToDraft");
1941 if ($permissiontoadd) {
1942 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>';
1944 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1949 if (empty($user->socid)) {
1951 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1952 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
1954 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
'#',
'',
false);
1961 print
'<div class="inline-block divButAction">';
1962 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>';
1966 $arrayofcreatebutton = array();
1969 $langs->load(
"propal");
1971 $arrayofcreatebutton[] = array(
1972 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1973 'label' => $langs->trans(
'AddProp'),
1975 'perm' => $user->hasRight(
'propal',
'creer'),
1983 $langs->load(
"bills");
1985 $arrayofcreatebutton[] = array(
1986 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1987 'label' => $langs->trans(
'AddBill'),
1989 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
1996 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>';
1998 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>';
2003 if (count($arrayofcreatebutton)) {
2004 print dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
2009 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
2010 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>';
2012 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>';
2018 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>';
2022 if ($permissiontoadd) {
2023 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>';
2027 print
'<div class="inline-block divButAction">';
2028 print dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.newToken(),
'delete', $permissiontodelete);
2036 if ($action !=
'presend') {
2037 print
'<div class="fichecenter"><div class="fichehalfleft">';
2043 $filedir =
$conf->ficheinter->dir_output.
"/".$filename;
2044 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2045 $genallowed = $user->hasRight(
'ficheinter',
'lire');
2046 $delallowed = $permissiontoadd;
2047 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2050 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'fichinter'), 1);
2051 $linktoelem = $tmparray[
'linktoelem'];
2052 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2053 print $htmltoenteralink;
2055 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2059 print
'<br><!-- Link to download main doc -->'.
"\n";
2060 print showDirectDownloadLink($object).
'<br>';
2065 print
'<br><!-- Link to sign -->';
2066 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2068 print showOnlineSignatureUrl(
'fichinter',
$object->ref, $object).
'<br>';
2071 print
'</div><div class="fichehalfright">';
2075 $morehtmlcenter = dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
2078 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2080 $somethingshown = $formactions->showactions($object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
2082 print
'</div></div>';
2087 if (
GETPOST(
'modelselected')) {
2088 $action =
'presend';
2092 $modelmail =
'fichinter_send';
2093 $defaulttopic =
'SendInterventionRef';
2094 $diroutput =
$conf->ficheinter->dir_output;
2095 $trackid =
'int'.$object->id;
2097 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.
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.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
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.
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.