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();
112 dol_print_error(
null,
$object->error);
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')]);
138$parameters = array(
'socid' => $socid);
139$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
141 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
144if (empty($reshook)) {
145 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
147 if (empty($backtopage) || ($cancel && empty($id))) {
148 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
149 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
150 $backtopage = $backurlforlist;
152 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
158 if (!empty($backtopageforcancel)) {
159 header(
"Location: ".$backtopageforcancel);
161 } elseif (!empty($backtopage)) {
162 header(
"Location: ".$backtopage);
168 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
170 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
173 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
174 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
175 setEventMessages($langs->trans(
"NoCloneOptionsSpecified"),
null,
'errors');
180 $clone_notes =
false;
184 $clone_contacts =
false;
186 $clone_contacts =
true;
189 $result =
$object->createFromClone($user, $socid, $clone_contacts, $clone_notes);
191 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
202 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
203 $result =
$object->setValid($user);
208 $outputlangs = $langs;
211 $newlang =
GETPOST(
'lang_id',
'aZ09');
214 $newlang =
$object->thirdparty->default_lang;
216 if (!empty($newlang)) {
218 $outputlangs->setDefaultLang($newlang);
223 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
228 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
229 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
233 $outputlangs = $langs;
236 $newlang =
GETPOST(
'lang_id',
'aZ09');
239 $newlang =
$object->thirdparty->default_lang;
241 if (!empty($newlang)) {
243 $outputlangs->setDefaultLang($newlang);
248 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
253 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
254 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
258 $outputlangs = $langs;
261 $newlang =
GETPOST(
'lang_id',
'aZ09');
264 $newlang =
$object->thirdparty->default_lang;
266 if (!empty($newlang)) {
268 $outputlangs->setDefaultLang($newlang);
273 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
278 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
279 $result =
$object->setDraft($user);
283 $outputlangs = $langs;
286 $newlang =
GETPOST(
'lang_id',
'aZ09');
289 $newlang =
$object->thirdparty->default_lang;
291 if (!empty($newlang)) {
293 $outputlangs->setDefaultLang($newlang);
298 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
303 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
304 $result =
$object->setClose($user);
309 $outputlangs = $langs;
312 $newlang =
GETPOST(
'lang_id',
'aZ09');
315 $newlang =
$object->thirdparty->default_lang;
317 if (!empty($newlang)) {
319 $outputlangs->setDefaultLang($newlang);
324 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
329 } elseif ($action ==
'add' && $permissiontoadd) {
330 $selectedLines =
GETPOST(
'toselect',
'array:int');
335 $object->user_author_id = $user->id;
338 $object->ref_client = $ref_client;
345 if (!empty($origin) && !empty($originid)) {
347 $object->origin_id = $originid;
352 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
358 $ret = $extrafields->setOptionalsFromPost(
null, $object);
373 $srcobject = fetchObjectByElement(
$object->origin_id, $origin);
375 if (is_object($srcobject) && $srcobject->id > 0) {
376 '@phan-var-force Commande|Propal|Contrat $srcobject';
378 $srcobject->fetch_thirdparty();
379 $lines = $srcobject->lines;
380 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
381 $srcobject->fetch_lines();
382 $lines = $srcobject->lines;
385 if (is_array($lines)) {
386 $num = count($lines);
388 for ($i = 0; $i < $num; $i++) {
389 if (!in_array($lines[$i]->
id, $selectedLines)) {
399 if ($lines[$i]->fk_product > 0) {
401 $prod->id = $lines[$i]->fk_product;
405 $prod->getMultiLangs();
407 $prod->fetch($lines[$i]->fk_product);
408 $outputlangs = $langs;
410 if (
GETPOST(
'lang_id',
'aZ09')) {
411 $newlang =
GETPOST(
'lang_id',
'aZ09');
413 if (empty($newlang)) {
414 $newlang = $srcobject->thirdparty->default_lang;
416 if (!empty($newlang)) {
418 $outputlangs->setDefaultLang($newlang);
420 $label = (!empty(
$prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ?
$prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
422 $prod->fetch($lines[$i]->fk_product);
423 $label = $lines[$i]->product_label;
427 switch (
$prod->duration_unit) {
442 $mult = 3600 * 24 * 7;
445 $mult = (int) (3600 * 24 * (365 / 12));
448 $mult = 3600 * 24 * 365;
451 $duration = (int) round(((
float)
$prod->duration_value) * $mult * $lines[$i]->qty);
454 $desc = $lines[$i]->product_ref;
463 if ($lines[$i]->fk_unit) {
464 $langs->load(
'measuring_units');
465 $unit_label = $langs->trans($lines[$i]->getLabelOfUnit(
'short'));
467 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.($unit_label ?
' '.$unit_label :
'').
')';
469 $source_date = (!empty($srcobject->delivery_date) ? $srcobject->delivery_date :
dol_now());
471 $date_intervention =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
480 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
481 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
500 $langs->load(
"errors");
501 if (is_object($srcobject) && !empty($srcobject->error)) {
502 setEventMessages($srcobject->error, $srcobject->errors,
'errors');
504 setEventMessages($langs->trans(
"ErrorRecordNotFound"),
null,
'errors');
510 $langs->load(
"errors");
517 $ret = $extrafields->setOptionalsFromPost(
null, $object);
525 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
527 $object->array_options = $array_options;
529 $result =
$object->create($user);
535 $categories =
GETPOST(
'categories',
'array');
536 $object->setCategories($categories);
538 $langs->load(
"errors");
546 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
550 } elseif ($action ==
'update' && $permissiontoadd) {
554 $object->user_author_id = $user->id;
557 $object->ref_client = $ref_client;
559 $result =
$object->update($user);
563 } elseif ($action ==
'classin' && $permissiontoadd) {
567 dol_print_error($db,
$object->error);
569 } elseif ($action ==
'setcontract' && $permissiontoadd) {
573 dol_print_error($db,
$object->error);
575 } elseif ($action ==
'settags' &&
isModEnabled(
'category') && $permissiontoadd) {
581 } elseif ($action ==
'setref_client' && $permissiontoadd) {
583 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
587 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
589 $result =
$object->delete($user);
594 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
596 } elseif ($action ==
'setdescription' && $permissiontoadd) {
597 $result =
$object->set_description($user,
GETPOST(
'description'));
599 dol_print_error($db,
$object->error);
601 } elseif ($action ==
"addline" && $permissiontoadd) {
604 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
608 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
612 $mesg = $langs->trans(
"ErrorValueTooHigh");
618 $desc =
GETPOST(
'np_desc',
'restricthtml');
623 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
624 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
636 $outputlangs = $langs;
639 $newlang =
GETPOST(
'lang_id',
'aZ09');
642 $newlang =
$object->thirdparty->default_lang;
644 if (!empty($newlang)) {
646 $outputlangs->setDefaultLang($newlang);
655 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
662 } elseif ($action ==
'confirm_addtitleline' && $permissiontoadd) {
665 $langs->load(
'subtotals');
667 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
668 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
670 $subtotal_options = array();
672 foreach (Fichinter::$TITLE_OPTIONS as $option) {
673 $value =
GETPOST($option,
'alphanohtml');
675 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
680 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
691 $outputlangs = $langs;
692 $newlang =
GETPOST(
'lang_id',
'alpha');
694 $newlang =
$object->thirdparty->default_lang;
696 if (!empty($newlang)) {
698 $outputlangs->setDefaultLang($newlang);
701 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
706 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
708 } elseif ($action ==
'confirm_addsubtotalline' && $permissiontoadd) {
711 $langs->load(
'subtotals');
713 $choosen_line =
GETPOST(
'subtotaltitleline',
'alphanohtml');
714 foreach (
$object->lines as $line) {
715 if ($line->desc == $choosen_line && $line->special_code == SUBTOTALS_SPECIAL_CODE) {
717 $depth = -$line->qty;
721 $subtotal_options = array();
723 foreach (Fichinter::$SUBTOTAL_OPTIONS as $option) {
724 $value =
GETPOST($option,
'alphanohtml');
726 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
731 if (isset($desc) && isset($depth)) {
732 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
735 $object->errors[] = $langs->trans(
"CorrespondingTitleNotFound");
744 $outputlangs = $langs;
745 $newlang =
GETPOST(
'lang_id',
'alpha');
747 $newlang =
$object->thirdparty->default_lang;
749 if (!empty($newlang)) {
751 $outputlangs->setDefaultLang($newlang);
754 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
759 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
761 } elseif ($action ==
'confirm_addtextline' && $permissiontoadd) {
764 $langs->load(
'subtotals');
766 $desc =
GETPOST(
'subtotaltextcontent',
'restricthtml');
769 $result =
$object->addSubtotalLine($langs, $desc, 0, array());
780 $outputlangs = $langs;
781 $newlang =
GETPOST(
'lang_id',
'alpha');
783 $newlang =
$object->thirdparty->default_lang;
785 if (!empty($newlang)) {
787 $outputlangs->setDefaultLang($newlang);
790 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
795 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
797 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
801 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
806 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
810 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
815 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
817 $result =
$object->setReopen($user);
819 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
824 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $permissiontoadd) {
825 $result =
$object->setCanceled($user);
830 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
833 if ($objectline->fetch($lineid) <= 0) {
834 dol_print_error($db);
838 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
839 dol_print_error($db);
844 $desc =
GETPOST(
'np_desc',
'restricthtml');
848 $objectline->date = $date_inter;
849 $objectline->desc = $desc;
850 if ($objectline->special_code != SUBTOTALS_SPECIAL_CODE) {
851 $objectline->duration = $duration;
855 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
856 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
857 if (is_array($array_options)) {
858 $objectline->array_options = array_merge($objectline->array_options, $array_options);
861 $result = $objectline->update($user);
866 setEventMessages($objectline->error, $objectline->errors,
'errors');
870 $outputlangs = $langs;
873 $newlang =
GETPOST(
'lang_id',
'aZ09');
876 $newlang =
$object->thirdparty->default_lang;
878 if (!empty($newlang)) {
880 $outputlangs->setDefaultLang($newlang);
886 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
888 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
891 if ($objectline->fetch($lineid) <= 0) {
892 dol_print_error($db);
895 $result = $objectline->deleteLine($user);
897 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
898 dol_print_error($db);
903 $outputlangs = $langs;
906 $newlang =
GETPOST(
'lang_id',
'aZ09');
909 $newlang =
$object->thirdparty->default_lang;
911 if (!empty($newlang)) {
913 $outputlangs->setDefaultLang($newlang);
918 } elseif ($action ==
'confirm_delete_subtotalline' && $confirm ==
'yes' && $permissiontoadd) {
922 $result =
$object->deleteSubtotalLine($langs,
GETPOSTINT(
'lineid'), (
bool)
GETPOST(
'deletecorrespondingsubtotalline'));
925 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
931 } elseif ($action ==
'up' && $permissiontoadd) {
936 $outputlangs = $langs;
939 $newlang =
GETPOST(
'lang_id',
'aZ09');
942 $newlang =
$object->thirdparty->default_lang;
944 if (!empty($newlang)) {
946 $outputlangs->setDefaultLang($newlang);
952 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
954 } elseif ($action ==
'down' && $permissiontoadd) {
958 $outputlangs = $langs;
961 $newlang =
GETPOST(
'lang_id',
'aZ09');
964 $newlang =
$object->thirdparty->default_lang;
966 if (!empty($newlang)) {
968 $outputlangs->setDefaultLang($newlang);
974 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
979 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
982 $triggersendname =
'FICHINTER_SENTBYMAIL';
983 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
984 $trackid =
'int'.$object->id;
985 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
989 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
991 if ($action ==
'update_extras' && $permissiontoeditextra) {
994 $attribute_name =
GETPOST(
'attribute',
'aZ09');
997 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
1004 $result =
$object->updateExtraField($attribute_name,
'FICHINTER_MODIFY');
1012 $action =
'edit_extras';
1017 if ($action ==
'addcontact' && $permissiontoadd) {
1018 if ($result > 0 && $id > 0) {
1021 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
1025 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
1028 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
1029 $langs->load(
"errors");
1030 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
1035 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
1038 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
1043 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
1046 dol_print_error($db);
1057$form =
new Form($db);
1059$formcontract =
null;
1068$title =
$object->ref .
" - " . $langs->trans(
'Card');
1069if ($action ==
'create') {
1070 $title = $langs->trans(
"NewIntervention");
1072$help_url =
'EN:Module_Interventions|FR:Module_Fiches_d\'interventions';
1074llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
1077if ($action ==
'create') {
1080 $soc->fetch($socid);
1084 print
load_fiche_titre($langs->trans(
"NewIntervention"),
'',
'intervention');
1095 $element =
GETPOST(
'origin',
'alphanohtml');
1096 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
1097 $element = $regs[1];
1100 if ($element ==
'project') {
1104 $objectsrc = fetchObjectByElement($originid, $origin);
1106 if (is_object($objectsrc) && $objectsrc->id > 0) {
1107 '@phan-var-force Commande|Propal|Contrat $objectsrc';
1108 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
1109 $objectsrc->fetch_lines();
1111 $objectsrc->fetch_thirdparty();
1113 $projectid = (int) $objectsrc->fk_project;
1115 $soc = $objectsrc->thirdparty;
1117 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
1118 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
1121 $objectsrc->fetch_optionals();
1122 $object->array_options = $objectsrc->array_options;
1125 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
1132 $note_private =
GETPOST(
"note_private",
"alpha");
1133 $note_public =
GETPOST(
"note_public",
"alpha");
1136 if (!
$conf->global->FICHEINTER_ADDON) {
1137 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
1149 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1150 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1151 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
1152 print
'<input type="hidden" name="action" value="add">';
1153 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">'.
"\n";
1154 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1158 print
'<table class="border centpercent">';
1161 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
1164 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
1165 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1170 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
1173 print $soc->getNomUrl(1);
1174 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">';
1178 print img_picto(
'',
'company',
'class="pictofixedwidth"');
1179 $filter =
'(s.status:=:1)';
1180 print $form->select_company(
'',
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth150 widthcentpercentminusxx maxwidth500');
1181 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>';
1187 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1189 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1196 $langs->load(
"project");
1198 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1199 print img_picto(
'',
'project',
'class="pictofixedwidth"');
1206 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth500 widthcentpercentminusxx');
1207 if ($numprojet == 0) {
1208 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>';
1216 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1217 print $form->selectCategories(Categorie::TYPE_FICHINTER,
'categories', $object);
1222 if (
isModEnabled(
'contract') && is_object($formcontract)) {
1226 $langs->load(
"contracts");
1227 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1228 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1229 if ($numcontrat == 0) {
1230 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>';
1238 if (count($liste) > 0) {
1240 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1242 print $form->selectarray(
'model', $liste,
getDolGlobalString(
'FICHEINTER_ADDON_PDF'));
1248 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1250 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1251 print $doleditor->Create(1);
1256 if (empty($user->socid)) {
1258 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1260 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1261 print $doleditor->Create(1);
1267 $parameters = array();
1268 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1269 print $hookmanager->resPrint;
1270 if (empty($reshook)) {
1271 print
$object->showOptionals($extrafields,
'create');
1275 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1276 $newclassname = get_class($objectsrc);
1277 if ($newclassname ==
'Propal') {
1278 $langs->load(
'propal');
1279 $newclassname =
'CommercialProposal';
1281 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1310 if (is_object($objectsrc)) {
1311 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1312 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1313 } elseif ($origin ==
'project' && !empty($projectid)) {
1314 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1319 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1322 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1323 $title = $langs->trans(
'Services');
1326 print
'<div class="div-table-responsive-no-min">';
1327 print
'<table class="noborder centpercent">';
1329 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1336} elseif ($id > 0 || !empty($ref)) {
1353 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
$object->picto, 0,
'',
'', 0,
'', 1);
1358 if ($action ==
'delete') {
1359 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1363 if ($action ==
'validate') {
1365 $ref = substr(
$object->ref, 1, 4);
1366 if ($ref ==
'PROV') {
1367 $numref =
$object->getNextNumRef($soc);
1368 if (empty($numref)) {
1373 $numref = (string)
$object->ref;
1375 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1377 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1378 $notify =
new Notify($db);
1380 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid, $object);
1383 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1387 if ($action ==
'sign') {
1388 $text = $langs->trans(
'ConfirmSignIntervention');
1390 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1391 $notify =
new Notify($db);
1393 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1398 'name' =>
'signed_status',
1399 'select_show_empty' => 0,
1400 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1401 'values' =>
$object->getSignedStatusLocalisedArray()
1403 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1407 if ($action ==
'unsign') {
1408 $text = $langs->trans(
'ConfirmUnsignIntervention');
1410 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1411 $notify =
new Notify($db);
1413 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1415 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1419 if ($action ==
'classifydone') {
1420 $text = $langs->trans(
'ConfirmCloseIntervention');
1422 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1423 $notify =
new Notify($db);
1425 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid, $object);
1427 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1431 if ($action ==
'modify') {
1432 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1436 if ($action ==
'reopen') {
1437 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1441 if ($action ==
'cancel') {
1442 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
"Cancel"), $langs->trans(
'ConfirmCancelIntervention',
$object->ref),
'confirm_cancel',
'', 0, 1);
1446 if ($action ==
'ask_deleteline') {
1447 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1451 if ($action ==
'ask_subtotal_deleteline') {
1452 $langs->load(
'subtotals');
1453 $subtotaltitle =
'DeleteSubtotalLine';
1454 $subtotalquestion =
'ConfirmDeleteSubtotalLine';
1455 $subtotalformquestion = array();
1456 if (
GETPOST(
'type') ==
'title') {
1457 $subtotalformquestion = array(array(
'type' =>
'checkbox',
'name' =>
'deletecorrespondingsubtotalline',
'label' => $langs->trans(
'DeleteCorrespondingSubtotalLine'),
'value' => 0));
1458 $subtotaltitle =
'DeleteTitleLine';
1459 $subtotalquestion =
'ConfirmDeleteTitleLine';
1461 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.
GETPOSTINT(
'lineid'), $langs->trans($subtotaltitle), $langs->trans($subtotalquestion),
'confirm_delete_subtotalline', $subtotalformquestion,
'no', 1);
1465 if ($action ==
'clone') {
1467 $formquestion = array(
1473 'label' => $langs->trans(
"SelectThirdParty"),
1474 'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')
1477 'type' =>
'checkbox',
1478 'name' =>
'clone_contacts',
1479 'label' => $langs->trans(
"CloneContacts"),
1483 'type' =>
'checkbox',
1484 'name' =>
'clone_notes',
1485 'label' => $langs->trans(
"CloneNotes"),
1491 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1495 if ($action ==
'add_title_line') {
1496 $langs->load(
'subtotals');
1498 $depth_array =
$object->getPossibleLevels($langs);
1500 } elseif ($action ==
'add_subtotal_line') {
1501 $langs->load(
'subtotals');
1503 $titles =
$object->getPossibleTitles();
1505 } elseif ($action ==
'add_text_line') {
1506 $langs->load(
'subtotals');
1511 if (!$formconfirm) {
1512 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1513 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1514 if (empty($reshook)) {
1515 $formconfirm .= $hookmanager->resPrint;
1516 } elseif ($reshook > 0) {
1517 $formconfirm = $hookmanager->resPrint;
1526 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1529 $morehtmlref =
'<div class="refidno">';
1531 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $permissiontoadd,
'string',
'', 0, 1);
1532 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $permissiontoadd,
'string',
'',
null,
null,
'', 1);
1534 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1537 $langs->load(
"projects");
1538 $morehtmlref .=
'<br>';
1539 if ($permissiontoadd) {
1540 $morehtmlref .= img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1541 if ($action !=
'classify') {
1542 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1544 $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');
1546 if (!empty(
$object->fk_project)) {
1548 $proj->fetch(
$object->fk_project);
1549 $morehtmlref .= $proj->getNomUrl(1);
1551 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1556 $morehtmlref .=
'</div>';
1558 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1561 print
'<div class="fichecenter">';
1562 print
'<div class="fichehalfleft">';
1563 print
'<div class="underbanner clearboth"></div>';
1565 print
'<table class="border tableforfield centpercent">';
1569 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1576 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1583 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1591 print
'<tr><td class="titlefield">';
1592 print $form->editfieldkey(
"Description",
'description',
$object->description, $object, $permissiontoadd,
'textarea');
1594 print $form->editfieldval(
"Description",
'description',
$object->description, $object, $permissiontoadd,
'textarea:8');
1601 print
'<table class="nobordernopadding centpercent"><tr><td>';
1602 print $langs->trans(
"Categories");
1603 print
'<td><td class="right">';
1604 if ($permissiontoadd) {
1605 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/fichinter/card.php?id='.
$object->id.
'&action=edittags&token='.
newToken().
'">'.img_edit().
'</a>';
1609 print
'</td></tr></table>';
1612 if ($action ==
'edittags') {
1613 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
1614 print
'<input type="hidden" name="action" value="settags">';
1615 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1616 print $form->selectCategories(Categorie::TYPE_FICHINTER,
'categories', $object);
1617 print
'<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
1620 print $form->showCategories(
$object->id, Categorie::TYPE_FICHINTER, 1);
1630 $langs->load(
'contracts');
1634 print
'<table class="nobordernopadding centpercent"><tr><td>';
1635 print $langs->trans(
'Contract');
1637 if ($action !=
'editcontract') {
1638 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1639 print img_edit($langs->trans(
'SetContract'), 1);
1642 print
'</tr></table>';
1644 if ($action ==
'editcontract') {
1646 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1649 $contratstatic =
new Contrat($db);
1650 $contratstatic->fetch(
$object->fk_contrat);
1652 print $contratstatic->getNomUrl(0, 0, 1);
1664 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1669 print
'<div class="fichehalfright">';
1670 print
'<div class="underbanner clearboth"></div>';
1672 print
'<table class="border tableforfield centpercent">';
1676 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1686 print
'<div class="clearboth"></div><br>';
1690 $blocname =
'contacts';
1691 $title = $langs->trans(
'ContactsAddresses');
1692 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1696 $blocname =
'notes';
1697 $title = $langs->trans(
'Notes');
1698 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1703 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1704 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1705 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1706 if ($action ==
'editline') {
1707 print
'<input type="hidden" name="action" value="updateline">';
1708 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1710 print
'<input type="hidden" name="action" value="addline">';
1712 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1715 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1716 $sql .=
' ft.special_code, ft.product_type, ft.extraparams,';
1717 $sql .=
' ft.date as date_intervention';
1718 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1719 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1721 $sql .=
' AND ft.duree <> 0';
1723 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1725 $resql = $db->query($sql);
1727 $num = $db->num_rows($resql);
1732 print
'<table class="noborder centpercent">';
1733 print
'<tr class="liste_titre">';
1737 print
'<td width="5" class="center linecolnum"></td>';
1740 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1741 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1742 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1743 print
'<td class="liste_titre"> </td>';
1744 print
'<td class="liste_titre"> </td>';
1748 $objp = $db->fetch_object($resql);
1751 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1752 print
'<tr class="oddeven">';
1756 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1758 if (!empty($objp->special_code) || $objp->product_type == 9) {
1759 $line_color =
$object->getSubtotalColors($objp->duree);
1760 $line_options = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams,
true) : array();
1761 $line_options = $line_options[
'subtotal'] ?? array();
1762 print
'<td colspan="3" ><strong>'.dol_htmlentitiesbr($objp->description).
'</strong>';
1763 if (array_key_exists(
'titleshowuponpdf', $line_options)) {
1764 echo
' ' . img_picto($langs->trans(
"ShowUPOnPDF"),
'invoicing');
1766 if (array_key_exists(
'titleshowtotalexludingvatonpdf', $line_options)) {
1767 echo
' <span title="' . $langs->trans(
"ShowTotalExludingVATOnPDF") .
'">%</span>';
1769 if (array_key_exists(
'titleforcepagebreak', $line_options)) {
1770 echo
' ' . img_picto($langs->trans(
"ForcePageBreak"),
'file');
1775 print
'<a name="'.$objp->rowid.
'"></a>';
1779 $objectline->fetch($objp->rowid);
1780 $objectline->fetch_optionals();
1782 $extrafields->fetch_name_optionals_label($objectline->table_element);
1784 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'',
'1',
'line');
1785 if (!empty($temps)) {
1786 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objp->rowid.
'" name="extrafield_lines_area_'.$objp->rowid.
'">';
1794 print
'<td class="center" width="150">'.(!
getDolGlobalString(
'FICHINTER_DATE_WITHOUT_HOUR') ?
dol_print_date($db->jdate($objp->date_intervention),
'dayhour') :
dol_print_date($db->jdate($objp->date_intervention),
'day')).
'</td>';
1802 if (
$object->status == 0 && $permissiontoadd) {
1803 print
'<td class="center">';
1804 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1807 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1810 print
'<td class="center">';
1813 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1817 if ($i < $num - 1) {
1818 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1825 print
'<td colspan="2"> </td>';
1832 if (
$object->status == 0 && $action ==
'editline' && $permissiontoadd &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1833 print
'<tr class="oddeven nohover">';
1837 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1841 print
'<a name="'.$objp->rowid.
'"></a>';
1844 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1845 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1846 $doleditor->Create();
1849 $objectline->fetch($objp->rowid);
1850 $objectline->fetch_optionals();
1852 $extrafields->fetch_name_optionals_label($objectline->table_element);
1854 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'',
'1',
'line');
1855 if (!empty($temps)) {
1856 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objectline->id.
'" name="extrafield_lines_area_'.$objectline->id.
'">';
1864 print
'<td class="center nowrap">';
1866 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1868 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1873 print
'<td class="right">';
1875 $selectmode =
'select';
1877 $selectmode =
'text';
1879 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1883 print
'<td class="center" colspan="5" valign="center">';
1884 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1885 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1898 print
'<table class="noborder centpercent">';
1899 print
'<tr class="liste_titre">';
1903 print
'<td width="5" class="center linecolnum"></td>';
1907 print
'<a name="add"></a>';
1908 print $langs->trans(
'Description').
'</td>';
1909 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1910 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1911 print
'<td colspan="3"> </td>';
1915 print
'<tr class="oddeven nohover">'.
"\n";
1919 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1925 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1926 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1927 $doleditor->Create();
1931 $extrafields->fetch_name_optionals_label($objectline->table_element);
1933 if (is_object($objectline)) {
1934 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'',
'1',
'line');
1936 if (!empty($temps)) {
1937 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1946 print
'<td class="center nowrap">';
1951 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1953 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1959 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1961 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1966 print
'<td class="right">';
1968 $selectmode =
'select';
1970 $selectmode =
'text';
1976 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1988 dol_print_error($db);
1991 print
'</form>'.
"\n";
2003 print
'<div class="tabsAction">';
2005 $parameters = array();
2006 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2008 if (empty($reshook)) {
2010 if ($user->socid == 0) {
2011 if ($action !=
'editdescription' && $action !=
'presend' && $action !=
'editline') {
2015 $langs->load(
'subtotals');
2017 $url_button = array();
2018 $url_button[] = array(
2019 'lang' =>
'subtotals',
2021 'perm' => (
bool) $permissiontoadd,
2022 'label' => $langs->trans(
'AddTitleLine'),
2023 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_title_line&token='.
newToken()
2026 $url_button[] = array(
2027 'lang' =>
'subtotals',
2029 'perm' => (
bool) $permissiontoadd,
2030 'label' => $langs->trans(
'AddSubtotalLine'),
2031 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_subtotal_line&token='.
newToken()
2034 $url_button[] = array(
2035 'lang' =>
'subtotals',
2037 'perm' => (
bool) $permissiontoadd,
2038 'label' => $langs->trans(
'AddTextLine'),
2039 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_text_line&token='.
newToken()
2041 print dolGetButtonAction(
'', $langs->trans(
'SubTotal'),
'default', $url_button,
'',
true);
2046 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
2047 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
2049 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
2055 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
2057 print $langs->trans(
"Modify");
2059 print $langs->trans(
"SetToDraft");
2066 if ($permissiontoadd) {
2067 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>';
2069 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
2074 if (empty($user->socid)) {
2076 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
2077 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
2079 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
'#',
'',
false);
2086 print
'<div class="inline-block divButAction">';
2087 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>';
2091 $arrayofcreatebutton = array();
2094 $langs->load(
"propal");
2096 $arrayofcreatebutton[] = array(
2097 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
2098 'label' => $langs->trans(
'AddProp'),
2100 'perm' => $user->hasRight(
'propal',
'creer'),
2108 $langs->load(
"bills");
2110 $arrayofcreatebutton[] = array(
2111 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
2112 'label' => $langs->trans(
'AddBill'),
2114 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
2121 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>';
2123 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>';
2128 if (count($arrayofcreatebutton)) {
2129 print dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
2134 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
2135 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>';
2137 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>';
2143 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>';
2147 if ($permissiontoadd) {
2148 print
'<div class="inline-block divButAction">'.dolGetButtonAction($langs->trans(
"ToClone"), $langs->trans(
"ToClone"),
'clone', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&socid='.
$object->socid.
'&action=clone&token='.
newToken().
'&object=ficheinter',
'',
true, array(
'attr' => array(
'class' =>
'reposition'))).
'</div>';
2153 if ($user->hasRight(
'ficheinter',
'supprimer')) {
2154 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'">'.$langs->trans(
"Cancel").
'</a></div>';
2156 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'Cancel').
'</a></div>';
2161 print
'<div class="inline-block divButAction">';
2162 print dolGetButtonAction($langs->trans(
"Delete"), $langs->trans(
"Delete"),
'delete',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'delete'],
true),
'delete', $permissiontodelete, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
2170 if ($action !=
'presend') {
2171 print
'<div class="fichecenter"><div class="fichehalfleft">';
2178 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2179 $genallowed = $permissiontoread;
2180 $delallowed = $permissiontoadd;
2181 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang,
'', $object);
2184 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'fichinter'), 1);
2185 $linktoelem = $tmparray[
'linktoelem'];
2186 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2187 print $htmltoenteralink;
2189 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2193 print
'<br><!-- Link to download main doc -->'.
"\n";
2199 print
'<br><!-- Link to sign -->';
2200 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2202 print showOnlineSignatureUrl(
'fichinter',
$object->ref, $object).
'<br>';
2205 print
'</div><div class="fichehalfright">';
2209 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
2212 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2214 $somethingshown = $formactions->showactions($object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
2216 print
'</div></div>';
2221 if (
GETPOST(
'modelselected')) {
2222 $action =
'presend';
2226 $modelmail =
'fichinter_send';
2227 $defaulttopic =
'SendInterventionRef';
2228 $diroutput =
$conf->ficheinter->multidir_output[
$object->entity];
2229 $trackid =
'int'.$object->id;
2231 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_CANCELED
Canceled 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...
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
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.
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.
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.
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).
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.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
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).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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).
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, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.