33 require
'../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39 if (!empty($conf->project->enabled)) {
40 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
44 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcontract.class.php";
45 require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
47 if (!empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
".php")) {
48 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
'.php';
50 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
54 $langs->loadLangs(array(
'bills',
'companies',
'interventions',
'stocks'));
58 $ref_client =
GETPOST(
'ref_client',
'alpha');
59 $socid = (int)
GETPOST(
'socid',
'int');
60 $contratid = (int)
GETPOST(
'contratid',
'int');
61 $action =
GETPOST(
'action',
'alpha');
62 $cancel =
GETPOST(
'cancel',
'alpha');
63 $confirm =
GETPOST(
'confirm',
'alpha');
64 $mesg =
GETPOST(
'msg',
'alpha');
65 $origin =
GETPOST(
'origin',
'alpha');
67 $note_public =
GETPOST(
'note_public',
'restricthtml');
68 $note_private =
GETPOST(
'note_private',
'restricthtml');
69 $lineid =
GETPOST(
'line_id',
'int');
74 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
75 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
76 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
79 $hookmanager->initHooks(array(
'interventioncard',
'globalcard'));
85 $extrafields->fetch_name_optionals_label($object->table_element);
88 if ($id > 0 || !empty($ref)) {
89 $ret = $object->fetch($id, $ref);
91 $ret = $object->fetch_thirdparty();
100 $socid = $user->socid;
104 $permissionnote = $user->rights->ficheinter->creer;
105 $permissiondellink = $user->rights->ficheinter->creer;
113 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
118 if (empty($reshook)) {
119 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
121 if (empty($backtopage) || ($cancel && empty($id))) {
122 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
123 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
124 $backtopage = $backurlforlist;
126 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
132 if (!empty($backtopageforcancel)) {
133 header(
"Location: ".$backtopageforcancel);
135 } elseif (!empty($backtopage)) {
136 header(
"Location: ".$backtopage);
142 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
144 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
147 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
148 if (1 == 0 && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
151 if ($object->id > 0) {
153 $orig = clone $object;
155 $result = $object->createFromClone($user, $socid);
157 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
168 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
169 $result = $object->setValid($user);
172 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
174 $outputlangs = $langs;
176 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
177 $newlang =
GETPOST(
'lang_id',
'aZ09');
179 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
180 $newlang = $object->thirdparty->default_lang;
182 if (!empty($newlang)) {
184 $outputlangs->setDefaultLang($newlang);
189 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
192 $mesg = $object->error;
194 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
195 $result = $object->setDraft($user);
197 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
199 $outputlangs = $langs;
201 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
202 $newlang =
GETPOST(
'lang_id',
'aZ09');
204 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
205 $newlang = $object->thirdparty->default_lang;
207 if (!empty($newlang)) {
209 $outputlangs->setDefaultLang($newlang);
214 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
217 $mesg = $object->error;
219 } elseif ($action ==
'add' && $user->rights->ficheinter->creer) {
220 $selectedLines =
GETPOST(
'toselect',
'array');
221 $object->socid = $socid;
222 $object->duration = (int)
GETPOST(
'duration',
'int');
223 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
224 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
225 $object->author = $user->id;
226 $object->description =
GETPOST(
'description',
'restricthtml');
228 $object->ref_client = $ref_client;
229 $object->model_pdf =
GETPOST(
'model',
'alpha');
230 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
231 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
233 if ($object->socid > 0) {
235 if (!empty($origin) && !empty($originid)) {
238 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
239 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
241 $subelement = $regs[2];
245 if ($element ==
'order') {
246 $element = $subelement =
'commande';
248 if ($element ==
'propal') {
249 $element =
'comm/propal'; $subelement =
'propal';
251 if ($element ==
'contract') {
252 $element = $subelement =
'contrat';
255 $object->origin = $origin;
256 $object->origin_id = $originid;
259 $object->linked_objects[$object->origin] = $object->origin_id;
260 if (is_array($_POST[
'other_linked_objects']) && !empty($_POST[
'other_linked_objects'])) {
261 $object->linked_objects = array_merge($object->linked_objects, $_POST[
'other_linked_objects']);
267 $ret = $extrafields->setOptionalsFromPost(
null, $object);
276 $id = $object->create($user);
281 $classname = ucfirst($subelement);
282 $srcobject =
new $classname($db);
284 dol_syslog(
"Try to find source object origin=".$object->origin.
" originid=".$object->origin_id.
" to add lines");
285 $result = $srcobject->fetch($object->origin_id);
287 $srcobject->fetch_thirdparty();
288 $lines = $srcobject->lines;
289 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
290 $srcobject->fetch_lines();
291 $lines = $srcobject->lines;
294 if (is_array($lines)) {
295 $num = count($lines);
297 for ($i = 0; $i < $num; $i++) {
298 if (!in_array($lines[$i]->
id, $selectedLines)) {
308 if ($lines[$i]->fk_product > 0) {
310 $prod->id = $lines[$i]->fk_product;
313 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
314 $prod->getMultiLangs();
316 $prod->fetch($lines[$i]->fk_product);
317 $outputlangs = $langs;
319 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
320 $newlang =
GETPOST(
'lang_id',
'aZ09');
322 if (empty($newlang)) {
323 $newlang = $srcobject->thirdparty->default_lang;
325 if (!empty($newlang)) {
327 $outputlangs->setDefaultLang($newlang);
329 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
331 $prod->fetch($lines[$i]->fk_product);
332 $label = $lines[$i]->product_label;
335 if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
336 switch ($prod->duration_unit) {
345 $mult = 3600 * 24 * 7;
348 $mult = (int) 3600 * 24 * (365 / 12);
351 $mult = 3600 * 24 * 365;
354 $duration = $prod->duration_value * $mult * $lines[$i]->qty;
357 $desc = $lines[$i]->product_ref;
365 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
368 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
377 $extrafields->fetch_name_optionals_label($object->table_element_line);
378 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
380 $result = $object->addline(
397 $langs->load(
"errors");
403 $langs->load(
"errors");
410 $ret = $extrafields->setOptionalsFromPost(
null, $object);
418 $array_options = $extrafields->getOptionalsFromPost($object->table_element);
420 $object->array_options = $array_options;
422 $result = $object->create($user);
426 $langs->load(
"errors");
434 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
438 } elseif ($action ==
'update' && $user->rights->ficheinter->creer) {
439 $object->socid = $socid;
440 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
441 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
442 $object->author = $user->id;
443 $object->description =
GETPOST(
'description',
'restricthtml');
445 $object->ref_client = $ref_client;
447 $result = $object->update($user);
451 } elseif ($action ==
'classin' && $user->rights->ficheinter->creer) {
453 $result = $object->setProject(
GETPOST(
'projectid',
'int'));
457 } elseif ($action ==
'setcontract' && $user->rights->contrat->creer) {
459 $result = $object->set_contrat($user,
GETPOST(
'contratid',
'int'));
463 } elseif ($action ==
'setref_client' && $user->rights->ficheinter->creer) {
465 $result = $object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
469 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->ficheinter->supprimer) {
470 $result = $object->delete($user);
475 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
477 } elseif ($action ==
'setdescription' && $user->rights->ficheinter->creer) {
478 $result = $object->set_description($user,
GETPOST(
'description'));
482 } elseif ($action ==
"addline" && $user->rights->ficheinter->creer) {
484 if (!
GETPOST(
'np_desc',
'restricthtml') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
485 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
488 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && !
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) {
489 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
492 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) &&
GETPOST(
'durationhour',
'int') >= 24 &&
GETPOST(
'durationmin',
'int') > 0) {
493 $mesg = $langs->trans(
"ErrorValueTooHigh");
499 $desc =
GETPOST(
'np_desc',
'restricthtml');
500 $date_intervention =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
504 $extrafields->fetch_name_optionals_label($object->table_element_line);
505 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
507 $result = $object->addline(
517 $outputlangs = $langs;
519 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
520 $newlang =
GETPOST(
'lang_id',
'aZ09');
522 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
523 $newlang = $object->thirdparty->default_lang;
525 if (!empty($newlang)) {
527 $outputlangs->setDefaultLang($newlang);
533 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
536 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
539 $mesg = $object->error;
543 } elseif ($action ==
'classifybilled' && $user->rights->ficheinter->creer) {
547 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
552 } elseif ($action ==
'classifyunbilled' && $user->rights->ficheinter->creer) {
556 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
559 $mesg = $object->error;
561 } elseif ($action ==
'classifydone' && $user->rights->ficheinter->creer) {
565 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
570 } elseif ($action ==
'confirm_reopen' && $user->rights->ficheinter->creer) {
574 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
577 $mesg = $object->error;
579 } elseif ($action ==
'updateline' && $user->rights->ficheinter->creer &&
GETPOST(
'save',
'alpha') == $langs->trans(
"Save")) {
582 if ($objectline->fetch($lineid) <= 0) {
587 if ($object->fetch($objectline->fk_fichinter) <= 0) {
591 $object->fetch_thirdparty();
593 $desc =
GETPOST(
'np_desc',
'restricthtml');
594 $date_inter =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
597 $objectline->datei = $date_inter;
598 $objectline->desc = $desc;
599 $objectline->duration = $duration;
602 $extrafields->fetch_name_optionals_label($object->table_element_line);
603 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
604 $objectline->array_options = $array_options;
606 $result = $objectline->update($user);
613 $outputlangs = $langs;
615 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
616 $newlang =
GETPOST(
'lang_id',
'aZ09');
618 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
619 $newlang = $object->thirdparty->default_lang;
621 if (!empty($newlang)) {
623 $outputlangs->setDefaultLang($newlang);
625 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
629 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
631 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $user->rights->ficheinter->creer) {
634 if ($objectline->fetch($lineid) <= 0) {
638 $result = $objectline->deleteline($user);
640 if ($object->fetch($objectline->fk_fichinter) <= 0) {
646 $outputlangs = $langs;
648 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
649 $newlang =
GETPOST(
'lang_id',
'aZ09');
651 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
652 $newlang = $object->thirdparty->default_lang;
654 if (!empty($newlang)) {
656 $outputlangs->setDefaultLang($newlang);
658 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
661 } elseif ($action ==
'up' && $user->rights->ficheinter->creer) {
663 $object->line_up($lineid);
666 $outputlangs = $langs;
668 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
669 $newlang =
GETPOST(
'lang_id',
'aZ09');
671 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
672 $newlang = $object->thirdparty->default_lang;
674 if (!empty($newlang)) {
676 $outputlangs->setDefaultLang($newlang);
678 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
682 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
684 } elseif ($action ==
'down' && $user->rights->ficheinter->creer) {
685 $object->line_down($lineid);
688 $outputlangs = $langs;
690 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
691 $newlang =
GETPOST(
'lang_id',
'aZ09');
693 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
694 $newlang = $object->thirdparty->default_lang;
696 if (!empty($newlang)) {
698 $outputlangs->setDefaultLang($newlang);
700 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
704 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
709 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
712 $triggersendname =
'FICHINTER_SENTBYMAIL';
713 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
714 $trackid =
'int'.$object->id;
715 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
718 $upload_dir = $conf->ficheinter->dir_output;
719 $permissiontoadd = $user->rights->ficheinter->creer;
720 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
722 if ($action ==
'update_extras') {
726 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
733 $result = $object->insertExtraFields(
'INTERVENTION_MODIFY');
741 $action =
'edit_extras';
745 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer) {
746 if ($action ==
'addcontact') {
747 if ($result > 0 && $id > 0) {
750 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
754 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
757 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
758 $langs->load(
"errors");
759 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
761 $mesg = $object->error;
764 } elseif ($action ==
'swapstatut') {
766 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
767 } elseif ($action ==
'deletecontact') {
769 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
772 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
788 if (!empty($conf->contrat->enabled)) {
791 if (!empty($conf->project->enabled)) {
800 if ($action ==
'create') {
805 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
814 $res = $soc->fetch($socid);
817 if (
GETPOST(
'origin',
'alphanohtml') &&
GETPOST(
'originid',
'int')) {
820 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
821 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
823 $subelement = $regs[2];
826 if ($element ==
'project') {
827 $projectid =
GETPOST(
'originid',
'int');
830 if ($element ==
'order' || $element ==
'commande') {
831 $element = $subelement =
'commande';
833 if ($element ==
'propal') {
834 $element =
'comm/propal'; $subelement =
'propal';
836 if ($element ==
'contract') {
837 $element = $subelement =
'contrat';
842 $classname = ucfirst($subelement);
843 $objectsrc =
new $classname($db);
844 $objectsrc->fetch(
GETPOST(
'originid'));
845 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
846 $objectsrc->fetch_lines();
847 $lines = $objectsrc->lines;
849 $objectsrc->fetch_thirdparty();
851 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
853 $soc = $objectsrc->thirdparty;
855 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
856 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
859 $objectsrc->fetch_optionals();
860 $object->array_options = $objectsrc->array_options;
863 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
866 $projectid =
GETPOST(
'projectid',
'int');
869 if (!$conf->global->FICHEINTER_ADDON) {
870 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
876 $obj = $conf->global->FICHEINTER_ADDON;
886 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
887 print
'<input type="hidden" name="token" value="'.newToken().
'">';
888 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
889 print
'<input type="hidden" name="action" value="add">';
893 print
'<table class="border centpercent">';
895 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
898 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
901 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
902 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
906 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
908 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
912 if (!empty($conf->project->enabled)) {
915 $langs->load(
"project");
917 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
924 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
925 if ($numprojet == 0) {
926 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>';
933 $langs->load(
"contracts");
934 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
935 $numcontrat = $formcontract->select_contract($soc->id,
GETPOST(
'contratid',
'int'),
'contratid', 0, 1, 1);
936 if ($numcontrat == 0) {
937 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>';
944 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
947 print
$form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
952 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
954 $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%');
955 print $doleditor->Create(1);
960 if (empty($user->socid)) {
962 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
964 $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%');
965 print $doleditor->Create(1);
972 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
973 print $hookmanager->resPrint;
974 if (empty($reshook)) {
975 print $object->showOptionals($extrafields,
'create');
979 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
980 $newclassname = $classname;
981 if ($newclassname ==
'Propal') {
982 $newclassname =
'CommercialProposal';
984 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1013 if (is_object($objectsrc)) {
1014 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1015 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1016 } elseif ($origin ==
'project' && !empty($projectid)) {
1017 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1022 print
$form->buttonsSaveCancel(
"CreateDraftIntervention");
1025 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1026 $title = $langs->trans(
'Services');
1029 print
'<div class="div-table-responsive-no-min">';
1030 print
'<table class="noborder centpercent">';
1032 $objectsrc->printOriginLinesList(empty($conf->global->FICHINTER_PRINT_PRODUCTS) ?
'services' :
'');
1040 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1041 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1042 print
'<input type="hidden" name="action" value="create">';
1046 if (is_object($objectsrc)) {
1047 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1048 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1049 } elseif ($origin ==
'project' && !empty($projectid)) {
1050 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1052 print
'<table class="border centpercent">';
1053 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1054 print
$form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0,
null, 0,
'minwidth300');
1055 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>';
1061 print
$form->buttonsSaveCancel(
"CreateDraftIntervention");
1065 } elseif ($id > 0 || !empty($ref)) {
1068 $object->fetch($id, $ref);
1069 $object->fetch_thirdparty();
1072 $soc->fetch($object->socid);
1082 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1087 if ($action ==
'delete') {
1088 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1092 if ($action ==
'validate') {
1094 $ref = substr($object->ref, 1, 4);
1095 if ($ref ==
'PROV') {
1096 $numref = $object->getNextNumRef($soc);
1097 if (empty($numref)) {
1102 $numref = $object->ref;
1104 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1106 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1110 if ($action ==
'modify') {
1111 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1115 if ($action ==
'reopen') {
1116 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention', $object->ref),
'confirm_reopen',
'', 0, 1);
1120 if ($action ==
'ask_deleteline') {
1121 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1125 if ($action ==
'clone') {
1127 $formquestion = array(
1133 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' =>
$form->select_company(
GETPOST(
'socid',
'int'),
'socid',
'',
'', 0, 0,
null, 0,
'minwidth200')));
1135 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1140 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1141 if (empty($reshook)) {
1143 } elseif ($reshook > 0) {
1153 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1156 $morehtmlref =
'<div class="refidno">';
1158 $morehtmlref.=
$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'', 0, 1);
1159 $morehtmlref.=
$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'',
null,
null,
'', 1);
1161 $morehtmlref .=
'<br><span class="hideonsmartphone">'.$langs->trans(
'ThirdParty').
' : </span>'.$object->thirdparty->getNomUrl(1,
'customer');
1163 if (!empty($conf->project->enabled)) {
1164 $langs->load(
"projects");
1165 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
1166 if ($user->rights->ficheinter->creer) {
1167 if ($action !=
'classify') {
1168 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
1170 if ($action ==
'classify') {
1172 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
1173 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
1174 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1175 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
1176 $morehtmlref .=
'<input type="submit" class="button button-edit valignmiddle" value="'.$langs->trans(
"Modify").
'">';
1177 $morehtmlref .=
'</form>';
1179 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
1182 if (!empty($object->fk_project)) {
1184 $proj->fetch($object->fk_project);
1185 $morehtmlref .=
' : '.$proj->getNomUrl(1);
1187 $morehtmlref .=
' - '.$proj->title;
1194 $morehtmlref .=
'</div>';
1196 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1199 print
'<div class="fichecenter">';
1200 print
'<div class="fichehalfleft">';
1201 print
'<div class="underbanner clearboth"></div>';
1203 print
'<table class="border tableforfield centpercent">';
1205 if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) {
1207 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1209 print $object->dateo ?
dol_print_date($object->dateo,
'daytext') :
' ';
1214 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1216 print $object->datee ?
dol_print_date($object->datee,
'daytext') :
' ';
1221 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1223 print $object->datet ?
dol_print_date($object->datet,
'daytext') :
' ';
1229 print
'<tr><td class="titlefield">';
1230 print
$form->editfieldkey(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea');
1232 print
$form->editfieldval(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea:8');
1237 if (!empty($conf->contrat->enabled)) {
1238 $langs->load(
'contracts');
1242 print
'<table class="nobordernopadding centpercent"><tr><td>';
1243 print $langs->trans(
'Contract');
1245 if ($action !=
'contrat') {
1246 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.$object->id.
'">';
1247 print
img_edit($langs->trans(
'SetContract'), 1);
1250 print
'</tr></table>';
1252 if ($action ==
'contrat') {
1253 $formcontract =
new Formcontract($db);
1254 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contrat,
'contratid', 0, 1, 1);
1256 if ($object->fk_contrat) {
1257 $contratstatic =
new Contrat($db);
1258 $contratstatic->fetch($object->fk_contrat);
1260 print $contratstatic->getNomUrl(0,
'', 1);
1271 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1276 print
'<div class="fichehalfright">';
1277 print
'<div class="underbanner clearboth"></div>';
1279 print
'<table class="border tableforfield centpercent">';
1281 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1283 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1284 print
'<td>'.convertSecondToTime($object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1293 print
'<div class="clearboth"></div><br>';
1296 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
1297 $blocname =
'contacts';
1298 $title = $langs->trans(
'ContactsAddresses');
1299 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1302 if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
1303 $blocname =
'notes';
1304 $title = $langs->trans(
'Notes');
1305 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1309 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1310 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" name="addinter" method="post">';
1311 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1312 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1313 if ($action ==
'editline') {
1314 print
'<input type="hidden" name="action" value="updateline">';
1315 print
'<input type="hidden" name="line_id" value="'.GETPOST(
'line_id',
'int').
'">';
1317 print
'<input type="hidden" name="action" value="addline">';
1321 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1322 $sql .=
' ft.date as date_intervention';
1323 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1324 $sql .=
' WHERE ft.fk_fichinter = '.((int) $object->id);
1325 if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) {
1326 $sql .=
' AND ft.duree <> 0';
1328 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1330 $resql = $db->query($sql);
1332 $num = $db->num_rows(
$resql);
1337 print
'<table class="noborder centpercent">';
1338 print
'<tr class="liste_titre">';
1341 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1342 print
'<td width="5" class="center linecolnum"></td>';
1345 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1346 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1347 print
'<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1348 print
'<td class="liste_titre"> </td>';
1349 print
'<td class="liste_titre"> </td>';
1353 $objp = $db->fetch_object(
$resql);
1356 if ($action !=
'editline' ||
GETPOST(
'line_id',
'int') != $objp->rowid) {
1357 print
'<tr class="oddeven">';
1360 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1361 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1365 print
'<a name="'.$objp->rowid.
'"></a>';
1369 $objectline->fetch($objp->rowid);
1370 $objectline->fetch_optionals();
1372 $extrafields->fetch_name_optionals_label($objectline->table_element);
1374 if (!empty($extrafields)) {
1375 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1376 if (!empty($temps)) {
1377 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1386 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>';
1389 print
'<td class="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ?
convertSecondToTime($objp->duree) :
'').
'</td>';
1394 if ($object->statut == 0 && $user->rights->ficheinter->creer) {
1395 print
'<td class="center">';
1396 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1399 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1402 print
'<td class="center">';
1405 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1409 if ($i < $num - 1) {
1410 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1417 print
'<td colspan="2"> </td>';
1424 if ($object->statut == 0 && $action ==
'editline' && $user->rights->ficheinter->creer &&
GETPOST(
'line_id',
'int') == $objp->rowid) {
1425 print
'<tr class="oddeven nohover">';
1428 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1429 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1433 print
'<a name="'.$objp->rowid.
'"></a>';
1436 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1437 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1438 $doleditor->Create();
1441 $objectline->fetch($objp->rowid);
1442 $objectline->fetch_optionals();
1444 $extrafields->fetch_name_optionals_label($objectline->table_element);
1446 if (!empty($extrafields)) {
1447 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1448 if (!empty($temps)) {
1449 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1458 print
'<td class="center nowrap">';
1459 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1460 print
$form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1462 print
$form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1467 print
'<td class="right">';
1468 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1469 $selectmode =
'select';
1470 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1471 $selectmode =
'text';
1473 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1477 print
'<td class="center" colspan="5" valign="center">';
1478 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1479 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1489 if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <>
'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1492 print
'<table class="noborder centpercent">';
1493 print
'<tr class="liste_titre">';
1496 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1497 print
'<td width="5" class="center linecolnum"></td>';
1501 print
'<a name="add"></a>';
1502 print $langs->trans(
'Description').
'</td>';
1503 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1504 print
'<td class="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1505 print
'<td colspan="3"> </td>';
1509 print
'<tr class="oddeven nohover">'.
"\n";
1512 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1513 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1518 if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
1519 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1520 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true, !empty($conf->global->FCKEDITOR_ENABLE_DETAILS), ROWS_2,
'90%');
1521 $doleditor->Create();
1525 $extrafields->fetch_name_optionals_label($objectline->table_element);
1527 if (is_object($objectline)) {
1528 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1530 if (!empty($temps)) {
1531 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1540 print
'<td class="center nowrap">';
1543 if (!
GETPOST(
'diday',
'int')) {
1544 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1546 $timewithnohour =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
1548 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1549 print
$form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1551 print
$form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1556 print
'<td class="right">';
1557 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1558 $selectmode =
'select';
1559 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1560 $selectmode =
'text';
1562 $form->select_duration(
'duration', (!
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) ? 3600 : (60 * 60 *
GETPOST(
'durationhour',
'int') + 60 *
GETPOST(
'durationmin',
'int')), 0, $selectmode);
1566 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1581 print
'</form>'.
"\n";
1593 print
'<div class="tabsAction">';
1596 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1598 if (empty($reshook)) {
1599 if ($user->socid == 0) {
1600 if ($action !=
'editdescription' && ($action !=
'presend')) {
1602 if ($object->statut ==
Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
1603 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)) {
1604 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate">'.$langs->trans(
"Validate").
'</a></div>';
1606 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1611 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))) {
1612 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify">';
1613 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1614 print $langs->trans(
"Modify");
1616 print $langs->trans(
"SetToDraft");
1623 if ($user->rights->ficheinter->creer) {
1624 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>';
1626 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'Reopen').
'</a></div>';
1631 if (empty($user->socid)) {
1633 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) {
1634 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>';
1636 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1642 if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut ==
Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
1643 print
'<div class="inline-block divButAction">';
1644 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/fichinter/card-rec.php?id='.$object->id.
'&action=create">'.$langs->trans(
"ChangeIntoRepeatableIntervention").
'</a>';
1650 $langs->load(
"propal");
1652 if ($user->rights->propal->creer) {
1653 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>';
1655 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddProp").
'</a></div>';
1662 $langs->load(
"bills");
1664 if ($user->rights->facture->creer) {
1665 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>';
1667 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddBill").
'</a></div>';
1671 if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
1673 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>';
1675 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>';
1682 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>';
1686 if ($user->rights->ficheinter->creer) {
1687 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>';
1691 if (($object->statut ==
Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) {
1692 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'"';
1693 print
'>'.$langs->trans(
'Delete').
'</a></div>';
1701 if ($action !=
'presend') {
1702 print
'<div class="fichecenter"><div class="fichehalfleft">';
1708 $filedir = $conf->ficheinter->dir_output.
"/".$filename;
1709 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1710 $genallowed = $user->rights->ficheinter->lire;
1711 $delallowed = $user->rights->ficheinter->creer;
1712 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1715 $linktoelem =
$form->showLinkToObjectBlock($object,
null, array(
'fichinter'));
1716 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
1719 print
'</div><div class="fichehalfright">';
1722 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1724 $somethingshown =
$formactions->showactions($object,
'fichinter', $socid, 1);
1726 print
'</div></div>';
1731 if (
GETPOST(
'modelselected')) {
1732 $action =
'presend';
1736 $modelmail =
'fichinter_send';
1737 $defaulttopic =
'SendInterventionRef';
1738 $diroutput = $conf->ficheinter->dir_output;
1739 $trackid =
'int'.$object->id;
1741 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';