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;
112 $parameters = array(
'socid'=>$socid);
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');
740 $action =
'edit_extras';
744 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer) {
745 if ($action ==
'addcontact') {
746 if ($result > 0 && $id > 0) {
749 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
753 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
756 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
757 $langs->load(
"errors");
758 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
760 $mesg = $object->error;
763 } elseif ($action ==
'swapstatut') {
765 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
766 } elseif ($action ==
'deletecontact') {
768 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
771 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
787 if (!empty($conf->contrat->enabled)) {
790 if (!empty($conf->project->enabled)) {
799 if ($action ==
'create') {
804 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
813 $res = $soc->fetch($socid);
816 if (
GETPOST(
'origin',
'alphanohtml') &&
GETPOST(
'originid',
'int')) {
819 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
820 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
822 $subelement = $regs[2];
825 if ($element ==
'project') {
826 $projectid =
GETPOST(
'originid',
'int');
829 if ($element ==
'order' || $element ==
'commande') {
830 $element = $subelement =
'commande';
832 if ($element ==
'propal') {
833 $element =
'comm/propal'; $subelement =
'propal';
835 if ($element ==
'contract') {
836 $element = $subelement =
'contrat';
841 $classname = ucfirst($subelement);
842 $objectsrc =
new $classname($db);
843 $objectsrc->fetch(
GETPOST(
'originid'));
844 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
845 $objectsrc->fetch_lines();
846 $lines = $objectsrc->lines;
848 $objectsrc->fetch_thirdparty();
850 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
852 $soc = $objectsrc->thirdparty;
854 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
855 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
858 $objectsrc->fetch_optionals();
859 $object->array_options = $objectsrc->array_options;
862 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
865 $projectid =
GETPOST(
'projectid',
'int');
868 if (!$conf->global->FICHEINTER_ADDON) {
869 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
875 $obj = $conf->global->FICHEINTER_ADDON;
885 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
886 print
'<input type="hidden" name="token" value="'.newToken().
'">';
887 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
888 print
'<input type="hidden" name="action" value="add">';
892 print
'<table class="border centpercent">';
894 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
897 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
900 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
901 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
905 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
907 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
911 if (!empty($conf->project->enabled)) {
914 $langs->load(
"project");
916 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
923 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
924 if ($numprojet == 0) {
925 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>';
932 $langs->load(
"contracts");
933 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
934 $numcontrat = $formcontract->select_contract($soc->id,
GETPOST(
'contratid',
'int'),
'contratid', 0, 1, 1);
935 if ($numcontrat == 0) {
936 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>';
943 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
946 print
$form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
951 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
953 $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%');
954 print $doleditor->Create(1);
959 if (empty($user->socid)) {
961 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
963 $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%');
964 print $doleditor->Create(1);
970 $parameters = array();
971 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
972 print $hookmanager->resPrint;
973 if (empty($reshook)) {
974 print $object->showOptionals($extrafields,
'create');
978 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
979 $newclassname = $classname;
980 if ($newclassname ==
'Propal') {
981 $newclassname =
'CommercialProposal';
983 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1012 if (is_object($objectsrc)) {
1013 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1014 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1015 } elseif ($origin ==
'project' && !empty($projectid)) {
1016 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1021 print
$form->buttonsSaveCancel(
"CreateDraftIntervention");
1024 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1025 $title = $langs->trans(
'Services');
1028 print
'<div class="div-table-responsive-no-min">';
1029 print
'<table class="noborder centpercent">';
1031 $objectsrc->printOriginLinesList(empty($conf->global->FICHINTER_PRINT_PRODUCTS) ?
'services' :
'');
1039 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1040 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1041 print
'<input type="hidden" name="action" value="create">';
1045 if (is_object($objectsrc)) {
1046 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1047 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1048 } elseif ($origin ==
'project' && !empty($projectid)) {
1049 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1051 print
'<table class="border centpercent">';
1052 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1053 print
$form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, null, 0,
'minwidth300');
1054 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>';
1060 print
$form->buttonsSaveCancel(
"CreateDraftIntervention");
1064 } elseif ($id > 0 || !empty($ref)) {
1067 $object->fetch($id, $ref);
1068 $object->fetch_thirdparty();
1071 $soc->fetch($object->socid);
1081 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1086 if ($action ==
'delete') {
1087 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1091 if ($action ==
'validate') {
1093 $ref = substr($object->ref, 1, 4);
1094 if ($ref ==
'PROV') {
1095 $numref = $object->getNextNumRef($soc);
1096 if (empty($numref)) {
1101 $numref = $object->ref;
1103 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1105 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1109 if ($action ==
'modify') {
1110 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1114 if ($action ==
'reopen') {
1115 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention', $object->ref),
'confirm_reopen',
'', 0, 1);
1119 if ($action ==
'ask_deleteline') {
1120 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1124 if ($action ==
'clone') {
1126 $formquestion = array(
1132 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' =>
$form->select_company(
GETPOST(
'socid',
'int'),
'socid',
'',
'', 0, 0, null, 0,
'minwidth200')));
1134 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1137 if (!$formconfirm) {
1138 $parameters = array(
'formConfirm' => $formconfirm,
'lineid'=>$lineid);
1139 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1140 if (empty($reshook)) {
1141 $formconfirm .= $hookmanager->resPrint;
1142 } elseif ($reshook > 0) {
1143 $formconfirm = $hookmanager->resPrint;
1152 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1155 $morehtmlref =
'<div class="refidno">';
1157 $morehtmlref.=
$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'', 0, 1);
1158 $morehtmlref.=
$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'', null, null,
'', 1);
1160 $morehtmlref .=
'<br><span class="hideonsmartphone">'.$langs->trans(
'ThirdParty').
' : </span>'.$object->thirdparty->getNomUrl(1,
'customer');
1162 if (!empty($conf->project->enabled)) {
1163 $langs->load(
"projects");
1164 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
1165 if ($user->rights->ficheinter->creer) {
1166 if ($action !=
'classify') {
1167 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
1169 if ($action ==
'classify') {
1171 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
1172 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
1173 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1174 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
1175 $morehtmlref .=
'<input type="submit" class="button button-edit valignmiddle" value="'.$langs->trans(
"Modify").
'">';
1176 $morehtmlref .=
'</form>';
1178 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
1181 if (!empty($object->fk_project)) {
1183 $proj->fetch($object->fk_project);
1184 $morehtmlref .=
' : '.$proj->getNomUrl(1);
1186 $morehtmlref .=
' - '.$proj->title;
1193 $morehtmlref .=
'</div>';
1195 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1198 print
'<div class="fichecenter">';
1199 print
'<div class="fichehalfleft">';
1200 print
'<div class="underbanner clearboth"></div>';
1202 print
'<table class="border tableforfield centpercent">';
1204 if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) {
1206 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1208 print $object->dateo ?
dol_print_date($object->dateo,
'daytext') :
' ';
1213 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1215 print $object->datee ?
dol_print_date($object->datee,
'daytext') :
' ';
1220 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1222 print $object->datet ?
dol_print_date($object->datet,
'daytext') :
' ';
1228 print
'<tr><td class="titlefield">';
1229 print
$form->editfieldkey(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea');
1231 print
$form->editfieldval(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea:8');
1236 if (!empty($conf->contrat->enabled)) {
1237 $langs->load(
'contracts');
1241 print
'<table class="nobordernopadding centpercent"><tr><td>';
1242 print $langs->trans(
'Contract');
1244 if ($action !=
'contrat') {
1245 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.$object->id.
'">';
1246 print
img_edit($langs->trans(
'SetContract'), 1);
1249 print
'</tr></table>';
1251 if ($action ==
'contrat') {
1252 $formcontract =
new Formcontract($db);
1253 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contrat,
'contratid', 0, 1, 1);
1255 if ($object->fk_contrat) {
1256 $contratstatic =
new Contrat($db);
1257 $contratstatic->fetch($object->fk_contrat);
1259 print $contratstatic->getNomUrl(0,
'', 1);
1270 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1275 print
'<div class="fichehalfright">';
1276 print
'<div class="underbanner clearboth"></div>';
1278 print
'<table class="border tableforfield centpercent">';
1280 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1282 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1283 print
'<td>'.convertSecondToTime($object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1292 print
'<div class="clearboth"></div><br>';
1295 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
1296 $blocname =
'contacts';
1297 $title = $langs->trans(
'ContactsAddresses');
1298 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1301 if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
1302 $blocname =
'notes';
1303 $title = $langs->trans(
'Notes');
1304 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1308 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1309 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" name="addinter" method="post">';
1310 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1311 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1312 if ($action ==
'editline') {
1313 print
'<input type="hidden" name="action" value="updateline">';
1314 print
'<input type="hidden" name="line_id" value="'.GETPOST(
'line_id',
'int').
'">';
1316 print
'<input type="hidden" name="action" value="addline">';
1320 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1321 $sql .=
' ft.date as date_intervention';
1322 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1323 $sql .=
' WHERE ft.fk_fichinter = '.((int) $object->id);
1324 if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) {
1325 $sql .=
' AND ft.duree <> 0';
1327 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1329 $resql = $db->query($sql);
1331 $num = $db->num_rows(
$resql);
1336 print
'<table class="noborder centpercent">';
1337 print
'<tr class="liste_titre">';
1340 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1341 print
'<td width="5" class="center linecolnum"></td>';
1344 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1345 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1346 print
'<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1347 print
'<td class="liste_titre"> </td>';
1348 print
'<td class="liste_titre"> </td>';
1352 $objp = $db->fetch_object(
$resql);
1355 if ($action !=
'editline' ||
GETPOST(
'line_id',
'int') != $objp->rowid) {
1356 print
'<tr class="oddeven">';
1359 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1360 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1364 print
'<a name="'.$objp->rowid.
'"></a>';
1368 $objectline->fetch($objp->rowid);
1369 $objectline->fetch_optionals();
1371 $extrafields->fetch_name_optionals_label($objectline->table_element);
1373 if (!empty($extrafields)) {
1374 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1375 if (!empty($temps)) {
1376 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1385 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>';
1388 print
'<td class="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ?
convertSecondToTime($objp->duree) :
'').
'</td>';
1393 if ($object->statut == 0 && $user->rights->ficheinter->creer) {
1394 print
'<td class="center">';
1395 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1398 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteline&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1401 print
'<td class="center">';
1404 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=up&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1408 if ($i < $num - 1) {
1409 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=down&token='.
newToken().
'&line_id='.$objp->rowid.
'">';
1416 print
'<td colspan="2"> </td>';
1423 if ($object->statut == 0 && $action ==
'editline' && $user->rights->ficheinter->creer &&
GETPOST(
'line_id',
'int') == $objp->rowid) {
1424 print
'<tr class="oddeven nohover">';
1427 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1428 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1432 print
'<a name="'.$objp->rowid.
'"></a>';
1435 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1436 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1437 $doleditor->Create();
1440 $objectline->fetch($objp->rowid);
1441 $objectline->fetch_optionals();
1443 $extrafields->fetch_name_optionals_label($objectline->table_element);
1445 if (!empty($extrafields)) {
1446 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1447 if (!empty($temps)) {
1448 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1457 print
'<td class="center nowrap">';
1458 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1459 print
$form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1461 print
$form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1466 print
'<td class="right">';
1467 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1468 $selectmode =
'select';
1469 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1470 $selectmode =
'text';
1472 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1476 print
'<td class="center" colspan="5" valign="center">';
1477 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1478 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1488 if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <>
'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1491 print
'<table class="noborder centpercent">';
1492 print
'<tr class="liste_titre">';
1495 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1496 print
'<td width="5" class="center linecolnum"></td>';
1500 print
'<a name="add"></a>';
1501 print $langs->trans(
'Description').
'</td>';
1502 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1503 print
'<td class="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1504 print
'<td colspan="3"> </td>';
1508 print
'<tr class="oddeven nohover">'.
"\n";
1511 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1512 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1517 if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
1518 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1519 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true, !empty($conf->global->FCKEDITOR_ENABLE_DETAILS), ROWS_2,
'90%');
1520 $doleditor->Create();
1524 $extrafields->fetch_name_optionals_label($objectline->table_element);
1526 if (is_object($objectline)) {
1527 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1529 if (!empty($temps)) {
1530 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1539 print
'<td class="center nowrap">';
1542 if (!
GETPOST(
'diday',
'int')) {
1543 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1545 $timewithnohour =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
1547 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1548 print
$form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1550 print
$form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1555 print
'<td class="right">';
1556 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1557 $selectmode =
'select';
1558 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1559 $selectmode =
'text';
1561 $form->select_duration(
'duration', (!
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) ? 3600 : (60 * 60 *
GETPOST(
'durationhour',
'int') + 60 *
GETPOST(
'durationmin',
'int')), 0, $selectmode);
1565 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1580 print
'</form>'.
"\n";
1592 print
'<div class="tabsAction">';
1594 $parameters = array();
1595 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1597 if (empty($reshook)) {
1598 if ($user->socid == 0) {
1599 if ($action !=
'editdescription' && ($action !=
'presend')) {
1601 if ($object->statut ==
Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
1602 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)) {
1603 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate">'.$langs->trans(
"Validate").
'</a></div>';
1605 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1610 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))) {
1611 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify">';
1612 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1613 print $langs->trans(
"Modify");
1615 print $langs->trans(
"SetToDraft");
1622 if ($user->rights->ficheinter->creer) {
1623 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>';
1625 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'Reopen').
'</a></div>';
1630 if (empty($user->socid)) {
1632 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) {
1633 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>';
1635 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1641 if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut ==
Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
1642 print
'<div class="inline-block divButAction">';
1643 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/fichinter/card-rec.php?id='.$object->id.
'&action=create">'.$langs->trans(
"ChangeIntoRepeatableIntervention").
'</a>';
1649 $langs->load(
"propal");
1651 if ($user->rights->propal->creer) {
1652 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>';
1654 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddProp").
'</a></div>';
1661 $langs->load(
"bills");
1663 if ($user->rights->facture->creer) {
1664 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>';
1666 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddBill").
'</a></div>';
1670 if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
1672 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>';
1674 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>';
1681 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>';
1685 if ($user->rights->ficheinter->creer) {
1686 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>';
1690 if (($object->statut ==
Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) {
1691 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'"';
1692 print
'>'.$langs->trans(
'Delete').
'</a></div>';
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);
1718 print
'</div><div class="fichehalfright">';
1721 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1723 $somethingshown =
$formactions->showactions($object,
'fichinter', $socid, 1);
1725 print
'</div></div>';
1730 if (
GETPOST(
'modelselected')) {
1731 $action =
'presend';
1735 $modelmail =
'fichinter_send';
1736 $defaulttopic =
'SendInterventionRef';
1737 $diroutput = $conf->ficheinter->dir_output;
1738 $trackid =
'int'.$object->id;
1740 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action== 'set') elseif($action== 'specimen') elseif($action== 'setmodel') elseif($action== 'del') elseif($action== 'setdoc') $formactions
View.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage products or services.
Class to manage interventions.
dol_now($mode= 'auto')
Return date for now.
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.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage contracts.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
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...
const STATUS_DRAFT
Draft status.
const TYPE_SERVICE
Service.
fichinter_prepare_head($object)
Prepare array with list of tabs.
const TYPE_PRODUCT
Regular product.
const STATUS_VALIDATED
Validated status.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0)
Convert hours and minutes into seconds.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
img_down($titlealt= 'default', $selected=0, $moreclass= '')
Show down arrow logo.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_up($titlealt= 'default', $selected=0, $moreclass= '')
Show top arrow logo.
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.
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
const STATUS_CLOSED
Closed.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_htmloutput_mesg($mesgstring= '', $mesgarray=array(), $style= 'ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Class to manage intervention lines.
const STATUS_BILLED
Billed.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
isModEnabled($module)
Is Dolibarr module enabled.
Class to manage a WYSIWYG editor.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
dol_htmloutput_errors($mesgstring= '', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.
$formconfirm
if ($action == 'delbookkeepingyear') {
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.