34 require
'../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
45 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcontract.class.php";
46 require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
48 if (!empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
".php")) {
49 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
'.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
55 $langs->loadLangs(array(
'bills',
'companies',
'interventions',
'stocks'));
59 $ref_client =
GETPOST(
'ref_client',
'alpha');
60 $socid = (int)
GETPOST(
'socid',
'int');
61 $contratid = (int)
GETPOST(
'contratid',
'int');
62 $action =
GETPOST(
'action',
'alpha');
63 $cancel =
GETPOST(
'cancel',
'alpha');
64 $confirm =
GETPOST(
'confirm',
'alpha');
65 $mesg =
GETPOST(
'msg',
'alpha');
66 $origin =
GETPOST(
'origin',
'alpha');
68 $note_public =
GETPOST(
'note_public',
'restricthtml');
69 $note_private =
GETPOST(
'note_private',
'restricthtml');
70 $lineid =
GETPOST(
'line_id',
'int');
75 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
76 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
77 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
80 $hookmanager->initHooks(array(
'interventioncard',
'globalcard'));
86 $extrafields->fetch_name_optionals_label($object->table_element);
89 if ($id > 0 || !empty($ref)) {
90 $ret = $object->fetch($id, $ref);
92 $ret = $object->fetch_thirdparty();
101 $socid = $user->socid;
105 $permissionnote = $user->rights->ficheinter->creer;
106 $permissiondellink = $user->rights->ficheinter->creer;
107 $permissiontodelete = (($object->statut ==
Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer);
115 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
120 if (empty($reshook)) {
121 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
123 if (empty($backtopage) || ($cancel && empty($id))) {
124 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
125 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
126 $backtopage = $backurlforlist;
128 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
134 if (!empty($backtopageforcancel)) {
135 header(
"Location: ".$backtopageforcancel);
137 } elseif (!empty($backtopage)) {
138 header(
"Location: ".$backtopage);
144 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
146 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
149 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
150 if (1 == 0 && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
153 if ($object->id > 0) {
155 $orig = clone $object;
157 $result = $object->createFromClone($user, $socid);
159 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
170 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
171 $result = $object->setValid($user);
174 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
176 $outputlangs = $langs;
179 $newlang =
GETPOST(
'lang_id',
'aZ09');
182 $newlang = $object->thirdparty->default_lang;
184 if (!empty($newlang)) {
186 $outputlangs->setDefaultLang($newlang);
191 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
194 $mesg = $object->error;
196 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
197 $result = $object->setDraft($user);
199 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
201 $outputlangs = $langs;
204 $newlang =
GETPOST(
'lang_id',
'aZ09');
207 $newlang = $object->thirdparty->default_lang;
209 if (!empty($newlang)) {
211 $outputlangs->setDefaultLang($newlang);
216 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
219 $mesg = $object->error;
221 } elseif ($action ==
'add' && $user->rights->ficheinter->creer) {
222 $selectedLines =
GETPOST(
'toselect',
'array');
223 $object->socid = $socid;
224 $object->duration = (int)
GETPOST(
'duration',
'int');
225 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
226 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
227 $object->author = $user->id;
228 $object->description =
GETPOST(
'description',
'restricthtml');
230 $object->ref_client = $ref_client;
231 $object->model_pdf =
GETPOST(
'model',
'alpha');
232 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
233 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
235 if ($object->socid > 0) {
237 if (!empty($origin) && !empty($originid)) {
240 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
241 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
243 $subelement = $regs[2];
247 if ($element ==
'order') {
248 $element = $subelement =
'commande';
250 if ($element ==
'propal') {
251 $element =
'comm/propal'; $subelement =
'propal';
253 if ($element ==
'contract') {
254 $element = $subelement =
'contrat';
257 $object->origin = $origin;
258 $object->origin_id = $originid;
261 $object->linked_objects[$object->origin] = $object->origin_id;
262 if (is_array($_POST[
'other_linked_objects']) && !empty($_POST[
'other_linked_objects'])) {
263 $object->linked_objects = array_merge($object->linked_objects, $_POST[
'other_linked_objects']);
269 $ret = $extrafields->setOptionalsFromPost(
null, $object);
278 $id = $object->create($user);
283 $classname = ucfirst($subelement);
284 $srcobject =
new $classname($db);
286 dol_syslog(
"Try to find source object origin=".$object->origin.
" originid=".$object->origin_id.
" to add lines");
287 $result = $srcobject->fetch($object->origin_id);
289 $srcobject->fetch_thirdparty();
290 $lines = $srcobject->lines;
291 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
292 $srcobject->fetch_lines();
293 $lines = $srcobject->lines;
296 if (is_array($lines)) {
297 $num = count($lines);
299 for ($i = 0; $i < $num; $i++) {
300 if (!in_array($lines[$i]->
id, $selectedLines)) {
310 if ($lines[$i]->fk_product > 0) {
312 $prod->id = $lines[$i]->fk_product;
315 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
316 $prod->getMultiLangs();
318 $prod->fetch($lines[$i]->fk_product);
319 $outputlangs = $langs;
321 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
322 $newlang =
GETPOST(
'lang_id',
'aZ09');
324 if (empty($newlang)) {
325 $newlang = $srcobject->thirdparty->default_lang;
327 if (!empty($newlang)) {
329 $outputlangs->setDefaultLang($newlang);
331 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
333 $prod->fetch($lines[$i]->fk_product);
334 $label = $lines[$i]->product_label;
337 if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
338 switch ($prod->duration_unit) {
347 $mult = 3600 * 24 * 7;
350 $mult = (int) 3600 * 24 * (365 / 12);
353 $mult = 3600 * 24 * 365;
356 $duration = $prod->duration_value * $mult * $lines[$i]->qty;
359 $desc = $lines[$i]->product_ref;
367 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
370 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
379 $extrafields->fetch_name_optionals_label($object->table_element_line);
380 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
382 $result = $object->addline(
399 $langs->load(
"errors");
405 $langs->load(
"errors");
412 $ret = $extrafields->setOptionalsFromPost(
null, $object);
420 $array_options = $extrafields->getOptionalsFromPost($object->table_element);
422 $object->array_options = $array_options;
424 $result = $object->create($user);
428 $langs->load(
"errors");
436 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
440 } elseif ($action ==
'update' && $user->rights->ficheinter->creer) {
441 $object->socid = $socid;
442 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
443 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
444 $object->author = $user->id;
445 $object->description =
GETPOST(
'description',
'restricthtml');
447 $object->ref_client = $ref_client;
449 $result = $object->update($user);
453 } elseif ($action ==
'classin' && $user->rights->ficheinter->creer) {
455 $result = $object->setProject(
GETPOST(
'projectid',
'int'));
459 } elseif ($action ==
'setcontract' && $user->rights->contrat->creer) {
461 $result = $object->set_contrat($user,
GETPOST(
'contratid',
'int'));
465 } elseif ($action ==
'setref_client' && $user->rights->ficheinter->creer) {
467 $result = $object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
471 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->ficheinter->supprimer) {
472 $result = $object->delete($user);
477 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
479 } elseif ($action ==
'setdescription' && $user->rights->ficheinter->creer) {
480 $result = $object->set_description($user,
GETPOST(
'description'));
484 } elseif ($action ==
"addline" && $user->rights->ficheinter->creer) {
486 if (!
GETPOST(
'np_desc',
'restricthtml') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
487 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
490 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && !
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) {
491 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
494 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) &&
GETPOST(
'durationhour',
'int') >= 24 &&
GETPOST(
'durationmin',
'int') > 0) {
495 $mesg = $langs->trans(
"ErrorValueTooHigh");
501 $desc =
GETPOST(
'np_desc',
'restricthtml');
502 $date_intervention =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
506 $extrafields->fetch_name_optionals_label($object->table_element_line);
507 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
509 $result = $object->addline(
519 $outputlangs = $langs;
522 $newlang =
GETPOST(
'lang_id',
'aZ09');
525 $newlang = $object->thirdparty->default_lang;
527 if (!empty($newlang)) {
529 $outputlangs->setDefaultLang($newlang);
535 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
538 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
541 $mesg = $object->error;
545 } elseif ($action ==
'classifybilled' && $user->rights->ficheinter->creer) {
549 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
554 } elseif ($action ==
'classifyunbilled' && $user->rights->ficheinter->creer) {
558 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
561 $mesg = $object->error;
563 } elseif ($action ==
'classifydone' && $user->rights->ficheinter->creer) {
567 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
572 } elseif ($action ==
'confirm_reopen' && $user->rights->ficheinter->creer) {
576 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
579 $mesg = $object->error;
581 } elseif ($action ==
'updateline' && $user->rights->ficheinter->creer &&
GETPOST(
'save',
'alpha')) {
584 if ($objectline->fetch($lineid) <= 0) {
589 if ($object->fetch($objectline->fk_fichinter) <= 0) {
593 $object->fetch_thirdparty();
595 $desc =
GETPOST(
'np_desc',
'restricthtml');
596 $date_inter =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
599 $objectline->date = $date_inter;
600 $objectline->desc = $desc;
601 $objectline->duration = $duration;
604 $extrafields->fetch_name_optionals_label($object->table_element_line);
605 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
606 $objectline->array_options = $array_options;
608 $result = $objectline->update($user);
615 $outputlangs = $langs;
618 $newlang =
GETPOST(
'lang_id',
'aZ09');
621 $newlang = $object->thirdparty->default_lang;
623 if (!empty($newlang)) {
625 $outputlangs->setDefaultLang($newlang);
627 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
631 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
633 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
636 if ($objectline->fetch($lineid) <= 0) {
640 $result = $objectline->deleteline($user);
642 if ($object->fetch($objectline->fk_fichinter) <= 0) {
648 $outputlangs = $langs;
651 $newlang =
GETPOST(
'lang_id',
'aZ09');
654 $newlang = $object->thirdparty->default_lang;
656 if (!empty($newlang)) {
658 $outputlangs->setDefaultLang($newlang);
660 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
663 } elseif ($action ==
'up' && $user->rights->ficheinter->creer) {
665 $object->line_up($lineid);
668 $outputlangs = $langs;
671 $newlang =
GETPOST(
'lang_id',
'aZ09');
674 $newlang = $object->thirdparty->default_lang;
676 if (!empty($newlang)) {
678 $outputlangs->setDefaultLang($newlang);
680 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
684 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
686 } elseif ($action ==
'down' && $user->rights->ficheinter->creer) {
687 $object->line_down($lineid);
690 $outputlangs = $langs;
693 $newlang =
GETPOST(
'lang_id',
'aZ09');
696 $newlang = $object->thirdparty->default_lang;
698 if (!empty($newlang)) {
700 $outputlangs->setDefaultLang($newlang);
702 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
706 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
711 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
714 $triggersendname =
'FICHINTER_SENTBYMAIL';
715 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
716 $trackid =
'int'.$object->id;
717 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
720 $upload_dir = $conf->ficheinter->dir_output;
721 $permissiontoadd = $user->rights->ficheinter->creer;
722 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
724 if ($action ==
'update_extras') {
728 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
735 $result = $object->insertExtraFields(
'INTERVENTION_MODIFY');
743 $action =
'edit_extras';
747 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer) {
748 if ($action ==
'addcontact') {
749 if ($result > 0 && $id > 0) {
752 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
756 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
759 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
760 $langs->load(
"errors");
761 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
763 $mesg = $object->error;
766 } elseif ($action ==
'swapstatut') {
768 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
769 } elseif ($action ==
'deletecontact') {
771 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
774 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
802 if ($action ==
'create') {
807 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
816 $res = $soc->fetch($socid);
819 if (
GETPOST(
'origin',
'alphanohtml') &&
GETPOST(
'originid',
'int')) {
822 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
823 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
825 $subelement = $regs[2];
828 if ($element ==
'project') {
829 $projectid =
GETPOST(
'originid',
'int');
832 if ($element ==
'order' || $element ==
'commande') {
833 $element = $subelement =
'commande';
835 if ($element ==
'propal') {
836 $element =
'comm/propal'; $subelement =
'propal';
838 if ($element ==
'contract') {
839 $element = $subelement =
'contrat';
844 $classname = ucfirst($subelement);
845 $objectsrc =
new $classname($db);
846 $objectsrc->fetch(
GETPOST(
'originid'));
847 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
848 $objectsrc->fetch_lines();
849 $lines = $objectsrc->lines;
851 $objectsrc->fetch_thirdparty();
853 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
855 $soc = $objectsrc->thirdparty;
857 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
858 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
861 $objectsrc->fetch_optionals();
862 $object->array_options = $objectsrc->array_options;
865 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
868 $projectid =
GETPOST(
'projectid',
'int');
871 if (!$conf->global->FICHEINTER_ADDON) {
872 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
878 $obj = $conf->global->FICHEINTER_ADDON;
888 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
889 print
'<input type="hidden" name="token" value="'.newToken().
'">';
890 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
891 print
'<input type="hidden" name="action" value="add">';
895 print
'<table class="border centpercent">';
897 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
900 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
903 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
904 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
908 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
910 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
917 $langs->load(
"project");
919 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
926 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
927 if ($numprojet == 0) {
928 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.$soc->id.
'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProject").
'"></span></a>';
935 $langs->load(
"contracts");
936 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
937 $numcontrat = $formcontract->select_contract($soc->id,
GETPOST(
'contratid',
'int'),
'contratid', 0, 1, 1);
938 if ($numcontrat == 0) {
939 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>';
946 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
949 print
$form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
954 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
956 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3,
'90%');
957 print $doleditor->Create(1);
962 if (empty($user->socid)) {
964 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
966 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3,
'90%');
967 print $doleditor->Create(1);
974 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
975 print $hookmanager->resPrint;
976 if (empty($reshook)) {
977 print $object->showOptionals($extrafields,
'create');
981 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
982 $newclassname = $classname;
983 if ($newclassname ==
'Propal') {
984 $newclassname =
'CommercialProposal';
986 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1015 if (is_object($objectsrc)) {
1016 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1017 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1018 } elseif ($origin ==
'project' && !empty($projectid)) {
1019 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1024 print
$form->buttonsSaveCancel(
"CreateDraftIntervention");
1027 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1028 $title = $langs->trans(
'Services');
1031 print
'<div class="div-table-responsive-no-min">';
1032 print
'<table class="noborder centpercent">';
1034 $objectsrc->printOriginLinesList(empty($conf->global->FICHINTER_PRINT_PRODUCTS) ?
'services' :
'');
1042 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1043 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1044 print
'<input type="hidden" name="action" value="create">';
1048 if (is_object($objectsrc)) {
1049 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1050 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1051 } elseif ($origin ==
'project' && !empty($projectid)) {
1052 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1054 print
'<table class="border centpercent">';
1055 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1056 print
$form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0,
null, 0,
'minwidth300');
1057 print
' <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
1063 print
$form->buttonsSaveCancel(
"CreateDraftIntervention");
1067 } elseif ($id > 0 || !empty($ref)) {
1070 $object->fetch($id, $ref);
1071 $object->fetch_thirdparty();
1074 $soc->fetch($object->socid);
1084 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1089 if ($action ==
'delete') {
1090 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1094 if ($action ==
'validate') {
1096 $ref = substr($object->ref, 1, 4);
1097 if ($ref ==
'PROV') {
1098 $numref = $object->getNextNumRef($soc);
1099 if (empty($numref)) {
1104 $numref = $object->ref;
1106 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1108 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1112 if ($action ==
'modify') {
1113 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1117 if ($action ==
'reopen') {
1118 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention', $object->ref),
'confirm_reopen',
'', 0, 1);
1122 if ($action ==
'ask_deleteline') {
1123 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1127 if ($action ==
'clone') {
1129 $formquestion = array(
1135 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' =>
$form->select_company(
GETPOST(
'socid',
'int'),
'socid',
'',
'', 0, 0,
null, 0,
'minwidth200')));
1137 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1142 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1143 if (empty($reshook)) {
1145 } elseif ($reshook > 0) {
1155 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1158 $morehtmlref =
'<div class="refidno">';
1160 $morehtmlref.=
$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'', 0, 1);
1161 $morehtmlref.=
$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'',
null,
null,
'', 1);
1163 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1166 $langs->load(
"projects");
1167 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
1168 if ($user->rights->ficheinter->creer) {
1169 if ($action !=
'classify') {
1170 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
1172 if ($action ==
'classify') {
1174 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
1175 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
1176 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1177 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
1178 $morehtmlref .=
'<input type="submit" class="button button-edit valignmiddle" value="'.$langs->trans(
"Modify").
'">';
1179 $morehtmlref .=
'</form>';
1181 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
1184 if (!empty($object->fk_project)) {
1186 $proj->fetch($object->fk_project);
1187 $morehtmlref .=
' : '.$proj->getNomUrl(1);
1189 $morehtmlref .=
' - '.$proj->title;
1196 $morehtmlref .=
'</div>';
1198 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1201 print
'<div class="fichecenter">';
1202 print
'<div class="fichehalfleft">';
1203 print
'<div class="underbanner clearboth"></div>';
1205 print
'<table class="border tableforfield centpercent">';
1207 if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) {
1209 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1211 print $object->dateo ?
dol_print_date($object->dateo,
'daytext') :
' ';
1216 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1218 print $object->datee ?
dol_print_date($object->datee,
'daytext') :
' ';
1223 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1225 print $object->datet ?
dol_print_date($object->datet,
'daytext') :
' ';
1231 print
'<tr><td class="titlefield">';
1232 print
$form->editfieldkey(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea');
1234 print
$form->editfieldval(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea:8');
1240 $langs->load(
'contracts');
1244 print
'<table class="nobordernopadding centpercent"><tr><td>';
1245 print $langs->trans(
'Contract');
1247 if ($action !=
'contrat') {
1248 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.$object->id.
'">';
1249 print
img_edit($langs->trans(
'SetContract'), 1);
1252 print
'</tr></table>';
1254 if ($action ==
'contrat') {
1255 $formcontract =
new Formcontract($db);
1256 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contrat,
'contratid', 0, 1, 1);
1258 if ($object->fk_contrat) {
1259 $contratstatic =
new Contrat($db);
1260 $contratstatic->fetch($object->fk_contrat);
1262 print $contratstatic->getNomUrl(0,
'', 1);
1273 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1278 print
'<div class="fichehalfright">';
1279 print
'<div class="underbanner clearboth"></div>';
1281 print
'<table class="border tableforfield centpercent">';
1283 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1285 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1286 print
'<td>'.convertSecondToTime($object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1295 print
'<div class="clearboth"></div><br>';
1298 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
1299 $blocname =
'contacts';
1300 $title = $langs->trans(
'ContactsAddresses');
1301 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1304 if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
1305 $blocname =
'notes';
1306 $title = $langs->trans(
'Notes');
1307 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1311 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1312 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" name="addinter" method="post">';
1313 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1314 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1315 if ($action ==
'editline') {
1316 print
'<input type="hidden" name="action" value="updateline">';
1317 print
'<input type="hidden" name="line_id" value="'.GETPOST(
'line_id',
'int').
'">';
1319 print
'<input type="hidden" name="action" value="addline">';
1323 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1324 $sql .=
' ft.date as date_intervention';
1325 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1326 $sql .=
' WHERE ft.fk_fichinter = '.((int) $object->id);
1327 if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) {
1328 $sql .=
' AND ft.duree <> 0';
1330 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1332 $resql = $db->query($sql);
1334 $num = $db->num_rows(
$resql);
1339 print
'<table class="noborder centpercent">';
1340 print
'<tr class="liste_titre">';
1343 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1344 print
'<td width="5" class="center linecolnum"></td>';
1347 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1348 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1349 print
'<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1350 print
'<td class="liste_titre"> </td>';
1351 print
'<td class="liste_titre"> </td>';
1355 $objp = $db->fetch_object(
$resql);
1358 if ($action !=
'editline' ||
GETPOST(
'line_id',
'int') != $objp->rowid) {
1359 print
'<tr class="oddeven">';
1362 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1363 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1367 print
'<a name="'.$objp->rowid.
'"></a>';
1371 $objectline->fetch($objp->rowid);
1372 $objectline->fetch_optionals();
1374 $extrafields->fetch_name_optionals_label($objectline->table_element);
1376 if (!empty($extrafields)) {
1377 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1378 if (!empty($temps)) {
1379 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1388 print
'<td class="center" width="150">'.(empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR) ?
dol_print_date($db->jdate($objp->date_intervention),
'dayhour') :
dol_print_date($db->jdate($objp->date_intervention),
'day')).
'</td>';
1391 print
'<td class="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ?
convertSecondToTime($objp->duree) :
'').
'</td>';
1396 if ($object->statut == 0 && $user->rights->ficheinter->creer) {
1397 print
'<td class="center">';
1398 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1401 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1404 print
'<td class="center">';
1407 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1411 if ($i < $num - 1) {
1412 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1419 print
'<td colspan="2"> </td>';
1426 if ($object->statut == 0 && $action ==
'editline' && $user->rights->ficheinter->creer &&
GETPOST(
'line_id',
'int') == $objp->rowid) {
1427 print
'<tr class="oddeven nohover">';
1430 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1431 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1435 print
'<a name="'.$objp->rowid.
'"></a>';
1438 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1439 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1440 $doleditor->Create();
1443 $objectline->fetch($objp->rowid);
1444 $objectline->fetch_optionals();
1446 $extrafields->fetch_name_optionals_label($objectline->table_element);
1448 if (!empty($extrafields)) {
1449 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1450 if (!empty($temps)) {
1451 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1460 print
'<td class="center nowrap">';
1461 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1462 print
$form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1464 print
$form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1469 print
'<td class="right">';
1470 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1471 $selectmode =
'select';
1472 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1473 $selectmode =
'text';
1475 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1479 print
'<td class="center" colspan="5" valign="center">';
1480 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1481 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1491 if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <>
'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1494 print
'<table class="noborder centpercent">';
1495 print
'<tr class="liste_titre">';
1498 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1499 print
'<td width="5" class="center linecolnum"></td>';
1503 print
'<a name="add"></a>';
1504 print $langs->trans(
'Description').
'</td>';
1505 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1506 print
'<td class="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1507 print
'<td colspan="3"> </td>';
1511 print
'<tr class="oddeven nohover">'.
"\n";
1514 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1515 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1520 if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
1521 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1522 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true, !empty($conf->global->FCKEDITOR_ENABLE_DETAILS), ROWS_2,
'90%');
1523 $doleditor->Create();
1527 $extrafields->fetch_name_optionals_label($objectline->table_element);
1529 if (is_object($objectline)) {
1530 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1532 if (!empty($temps)) {
1533 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1542 print
'<td class="center nowrap">';
1545 if (!
GETPOST(
'diday',
'int')) {
1546 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1548 $timewithnohour =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
1550 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1551 print
$form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1553 print
$form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1558 print
'<td class="right">';
1559 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1560 $selectmode =
'select';
1561 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1562 $selectmode =
'text';
1564 $form->select_duration(
'duration', (!
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) ? 3600 : (60 * 60 *
GETPOST(
'durationhour',
'int') + 60 *
GETPOST(
'durationmin',
'int')), 0, $selectmode);
1568 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1583 print
'</form>'.
"\n";
1595 print
'<div class="tabsAction">';
1598 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1600 if (empty($reshook)) {
1601 if ($user->socid == 0) {
1602 if ($action !=
'editdescription' && ($action !=
'presend')) {
1604 if ($object->statut ==
Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
1605 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) {
1606 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate">'.$langs->trans(
"Validate").
'</a></div>';
1608 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1613 if ($object->statut ==
Fichinter::STATUS_VALIDATED && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate))) {
1614 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify">';
1615 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1616 print $langs->trans(
"Modify");
1618 print $langs->trans(
"SetToDraft");
1625 if ($user->rights->ficheinter->creer) {
1626 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>';
1628 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'Reopen').
'</a></div>';
1633 if (empty($user->socid)) {
1635 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) {
1636 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&token='.
newToken().
'&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a></div>';
1638 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1644 if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut ==
Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
1645 print
'<div class="inline-block divButAction">';
1646 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>';
1652 $langs->load(
"propal");
1654 if ($user->rights->propal->creer) {
1655 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin='.$object->element.
'&originid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddProp").
'</a></div>';
1657 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddProp").
'</a></div>';
1664 $langs->load(
"bills");
1666 if ($user->rights->facture->creer) {
1667 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.$object->element.
'&originid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddBill").
'</a></div>';
1669 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddBill").
'</a></div>';
1673 if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
1675 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>';
1677 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>';
1684 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>';
1688 if ($user->rights->ficheinter->creer) {
1689 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&socid='.$object->socid.
'&action=clone&token='.
newToken().
'&object=ficheinter">'.$langs->trans(
"ToClone").
'</a></div>';
1693 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
1700 if ($action !=
'presend') {
1701 print
'<div class="fichecenter"><div class="fichehalfleft">';
1707 $filedir = $conf->ficheinter->dir_output.
"/".$filename;
1708 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1709 $genallowed = $user->rights->ficheinter->lire;
1710 $delallowed = $user->rights->ficheinter->creer;
1711 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1714 $linktoelem =
$form->showLinkToObjectBlock($object,
null, array(
'fichinter'));
1715 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
1719 print
'<br><!-- Link to download main doc -->'.
"\n";
1725 print
'<br><!-- Link to sign -->';
1726 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1728 print showOnlineSignatureUrl(
'fichinter', $object->ref).
'<br>';
1731 print
'</div><div class="fichehalfright">';
1734 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1736 $somethingshown =
$formactions->showactions($object,
'fichinter', $socid, 1);
1738 print
'</div></div>';
1743 if (
GETPOST(
'modelselected')) {
1744 $action =
'presend';
1748 $modelmail =
'fichinter_send';
1749 $defaulttopic =
'SendInterventionRef';
1750 $diroutput = $conf->ficheinter->dir_output;
1751 $trackid =
'int'.$object->id;
1753 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';