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);
110 $ret =
$object->fetch_thirdparty();
118if ($user->isExternalUser()) {
119 $socid = $user->isExternalUser();
123$permissionnote = $user->hasRight(
'ficheinter',
'creer');
124$permissiondellink = $user->hasRight(
'ficheinter',
'creer');
125$permissiontodelete = ((
$object->status ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->hasRight(
'ficheinter',
'supprimer'));
126$permissiontoread = $user->hasRight(
'ficheinter',
'lire');
127$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
128$permissiontoeditextra = $permissiontoadd;
129if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
131 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
141$parameters = array(
'socid' => $socid);
142$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
147if (empty($reshook)) {
148 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
150 if (empty($backtopage) || ($cancel && empty($id))) {
151 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
152 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
153 $backtopage = $backurlforlist;
155 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
161 if (!empty($backtopageforcancel)) {
162 header(
"Location: ".$backtopageforcancel);
164 } elseif (!empty($backtopage)) {
165 header(
"Location: ".$backtopage);
171 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
173 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
176 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
177 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
183 $clone_notes =
false;
187 $clone_contacts =
false;
189 $clone_contacts =
true;
192 $result =
$object->createFromClone($user, $socid, $clone_contacts, $clone_notes);
194 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
205 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
206 $result =
$object->setValid($user);
211 $outputlangs = $langs;
214 $newlang =
GETPOST(
'lang_id',
'aZ09');
217 $newlang =
$object->thirdparty->default_lang;
219 if (!empty($newlang)) {
221 $outputlangs->setDefaultLang($newlang);
226 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
231 } elseif ($action ==
'confirm_sign' && $confirm ==
'yes' && $permissiontoadd) {
232 $result =
$object->setSignedStatus($user,
GETPOSTINT(
'signed_status'), 0,
'FICHINTER_MODIFY');
236 $outputlangs = $langs;
239 $newlang =
GETPOST(
'lang_id',
'aZ09');
242 $newlang =
$object->thirdparty->default_lang;
244 if (!empty($newlang)) {
246 $outputlangs->setDefaultLang($newlang);
251 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
256 } elseif ($action ==
'confirm_unsign' && $confirm ==
'yes' && $permissiontoadd) {
257 $result =
$object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_NO_SIGNATURE'], 0,
'FICHINTER_MODIFY');
261 $outputlangs = $langs;
264 $newlang =
GETPOST(
'lang_id',
'aZ09');
267 $newlang =
$object->thirdparty->default_lang;
269 if (!empty($newlang)) {
271 $outputlangs->setDefaultLang($newlang);
276 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
281 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $permissiontoadd) {
282 $result =
$object->setDraft($user);
286 $outputlangs = $langs;
289 $newlang =
GETPOST(
'lang_id',
'aZ09');
292 $newlang =
$object->thirdparty->default_lang;
294 if (!empty($newlang)) {
296 $outputlangs->setDefaultLang($newlang);
301 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
306 } elseif ($action ==
'confirm_done' && $confirm ==
'yes' && $permissiontoadd) {
307 $result =
$object->setClose($user);
312 $outputlangs = $langs;
315 $newlang =
GETPOST(
'lang_id',
'aZ09');
318 $newlang =
$object->thirdparty->default_lang;
320 if (!empty($newlang)) {
322 $outputlangs->setDefaultLang($newlang);
327 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
332 } elseif ($action ==
'add' && $permissiontoadd) {
333 $selectedLines =
GETPOST(
'toselect',
'array:int');
338 $object->user_author_id = $user->id;
341 $object->ref_client = $ref_client;
348 if (!empty($origin) && !empty($originid)) {
351 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
352 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
354 $subelement = $regs[2];
358 if ($element ==
'order') {
359 $element = $subelement =
'commande';
361 if ($element ==
'propal') {
362 $element =
'comm/propal';
363 $subelement =
'propal';
365 if ($element ==
'contract') {
366 $element = $subelement =
'contrat';
370 $object->origin_id = $originid;
375 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
381 $ret = $extrafields->setOptionalsFromPost(
null, $object);
395 $classname = ucfirst($subelement);
396 $srcobject =
new $classname(
$db);
397 '@phan-var-force Commande|Propal|Contrat $srcobject';
401 $result = $srcobject->fetch(
$object->origin_id);
403 $srcobject->fetch_thirdparty();
404 $lines = $srcobject->lines;
405 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
406 $srcobject->fetch_lines();
407 $lines = $srcobject->lines;
410 if (is_array($lines)) {
411 $num = count($lines);
413 for ($i = 0; $i < $num; $i++) {
414 if (!in_array($lines[$i]->
id, $selectedLines)) {
424 if ($lines[$i]->fk_product > 0) {
426 $prod->id = $lines[$i]->fk_product;
430 $prod->getMultiLangs();
432 $prod->fetch($lines[$i]->fk_product);
433 $outputlangs = $langs;
435 if (
GETPOST(
'lang_id',
'aZ09')) {
436 $newlang =
GETPOST(
'lang_id',
'aZ09');
438 if (empty($newlang)) {
439 $newlang = $srcobject->thirdparty->default_lang;
441 if (!empty($newlang)) {
443 $outputlangs->setDefaultLang($newlang);
445 $label = (!empty(
$prod->multilangs[$outputlangs->defaultlang][
"label"])) ?
$prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
447 $prod->fetch($lines[$i]->fk_product);
448 $label = $lines[$i]->product_label;
452 switch (
$prod->duration_unit) {
467 $mult = 3600 * 24 * 7;
470 $mult = (int) (3600 * 24 * (365 / 12));
473 $mult = 3600 * 24 * 365;
476 $duration = (int) round(((
float)
$prod->duration_value) * $mult * $lines[$i]->qty);
479 $desc = $lines[$i]->product_ref;
488 if ($lines[$i]->fk_unit) {
489 $langs->load(
'measuring_units');
490 $unit_label = $langs->trans($lines[$i]->getLabelOfUnit(
'short'));
492 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.($unit_label ?
' '.$unit_label :
'').
')';
494 $source_date = (!empty($srcobject->delivery_date) ? $srcobject->delivery_date :
dol_now());
496 $date_intervention =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
505 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
506 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
525 $langs->load(
"errors");
531 $langs->load(
"errors");
538 $ret = $extrafields->setOptionalsFromPost(
null, $object);
546 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element);
548 $object->array_options = $array_options;
550 $result =
$object->create($user);
556 $categories =
GETPOST(
'categories',
'array');
557 $object->setCategories($categories);
559 $langs->load(
"errors");
567 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
571 } elseif ($action ==
'update' && $permissiontoadd) {
575 $object->user_author_id = $user->id;
578 $object->ref_client = $ref_client;
580 $result =
$object->update($user);
584 } elseif ($action ==
'classin' && $permissiontoadd) {
590 } elseif ($action ==
'setcontract' && $permissiontoadd) {
596 } elseif ($action ==
'settags' &&
isModEnabled(
'category') && $permissiontoadd) {
602 } elseif ($action ==
'setref_client' && $permissiontoadd) {
604 $result =
$object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
608 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
609 $result =
$object->delete($user);
614 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
616 } elseif ($action ==
'setdescription' && $permissiontoadd) {
617 $result =
$object->set_description($user,
GETPOST(
'description'));
621 } elseif ($action ==
"addline" && $permissiontoadd) {
624 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
628 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
632 $mesg = $langs->trans(
"ErrorValueTooHigh");
638 $desc =
GETPOST(
'np_desc',
'restricthtml');
643 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
644 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
656 $outputlangs = $langs;
659 $newlang =
GETPOST(
'lang_id',
'aZ09');
662 $newlang =
$object->thirdparty->default_lang;
664 if (!empty($newlang)) {
666 $outputlangs->setDefaultLang($newlang);
675 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
682 } elseif ($action ==
'confirm_addtitleline' && $permissiontoadd) {
685 $langs->load(
'subtotals');
687 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
688 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
690 $subtotal_options = array();
692 foreach (Fichinter::$TITLE_OPTIONS as $option) {
693 $value =
GETPOST($option,
'alphanohtml');
695 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
700 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
711 $outputlangs = $langs;
712 $newlang =
GETPOST(
'lang_id',
'alpha');
714 $newlang =
$object->thirdparty->default_lang;
716 if (!empty($newlang)) {
718 $outputlangs->setDefaultLang($newlang);
721 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
726 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
728 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
732 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
737 } elseif ($action ==
'classifyunbilled' && $permissiontoadd) {
741 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
746 } elseif ($action ==
'confirm_reopen' && $permissiontoadd) {
750 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
755 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save',
'alpha')) {
758 if ($objectline->fetch($lineid) <= 0) {
763 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
769 $desc =
GETPOST(
'np_desc',
'restricthtml');
773 $objectline->date = $date_inter;
774 $objectline->desc = $desc;
775 $objectline->duration = $duration;
778 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
779 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
780 if (is_array($array_options)) {
781 $objectline->array_options = array_merge($objectline->array_options, $array_options);
784 $result = $objectline->update($user);
793 $outputlangs = $langs;
796 $newlang =
GETPOST(
'lang_id',
'aZ09');
799 $newlang =
$object->thirdparty->default_lang;
801 if (!empty($newlang)) {
803 $outputlangs->setDefaultLang($newlang);
809 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
811 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
814 if ($objectline->fetch($lineid) <= 0) {
818 $result = $objectline->deleteLine($user);
820 if (
$object->fetch($objectline->fk_fichinter) <= 0) {
826 $outputlangs = $langs;
829 $newlang =
GETPOST(
'lang_id',
'aZ09');
832 $newlang =
$object->thirdparty->default_lang;
834 if (!empty($newlang)) {
836 $outputlangs->setDefaultLang($newlang);
841 } elseif ($action ==
'up' && $permissiontoadd) {
846 $outputlangs = $langs;
849 $newlang =
GETPOST(
'lang_id',
'aZ09');
852 $newlang =
$object->thirdparty->default_lang;
854 if (!empty($newlang)) {
856 $outputlangs->setDefaultLang($newlang);
862 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
864 } elseif ($action ==
'down' && $permissiontoadd) {
868 $outputlangs = $langs;
871 $newlang =
GETPOST(
'lang_id',
'aZ09');
874 $newlang =
$object->thirdparty->default_lang;
876 if (!empty($newlang)) {
878 $outputlangs->setDefaultLang($newlang);
884 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#'.$lineid);
889 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
892 $triggersendname =
'FICHINTER_SENTBYMAIL';
893 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
894 $trackid =
'int'.$object->id;
895 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
899 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
901 if ($action ==
'update_extras' && $permissiontoeditextra) {
904 $attribute_name =
GETPOST(
'attribute',
'aZ09');
907 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
914 $result =
$object->updateExtraField($attribute_name,
'FICHINTER_MODIFY');
922 $action =
'edit_extras';
927 if ($action ==
'addcontact' && $permissiontoadd) {
928 if ($result > 0 && $id > 0) {
931 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
935 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
938 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
939 $langs->load(
"errors");
940 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
945 } elseif ($action ==
'swapstatut' && $permissiontoadd) {
948 } elseif ($action ==
'deletecontact' && $permissiontoadd) {
953 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
978$title =
$object->ref .
" - " . $langs->trans(
'Card');
979if ($action ==
'create') {
980 $title = $langs->trans(
"NewIntervention");
982$help_url =
'EN:Module_Interventions|FR:Module_Fiches_d\'interventions';
984llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-fichinter page-card');
987if ($action ==
'create') {
993 print
load_fiche_titre($langs->trans(
"NewIntervention"),
'',
'intervention');
1004 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
1005 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
1006 $element = $regs[1];
1007 $subelement = $regs[2];
1010 if ($element ==
'project') {
1014 if ($element ==
'order' || $element ==
'commande') {
1015 $element = $subelement =
'commande';
1017 if ($element ==
'propal') {
1018 $element =
'comm/propal';
1019 $subelement =
'propal';
1021 if ($element ==
'contract') {
1022 $element = $subelement =
'contrat';
1027 $classname = ucfirst($subelement);
1028 $objectsrc =
new $classname(
$db);
1029 '@phan-var-force Commande|Propal|Contrat $objectsrc';
1031 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
1032 $objectsrc->fetch_lines();
1033 $lines = $objectsrc->lines;
1035 $objectsrc->fetch_thirdparty();
1037 $projectid = (int) $objectsrc->fk_project;
1039 $soc = $objectsrc->thirdparty;
1041 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
1042 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
1045 $objectsrc->fetch_optionals();
1046 $object->array_options = $objectsrc->array_options;
1049 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
1053 $note_private =
GETPOST(
"note_private",
"alpha");
1054 $note_public =
GETPOST(
"note_public",
"alpha");
1057 if (!
$conf->global->FICHEINTER_ADDON) {
1058 dol_print_error(
$db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
1070 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1071 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1072 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
1073 print
'<input type="hidden" name="action" value="add">';
1074 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">'.
"\n";
1075 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1079 print
'<table class="border centpercent">';
1082 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
1085 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
1086 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
1091 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
1094 print $soc->getNomUrl(1);
1095 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">';
1099 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
1100 $filter =
'(s.status:=:1)';
1101 print $form->select_company(
'',
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth150 widthcentpercentminusxx maxwidth500');
1102 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>';
1108 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1110 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
1117 $langs->load(
"project");
1119 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
1120 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1127 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth500 widthcentpercentminusxx');
1128 if ($numprojet == 0) {
1129 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>';
1137 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1138 print $form->selectCategories(Categorie::TYPE_FICHINTER,
'categories', $object);
1143 if (
isModEnabled(
'contract') && is_object($formcontract)) {
1147 $langs->load(
"contracts");
1148 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
1149 $numcontrat = $formcontract->select_contract($soc->id,
GETPOSTINT(
'contratid'),
'contratid', 0, 1, 1);
1150 if ($numcontrat == 0) {
1151 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>';
1159 if (count($liste) > 0) {
1161 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1163 print $form->selectarray(
'model', $liste,
getDolGlobalString(
'FICHEINTER_ADDON_PDF'));
1169 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
1171 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1172 print $doleditor->Create(1);
1177 if (empty($user->socid)) {
1179 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
1181 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1182 print $doleditor->Create(1);
1188 $parameters = array();
1189 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1190 print $hookmanager->resPrint;
1191 if (empty($reshook)) {
1192 print
$object->showOptionals($extrafields,
'create');
1196 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1197 $newclassname = $classname;
1198 if ($newclassname ==
'Propal') {
1199 $langs->load(
'propal');
1200 $newclassname =
'CommercialProposal';
1202 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1231 if (is_object($objectsrc)) {
1232 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1233 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1234 } elseif ($origin ==
'project' && !empty($projectid)) {
1235 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1240 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1243 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !
getDolGlobalInt(
'FICHINTER_DISABLE_DETAILS')) {
1244 $title = $langs->trans(
'Services');
1247 print
'<div class="div-table-responsive-no-min">';
1248 print
'<table class="noborder centpercent">';
1250 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1257} elseif ($id > 0 || !empty($ref)) {
1274 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
$object->picto, 0,
'',
'', 0,
'', 1);
1279 if ($action ==
'delete') {
1280 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1284 if ($action ==
'validate') {
1286 $ref = substr(
$object->ref, 1, 4);
1287 if ($ref ==
'PROV') {
1288 $numref =
$object->getNextNumRef($soc);
1289 if (empty($numref)) {
1296 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1298 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1301 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE',
$object->socid, $object);
1304 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1308 if ($action ==
'sign') {
1309 $text = $langs->trans(
'ConfirmSignIntervention');
1311 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1314 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1319 'name' =>
'signed_status',
1320 'select_show_empty' => 0,
1321 'label' =>
'<span class="fieldrequired">'.$langs->trans(
'SignStatus').
'</span>',
1322 'values' =>
$object->getSignedStatusLocalisedArray()
1324 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'SignIntervention'), $text,
'confirm_sign', $formquestion, 0, 1);
1328 if ($action ==
'unsign') {
1329 $text = $langs->trans(
'ConfirmUnsignIntervention');
1331 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1334 $text .= $notify->confirmMessage(
'FICHINTER_MODIFY',
$object->socid, $object);
1336 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'UnsignIntervention'), $text,
'confirm_unsign',
'', 0, 1);
1340 if ($action ==
'classifydone') {
1341 $text = $langs->trans(
'ConfirmCloseIntervention');
1343 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1346 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE',
$object->socid, $object);
1348 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1352 if ($action ==
'modify') {
1353 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1357 if ($action ==
'reopen') {
1358 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention',
$object->ref),
'confirm_reopen',
'', 0, 1);
1362 if ($action ==
'ask_deleteline') {
1363 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1367 if ($action ==
'clone') {
1369 $formquestion = array(
1375 'label' => $langs->trans(
"SelectThirdParty"),
1376 'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'',
'', 0, 0, array(), 0,
'minwidth200')
1379 'type' =>
'checkbox',
1380 'name' =>
'clone_contacts',
1381 'label' => $langs->trans(
"CloneContacts"),
1385 'type' =>
'checkbox',
1386 'name' =>
'clone_notes',
1387 'label' => $langs->trans(
"CloneNotes"),
1393 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1397 if ($action ==
'add_title_line') {
1398 $langs->load(
'subtotals');
1400 $depth_array =
$object->getPossibleLevels($langs);
1402 } elseif ($action ==
'add_subtotal_line') {
1403 $langs->load(
'subtotals');
1405 $titles =
$object->getPossibleTitles();
1409 if (!$formconfirm) {
1410 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1411 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1412 if (empty($reshook)) {
1413 $formconfirm .= $hookmanager->resPrint;
1414 } elseif ($reshook > 0) {
1415 $formconfirm = $hookmanager->resPrint;
1424 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1427 $morehtmlref =
'<div class="refidno">';
1429 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $permissiontoadd,
'string',
'', 0, 1);
1430 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client',
$object->ref_client, $object, $permissiontoadd,
'string',
'',
null,
null,
'', 1);
1432 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1435 $langs->load(
"projects");
1436 $morehtmlref .=
'<br>';
1437 if ($permissiontoadd) {
1438 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1439 if ($action !=
'classify') {
1440 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1442 $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');
1444 if (!empty(
$object->fk_project)) {
1446 $proj->fetch(
$object->fk_project);
1447 $morehtmlref .= $proj->getNomUrl(1);
1449 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1454 $morehtmlref .=
'</div>';
1456 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1459 print
'<div class="fichecenter">';
1460 print
'<div class="fichehalfleft">';
1461 print
'<div class="underbanner clearboth"></div>';
1463 print
'<table class="border tableforfield centpercent">';
1467 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1474 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1481 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1489 print
'<tr><td class="titlefield">';
1490 print $form->editfieldkey(
"Description",
'description',
$object->description, $object, $permissiontoadd,
'textarea');
1492 print $form->editfieldval(
"Description",
'description',
$object->description, $object, $permissiontoadd,
'textarea:8');
1499 print
'<table class="nobordernopadding centpercent"><tr><td>';
1500 print $langs->trans(
"Categories");
1501 print
'<td><td class="right">';
1502 if ($permissiontoadd) {
1503 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/fichinter/card.php?id='.
$object->id.
'&action=edittags&token='.
newToken().
'">'.
img_edit().
'</a>';
1507 print
'</td></tr></table>';
1510 if ($action ==
'edittags') {
1511 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
1512 print
'<input type="hidden" name="action" value="settags">';
1513 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1514 print $form->selectCategories(Categorie::TYPE_FICHINTER,
'categories', $object);
1515 print
'<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
1518 print $form->showCategories(
$object->id, Categorie::TYPE_FICHINTER, 1);
1528 $langs->load(
'contracts');
1532 print
'<table class="nobordernopadding centpercent"><tr><td>';
1533 print $langs->trans(
'Contract');
1535 if ($action !=
'editcontract') {
1536 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editcontract&id='.
$object->id.
'">';
1537 print
img_edit($langs->trans(
'SetContract'), 1);
1540 print
'</tr></table>';
1542 if ($action ==
'editcontract') {
1544 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contrat,
'contratid', 0, 1, 1);
1548 $contratstatic->fetch(
$object->fk_contrat);
1550 print $contratstatic->getNomUrl(0, 0, 1);
1562 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1567 print
'<div class="fichehalfright">';
1568 print
'<div class="underbanner clearboth"></div>';
1570 print
'<table class="border tableforfield centpercent">';
1574 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1584 print
'<div class="clearboth"></div><br>';
1588 $blocname =
'contacts';
1589 $title = $langs->trans(
'ContactsAddresses');
1590 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1594 $blocname =
'notes';
1595 $title = $langs->trans(
'Notes');
1596 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1601 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" name="addinter" method="post">';
1602 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1603 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1604 if ($action ==
'editline') {
1605 print
'<input type="hidden" name="action" value="updateline">';
1606 print
'<input type="hidden" name="line_id" value="'.GETPOSTINT(
'line_id').
'">';
1608 print
'<input type="hidden" name="action" value="addline">';
1610 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1613 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1614 $sql .=
' ft.special_code, ft.product_type, ft.extraparams,';
1615 $sql .=
' ft.date as date_intervention';
1616 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1617 $sql .=
' WHERE ft.fk_fichinter = '.((int)
$object->id);
1619 $sql .=
' AND ft.duree <> 0';
1621 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1623 $resql =
$db->query($sql);
1625 $num =
$db->num_rows($resql);
1630 print
'<table class="noborder centpercent">';
1631 print
'<tr class="liste_titre">';
1635 print
'<td width="5" class="center linecolnum"></td>';
1638 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1639 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1640 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1641 print
'<td class="liste_titre"> </td>';
1642 print
'<td class="liste_titre"> </td>';
1646 $objp =
$db->fetch_object($resql);
1649 if ($action !=
'editline' ||
GETPOSTINT(
'line_id') != $objp->rowid) {
1650 print
'<tr class="oddeven">';
1654 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1656 if (!empty($objp->special_code) || $objp->product_type == 9) {
1657 $line_color =
$object->getSubtotalColors($objp->duree);
1658 $line_options = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams,
true) : array();
1659 $line_options = $line_options[
'subtotal'] ?? array();
1660 print
'<td colspan="3" ><strong>'.dol_htmlentitiesbr($objp->description).
'</strong>';
1661 if (array_key_exists(
'titleshowuponpdf', $line_options)) {
1662 echo
' ' .
img_picto($langs->trans(
"ShowUPOnPDF"),
'invoicing');
1664 if (array_key_exists(
'titleshowtotalexludingvatonpdf', $line_options)) {
1665 echo
' <span title="' . $langs->trans(
"ShowTotalExludingVATOnPDF") .
'">%</span>';
1667 if (array_key_exists(
'titleforcepagebreak', $line_options)) {
1668 echo
' ' .
img_picto($langs->trans(
"ForcePageBreak"),
'file');
1673 print
'<a name="'.$objp->rowid.
'"></a>';
1677 $objectline->fetch($objp->rowid);
1678 $objectline->fetch_optionals();
1680 $extrafields->fetch_name_optionals_label($objectline->table_element);
1682 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'',
'1',
'line');
1683 if (!empty($temps)) {
1684 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objp->rowid.
'" name="extrafield_lines_area_'.$objp->rowid.
'">';
1700 if (
$object->status == 0 && $permissiontoadd) {
1701 print
'<td class="center">';
1702 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1705 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1708 print
'<td class="center">';
1711 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1715 if ($i < $num - 1) {
1716 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1723 print
'<td colspan="2"> </td>';
1730 if (
$object->status == 0 && $action ==
'editline' && $permissiontoadd &&
GETPOSTINT(
'line_id') == $objp->rowid) {
1731 print
'<tr class="oddeven nohover">';
1735 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1739 print
'<a name="'.$objp->rowid.
'"></a>';
1742 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1743 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1744 $doleditor->Create();
1747 $objectline->fetch($objp->rowid);
1748 $objectline->fetch_optionals();
1750 $extrafields->fetch_name_optionals_label($objectline->table_element);
1752 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'',
'1',
'line');
1753 if (!empty($temps)) {
1754 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$objectline->id.
'" name="extrafield_lines_area_'.$objectline->id.
'">';
1762 print
'<td class="center nowrap">';
1764 print $form->selectDate(
$db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1766 print $form->selectDate(
$db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1771 print
'<td class="right">';
1773 $selectmode =
'select';
1775 $selectmode =
'text';
1777 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1781 print
'<td class="center" colspan="5" valign="center">';
1782 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1783 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1796 print
'<table class="noborder centpercent">';
1797 print
'<tr class="liste_titre">';
1801 print
'<td width="5" class="center linecolnum"></td>';
1805 print
'<a name="add"></a>';
1806 print $langs->trans(
'Description').
'</td>';
1807 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1808 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1809 print
'<td colspan="3"> </td>';
1813 print
'<tr class="oddeven nohover">'.
"\n";
1817 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1823 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1824 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1825 $doleditor->Create();
1829 $extrafields->fetch_name_optionals_label($objectline->table_element);
1831 if (is_object($objectline)) {
1832 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'',
'1',
'line');
1834 if (!empty($temps)) {
1835 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1844 print
'<td class="center nowrap">';
1849 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1851 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1857 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1859 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1864 print
'<td class="right">';
1866 $selectmode =
'select';
1868 $selectmode =
'text';
1874 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1889 print
'</form>'.
"\n";
1901 print
'<div class="tabsAction">';
1903 $parameters = array();
1904 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1906 if (empty($reshook)) {
1908 if ($user->socid == 0) {
1909 if ($action !=
'editdescription' && ($action !=
'presend')) {
1912 $langs->load(
'subtotals');
1914 $url_button = array();
1915 $url_button[] = array(
1916 'lang' =>
'subtotals',
1918 'perm' => (
bool) $permissiontoadd,
1919 'label' => $langs->trans(
'AddTitleLine'),
1920 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_title_line&token='.
newToken()
1923 $url_button[] = array(
1924 'lang' =>
'subtotals',
1926 'perm' => (
bool) $permissiontoadd,
1927 'label' => $langs->trans(
'AddSubtotalLine'),
1928 'url' =>
'/fichinter/card.php?id='.$object->id.
'&action=add_subtotal_line&token='.
newToken()
1930 print
dolGetButtonAction(
'', $langs->trans(
'SubTotal'),
'default', $url_button,
'',
true);
1935 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1936 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a></div>';
1938 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1944 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify&token='.
newToken().
'">';
1946 print $langs->trans(
"Modify");
1948 print $langs->trans(
"SetToDraft");
1955 if ($permissiontoadd) {
1956 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>';
1958 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1963 if (empty($user->socid)) {
1965 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1966 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
1975 print
'<div class="inline-block divButAction">';
1976 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>';
1980 $arrayofcreatebutton = array();
1983 $langs->load(
"propal");
1985 $arrayofcreatebutton[] = array(
1986 'url' =>
'/comm/propal/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
1987 'label' => $langs->trans(
'AddProp'),
1989 'perm' => $user->hasRight(
'propal',
'creer'),
1997 $langs->load(
"bills");
1999 $arrayofcreatebutton[] = array(
2000 'url' =>
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
2001 'label' => $langs->trans(
'AddBill'),
2003 'perm' => $user->hasRight(
'facture',
'creer') ?
true : false,
2010 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>';
2012 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>';
2017 if (count($arrayofcreatebutton)) {
2018 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayofcreatebutton,
'',
true, $params);
2023 if (
$object->signed_status != Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_ALL']) {
2024 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>';
2026 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>';
2032 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>';
2036 if ($permissiontoadd) {
2037 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>';
2041 print
'<div class="inline-block divButAction">';
2042 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
2051 if (
GETPOST(
'modelselected')) {
2052 $action =
'presend';
2055 if ($action !=
'presend') {
2056 print
'<div class="fichecenter"><div class="fichehalfleft">';
2063 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2064 $genallowed = $permissiontoread;
2065 $delallowed = $permissiontoadd;
2066 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang,
'', $object);
2069 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'fichinter'), 1);
2070 $linktoelem = $tmparray[
'linktoelem'];
2071 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2072 print $htmltoenteralink;
2074 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2078 print
'<br><!-- Link to download main doc -->'.
"\n";
2084 print
'<br><!-- Link to sign -->';
2085 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2087 print showOnlineSignatureUrl(
'fichinter',
$object->ref, $object).
'<br>';
2090 print
'</div><div class="fichehalfright">';
2094 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id);
2097 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2099 $somethingshown = $formactions->showactions($object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
2101 print
'</div></div>';
2105 $modelmail =
'fichinter_send';
2106 $defaulttopic =
'SendInterventionRef';
2107 $diroutput =
$conf->ficheinter->multidir_output[
$object->entity];
2108 $trackid =
'int'.$object->id;
2110 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
const STATUS_BILLED
Billed.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
const STATUS_CLOSED
Closed.
Class to manage intervention lines.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage the table of subscription to notifications.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
convertDurationtoHour($duration_value, $duration_unit)
Convert duration to hour.
convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0)
Convert hours and minutes into seconds.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
fichinter_prepare_head($object)
Prepare array with list of tabs.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
showDirectDownloadLink($object)
Return string with full Url.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Create an intervention document on disk using template defined into FICHEINTER_ADDON_PDF.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.