36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42if (isModEnabled(
'project')) {
43 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
46if (isModEnabled(
'contrat')) {
47 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcontract.class.php";
48 require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
50if (!empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
".php")) {
51 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.
'.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
57$langs->loadLangs(array(
'bills',
'companies',
'interventions',
'stocks'));
61$ref_client =
GETPOST(
'ref_client',
'alpha');
62$socid = (int)
GETPOST(
'socid',
'int');
63$contratid = (int)
GETPOST(
'contratid',
'int');
64$action =
GETPOST(
'action',
'alpha');
65$cancel =
GETPOST(
'cancel',
'alpha');
66$confirm =
GETPOST(
'confirm',
'alpha');
67$backtopage =
GETPOST(
'backtopage',
'alpha');
70$origin =
GETPOST(
'origin',
'alpha');
72$note_public =
GETPOST(
'note_public',
'restricthtml');
73$note_private =
GETPOST(
'note_private',
'restricthtml');
74$lineid =
GETPOST(
'line_id',
'int');
79$hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
80$hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
81$hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
84$hookmanager->initHooks(array(
'interventioncard',
'globalcard'));
90$extrafields->fetch_name_optionals_label($object->table_element);
93if ($id > 0 || !empty($ref)) {
94 $ret = $object->fetch($id, $ref);
96 $ret = $object->fetch_thirdparty();
105 $socid = $user->socid;
109$permissionnote = $user->hasRight(
'ficheinter',
'creer');
110$permissiondellink = $user->hasRight(
'ficheinter',
'creer');
111$permissiontodelete = (($object->statut ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer')) || $user->rights->ficheinter->supprimer);
113$usercancreate = $user->hasRight(
'ficheinter',
'creer');
120$parameters = array(
'socid'=>$socid);
121$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
126if (empty($reshook)) {
127 $backurlforlist = DOL_URL_ROOT.
'/fichinter/list.php';
129 if (empty($backtopage) || ($cancel && empty($id))) {
130 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
131 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
132 $backtopage = $backurlforlist;
134 $backtopage = DOL_URL_ROOT.
'/fichinter/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
140 if (!empty($backtopageforcancel)) {
141 header(
"Location: ".$backtopageforcancel);
143 } elseif (!empty($backtopage)) {
144 header(
"Location: ".$backtopage);
150 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
152 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
155 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
156 if (1 == 0 && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
159 if ($object->id > 0) {
161 $orig = clone $object;
163 $result = $object->createFromClone($user, $socid);
165 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
176 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
177 $result = $object->setValid($user);
180 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
182 $outputlangs = $langs;
185 $newlang =
GETPOST(
'lang_id',
'aZ09');
188 $newlang = $object->thirdparty->default_lang;
190 if (!empty($newlang)) {
192 $outputlangs->setDefaultLang($newlang);
197 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
200 $mesg = $object->error;
202 } elseif ($action ==
'confirm_modify' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
203 $result = $object->setDraft($user);
205 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
207 $outputlangs = $langs;
210 $newlang =
GETPOST(
'lang_id',
'aZ09');
213 $newlang = $object->thirdparty->default_lang;
215 if (!empty($newlang)) {
217 $outputlangs->setDefaultLang($newlang);
222 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
225 $mesg = $object->error;
227 } elseif ($action ==
'add' && $user->hasRight(
'ficheinter',
'creer')) {
228 $selectedLines =
GETPOST(
'toselect',
'array');
229 $object->socid = $socid;
230 $object->duration = (int)
GETPOST(
'duration',
'int');
231 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
232 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
233 $object->author = $user->id;
234 $object->description =
GETPOST(
'description',
'restricthtml');
236 $object->ref_client = $ref_client;
237 $object->model_pdf =
GETPOST(
'model',
'alpha');
238 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
239 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
241 if ($object->socid > 0) {
243 if (!empty($origin) && !empty($originid)) {
246 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
247 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
249 $subelement = $regs[2];
253 if ($element ==
'order') {
254 $element = $subelement =
'commande';
256 if ($element ==
'propal') {
257 $element =
'comm/propal'; $subelement =
'propal';
259 if ($element ==
'contract') {
260 $element = $subelement =
'contrat';
263 $object->origin = $origin;
264 $object->origin_id = $originid;
267 $object->linked_objects[$object->origin] = $object->origin_id;
268 if (is_array($_POST[
'other_linked_objects']) && !empty($_POST[
'other_linked_objects'])) {
269 $object->linked_objects = array_merge($object->linked_objects, $_POST[
'other_linked_objects']);
275 $ret = $extrafields->setOptionalsFromPost(
null, $object);
284 $id = $object->create($user);
289 $classname = ucfirst($subelement);
290 $srcobject =
new $classname($db);
292 dol_syslog(
"Try to find source object origin=".$object->origin.
" originid=".$object->origin_id.
" to add lines");
293 $result = $srcobject->fetch($object->origin_id);
295 $srcobject->fetch_thirdparty();
296 $lines = $srcobject->lines;
297 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
298 $srcobject->fetch_lines();
299 $lines = $srcobject->lines;
302 if (is_array($lines)) {
303 $num = count($lines);
305 for ($i = 0; $i < $num; $i++) {
306 if (!in_array($lines[$i]->
id, $selectedLines)) {
316 if ($lines[$i]->fk_product > 0) {
318 $prod->id = $lines[$i]->fk_product;
321 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
322 $prod->getMultiLangs();
324 $prod->fetch($lines[$i]->fk_product);
325 $outputlangs = $langs;
327 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
328 $newlang =
GETPOST(
'lang_id',
'aZ09');
330 if (empty($newlang)) {
331 $newlang = $srcobject->thirdparty->default_lang;
333 if (!empty($newlang)) {
335 $outputlangs->setDefaultLang($newlang);
337 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
339 $prod->fetch($lines[$i]->fk_product);
340 $label = $lines[$i]->product_label;
343 if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
344 switch ($prod->duration_unit) {
353 $mult = 3600 * 24 * 7;
356 $mult = (int) 3600 * 24 * (365 / 12);
359 $mult = 3600 * 24 * 365;
362 $duration = $prod->duration_value * $mult * $lines[$i]->qty;
365 $desc = $lines[$i]->product_ref;
373 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
376 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
385 $extrafields->fetch_name_optionals_label($object->table_element_line);
386 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
388 $result = $object->addline(
405 $langs->load(
"errors");
411 $langs->load(
"errors");
418 $ret = $extrafields->setOptionalsFromPost(
null, $object);
426 $array_options = $extrafields->getOptionalsFromPost($object->table_element);
428 $object->array_options = $array_options;
430 $result = $object->create($user);
434 $langs->load(
"errors");
442 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
446 } elseif ($action ==
'update' && $user->hasRight(
'ficheinter',
'creer')) {
447 $object->socid = $socid;
448 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
449 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
450 $object->author = $user->id;
451 $object->description =
GETPOST(
'description',
'restricthtml');
453 $object->ref_client = $ref_client;
455 $result = $object->update($user);
459 } elseif ($action ==
'classin' && $user->hasRight(
'ficheinter',
'creer')) {
461 $result = $object->setProject(
GETPOST(
'projectid',
'int'));
465 } elseif ($action ==
'setcontract' && $user->hasRight(
'contrat',
'creer')) {
467 $result = $object->set_contrat($user,
GETPOST(
'contratid',
'int'));
471 } elseif ($action ==
'setref_client' && $user->hasRight(
'ficheinter',
'creer')) {
473 $result = $object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
477 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->ficheinter->supprimer) {
478 $result = $object->delete($user);
483 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
485 } elseif ($action ==
'setdescription' && $user->hasRight(
'ficheinter',
'creer')) {
486 $result = $object->set_description($user,
GETPOST(
'description'));
490 } elseif ($action ==
"addline" && $user->hasRight(
'ficheinter',
'creer')) {
492 if (!
GETPOST(
'np_desc',
'restricthtml') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
493 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
496 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && !
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) {
497 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
500 if (empty($conf->global->FICHINTER_WITHOUT_DURATION) &&
GETPOST(
'durationhour',
'int') >= 24 &&
GETPOST(
'durationmin',
'int') > 0) {
501 $mesg = $langs->trans(
"ErrorValueTooHigh");
507 $desc =
GETPOST(
'np_desc',
'restricthtml');
508 $date_intervention =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
512 $extrafields->fetch_name_optionals_label($object->table_element_line);
513 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
515 $result = $object->addline(
525 $outputlangs = $langs;
528 $newlang =
GETPOST(
'lang_id',
'aZ09');
531 $newlang = $object->thirdparty->default_lang;
533 if (!empty($newlang)) {
535 $outputlangs->setDefaultLang($newlang);
541 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
544 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
547 $mesg = $object->error;
551 } elseif ($action ==
'classifybilled' && $user->hasRight(
'ficheinter',
'creer')) {
555 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
560 } elseif ($action ==
'classifyunbilled' && $user->hasRight(
'ficheinter',
'creer')) {
564 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
567 $mesg = $object->error;
569 } elseif ($action ==
'classifydone' && $user->hasRight(
'ficheinter',
'creer')) {
573 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
578 } elseif ($action ==
'confirm_reopen' && $user->hasRight(
'ficheinter',
'creer')) {
582 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
585 $mesg = $object->error;
587 } elseif ($action ==
'updateline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOST(
'save',
'alpha')) {
590 if ($objectline->fetch($lineid) <= 0) {
595 if ($object->fetch($objectline->fk_fichinter) <= 0) {
599 $object->fetch_thirdparty();
601 $desc =
GETPOST(
'np_desc',
'restricthtml');
602 $date_inter =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
605 $objectline->date = $date_inter;
606 $objectline->desc = $desc;
607 $objectline->duration = $duration;
610 $extrafields->fetch_name_optionals_label($object->table_element_line);
611 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
612 if (!empty($array_options)) {
613 $objectline->array_options = array_merge($objectline->array_options, $array_options);
616 $result = $objectline->update($user);
623 $outputlangs = $langs;
626 $newlang =
GETPOST(
'lang_id',
'aZ09');
629 $newlang = $object->thirdparty->default_lang;
631 if (!empty($newlang)) {
633 $outputlangs->setDefaultLang($newlang);
635 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
639 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
641 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
644 if ($objectline->fetch($lineid) <= 0) {
648 $result = $objectline->deleteline($user);
650 if ($object->fetch($objectline->fk_fichinter) <= 0) {
656 $outputlangs = $langs;
659 $newlang =
GETPOST(
'lang_id',
'aZ09');
662 $newlang = $object->thirdparty->default_lang;
664 if (!empty($newlang)) {
666 $outputlangs->setDefaultLang($newlang);
668 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
671 } elseif ($action ==
'up' && $user->hasRight(
'ficheinter',
'creer')) {
673 $object->line_up($lineid);
676 $outputlangs = $langs;
679 $newlang =
GETPOST(
'lang_id',
'aZ09');
682 $newlang = $object->thirdparty->default_lang;
684 if (!empty($newlang)) {
686 $outputlangs->setDefaultLang($newlang);
688 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
692 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
694 } elseif ($action ==
'down' && $user->hasRight(
'ficheinter',
'creer')) {
695 $object->line_down($lineid);
698 $outputlangs = $langs;
701 $newlang =
GETPOST(
'lang_id',
'aZ09');
704 $newlang = $object->thirdparty->default_lang;
706 if (!empty($newlang)) {
708 $outputlangs->setDefaultLang($newlang);
710 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
714 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
719 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
722 $triggersendname =
'FICHINTER_SENTBYMAIL';
723 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
724 $trackid =
'int'.$object->id;
725 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
728 $upload_dir = $conf->ficheinter->dir_output;
729 $permissiontoadd = $user->rights->ficheinter->creer;
730 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
732 if ($action ==
'update_extras') {
736 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
743 $result = $object->insertExtraFields(
'INTERVENTION_MODIFY');
751 $action =
'edit_extras';
755 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->hasRight(
'ficheinter',
'creer')) {
756 if ($action ==
'addcontact') {
757 if ($result > 0 && $id > 0) {
760 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
764 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
767 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
768 $langs->load(
"errors");
769 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
771 $mesg = $object->error;
774 } elseif ($action ==
'swapstatut') {
776 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
777 } elseif ($action ==
'deletecontact') {
779 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
782 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
796$form =
new Form($db);
798if (isModEnabled(
'contrat')) {
801if (isModEnabled(
'project')) {
806$help_url =
'EN:Module_Interventions';
808llxHeader(
'', $langs->trans(
"Intervention"), $help_url);
810if ($action ==
'create') {
815 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
824 $res = $soc->fetch($socid);
827 if (
GETPOST(
'origin',
'alphanohtml') &&
GETPOST(
'originid',
'int')) {
830 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
831 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
833 $subelement = $regs[2];
836 if ($element ==
'project') {
837 $projectid =
GETPOST(
'originid',
'int');
840 if ($element ==
'order' || $element ==
'commande') {
841 $element = $subelement =
'commande';
843 if ($element ==
'propal') {
844 $element =
'comm/propal'; $subelement =
'propal';
846 if ($element ==
'contract') {
847 $element = $subelement =
'contrat';
852 $classname = ucfirst($subelement);
853 $objectsrc =
new $classname($db);
854 $objectsrc->fetch(
GETPOST(
'originid'));
855 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
856 $objectsrc->fetch_lines();
857 $lines = $objectsrc->lines;
859 $objectsrc->fetch_thirdparty();
861 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
863 $soc = $objectsrc->thirdparty;
865 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
866 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
869 $objectsrc->fetch_optionals();
870 $object->array_options = $objectsrc->array_options;
873 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
876 $projectid =
GETPOST(
'projectid',
'int');
879 if (!$conf->global->FICHEINTER_ADDON) {
880 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
886 $obj = $conf->global->FICHEINTER_ADDON;
896 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
897 print
'<input type="hidden" name="token" value="'.newToken().
'">';
898 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
899 print
'<input type="hidden" name="action" value="add">';
900 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
904 print
'<table class="border centpercent">';
906 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
909 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
912 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
913 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
917 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
919 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
923 if (isModEnabled(
'project')) {
926 $langs->load(
"project");
928 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
935 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
936 if ($numprojet == 0) {
937 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>';
943 if (isModEnabled(
'contrat')) {
944 $langs->load(
"contracts");
945 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
946 $numcontrat = $formcontract->select_contract($soc->id,
GETPOST(
'contratid',
'int'),
'contratid', 0, 1, 1);
947 if ($numcontrat == 0) {
948 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>';
955 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
958 print $form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
963 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
965 $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%');
966 print $doleditor->Create(1);
971 if (empty($user->socid)) {
973 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
975 $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%');
976 print $doleditor->Create(1);
982 $parameters = array();
983 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
984 print $hookmanager->resPrint;
985 if (empty($reshook)) {
986 print $object->showOptionals($extrafields,
'create');
990 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
991 $newclassname = $classname;
992 if ($newclassname ==
'Propal') {
993 $newclassname =
'CommercialProposal';
995 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1024 if (is_object($objectsrc)) {
1025 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1026 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1027 } elseif ($origin ==
'project' && !empty($projectid)) {
1028 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1033 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1036 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1037 $title = $langs->trans(
'Services');
1040 print
'<div class="div-table-responsive-no-min">';
1041 print
'<table class="noborder centpercent">';
1043 $objectsrc->printOriginLinesList(empty($conf->global->FICHINTER_PRINT_PRODUCTS) ?
'services' :
'');
1051 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1052 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1053 print
'<input type="hidden" name="action" value="create">';
1054 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1058 if (is_object($objectsrc)) {
1059 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1060 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1061 } elseif ($origin ==
'project' && !empty($projectid)) {
1062 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1064 print
'<table class="border centpercent">';
1065 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1066 print $form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0,
null, 0,
'minwidth300');
1067 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>';
1073 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1077} elseif ($id > 0 || !empty($ref)) {
1080 $object->fetch($id, $ref);
1081 $object->fetch_thirdparty();
1084 $soc->fetch($object->socid);
1094 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1099 if ($action ==
'delete') {
1100 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1104 if ($action ==
'validate') {
1106 $ref = substr($object->ref, 1, 4);
1107 if ($ref ==
'PROV') {
1108 $numref = $object->getNextNumRef($soc);
1109 if (empty($numref)) {
1114 $numref = $object->ref;
1116 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1117 if (isModEnabled(
'notification')) {
1118 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1119 $notify =
new Notify($db);
1121 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE', $object->socid, $object);
1124 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1128 if ($action ==
'modify') {
1129 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1133 if ($action ==
'reopen') {
1134 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention', $object->ref),
'confirm_reopen',
'', 0, 1);
1138 if ($action ==
'ask_deleteline') {
1139 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1143 if ($action ==
'clone') {
1145 $formquestion = array(
1151 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' => $form->select_company(
GETPOST(
'socid',
'int'),
'socid',
'',
'', 0, 0,
null, 0,
'minwidth200')));
1153 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1156 if (!$formconfirm) {
1157 $parameters = array(
'formConfirm' => $formconfirm,
'lineid'=>$lineid);
1158 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1159 if (empty($reshook)) {
1160 $formconfirm .= $hookmanager->resPrint;
1161 } elseif ($reshook > 0) {
1162 $formconfirm = $hookmanager->resPrint;
1171 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1174 $morehtmlref =
'<div class="refidno">';
1176 $morehtmlref.=$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'', 0, 1);
1177 $morehtmlref.=$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer,
'string',
'',
null,
null,
'', 1);
1179 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1181 if (isModEnabled(
'project')) {
1182 $langs->load(
"projects");
1183 $morehtmlref .=
'<br>';
1184 if ($usercancreate) {
1185 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1186 if ($action !=
'classify') {
1187 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1189 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1191 if (!empty($object->fk_project)) {
1193 $proj->fetch($object->fk_project);
1194 $morehtmlref .= $proj->getNomUrl(1);
1196 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1201 $morehtmlref .=
'</div>';
1203 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1206 print
'<div class="fichecenter">';
1207 print
'<div class="fichehalfleft">';
1208 print
'<div class="underbanner clearboth"></div>';
1210 print
'<table class="border tableforfield centpercent">';
1212 if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) {
1214 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1216 print $object->dateo ?
dol_print_date($object->dateo,
'daytext') :
' ';
1221 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1223 print $object->datee ?
dol_print_date($object->datee,
'daytext') :
' ';
1228 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1230 print $object->datet ?
dol_print_date($object->datet,
'daytext') :
' ';
1236 print
'<tr><td class="titlefield">';
1237 print $form->editfieldkey(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea');
1239 print $form->editfieldval(
"Description",
'description', $object->description, $object, $user->rights->ficheinter->creer,
'textarea:8');
1244 if (isModEnabled(
'contrat')) {
1245 $langs->load(
'contracts');
1249 print
'<table class="nobordernopadding centpercent"><tr><td>';
1250 print $langs->trans(
'Contract');
1252 if ($action !=
'contrat') {
1253 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.$object->id.
'">';
1254 print
img_edit($langs->trans(
'SetContract'), 1);
1257 print
'</tr></table>';
1259 if ($action ==
'contrat') {
1261 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contrat,
'contratid', 0, 1, 1);
1263 if ($object->fk_contrat) {
1264 $contratstatic =
new Contrat($db);
1265 $contratstatic->fetch($object->fk_contrat);
1267 print $contratstatic->getNomUrl(0,
'', 1);
1278 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1283 print
'<div class="fichehalfright">';
1284 print
'<div class="underbanner clearboth"></div>';
1286 print
'<table class="border tableforfield centpercent">';
1288 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1290 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1291 print
'<td>'.convertSecondToTime($object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
' ('.
convertDurationtoHour($object->duration,
"s").
' '.$langs->trans(
"h").
')</td>';
1300 print
'<div class="clearboth"></div><br>';
1303 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
1304 $blocname =
'contacts';
1305 $title = $langs->trans(
'ContactsAddresses');
1306 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1309 if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
1310 $blocname =
'notes';
1311 $title = $langs->trans(
'Notes');
1312 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1316 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1317 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" name="addinter" method="post">';
1318 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1319 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1320 if ($action ==
'editline') {
1321 print
'<input type="hidden" name="action" value="updateline">';
1322 print
'<input type="hidden" name="line_id" value="'.GETPOST(
'line_id',
'int').
'">';
1324 print
'<input type="hidden" name="action" value="addline">';
1326 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1329 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1330 $sql .=
' ft.date as date_intervention';
1331 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1332 $sql .=
' WHERE ft.fk_fichinter = '.((int) $object->id);
1333 if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) {
1334 $sql .=
' AND ft.duree <> 0';
1336 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1338 $resql = $db->query($sql);
1340 $num = $db->num_rows($resql);
1345 print
'<table class="noborder centpercent">';
1346 print
'<tr class="liste_titre">';
1349 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1350 print
'<td width="5" class="center linecolnum"></td>';
1353 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1354 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1355 print
'<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1356 print
'<td class="liste_titre"> </td>';
1357 print
'<td class="liste_titre"> </td>';
1361 $objp = $db->fetch_object($resql);
1364 if ($action !=
'editline' ||
GETPOST(
'line_id',
'int') != $objp->rowid) {
1365 print
'<tr class="oddeven">';
1368 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1369 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1373 print
'<a name="'.$objp->rowid.
'"></a>';
1377 $objectline->fetch($objp->rowid);
1378 $objectline->fetch_optionals();
1380 $extrafields->fetch_name_optionals_label($objectline->table_element);
1382 if (!empty($extrafields)) {
1383 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1384 if (!empty($temps)) {
1385 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1394 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>';
1397 print
'<td class="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ?
convertSecondToTime($objp->duree) :
'').
'</td>';
1402 if ($object->statut == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1403 print
'<td class="center">';
1404 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1407 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteline&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1410 print
'<td class="center">';
1413 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=up&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1417 if ($i < $num - 1) {
1418 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=down&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1425 print
'<td colspan="2"> </td>';
1432 if ($object->statut == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOST(
'line_id',
'int') == $objp->rowid) {
1433 print
'<tr class="oddeven nohover">';
1436 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1437 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1441 print
'<a name="'.$objp->rowid.
'"></a>';
1444 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1445 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1446 $doleditor->Create();
1449 $objectline->fetch($objp->rowid);
1450 $objectline->fetch_optionals();
1452 $extrafields->fetch_name_optionals_label($objectline->table_element);
1454 if (!empty($extrafields)) {
1455 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1456 if (!empty($temps)) {
1457 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1466 print
'<td class="center nowrap">';
1467 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1468 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1470 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1475 print
'<td class="right">';
1476 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1477 $selectmode =
'select';
1478 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1479 $selectmode =
'text';
1481 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1485 print
'<td class="center" colspan="5" valign="center">';
1486 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1487 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1497 if ($object->statut == 0 && $user->hasRight(
'ficheinter',
'creer') && $action <>
'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1500 print
'<table class="noborder centpercent">';
1501 print
'<tr class="liste_titre">';
1504 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1505 print
'<td width="5" class="center linecolnum"></td>';
1509 print
'<a name="add"></a>';
1510 print $langs->trans(
'Description').
'</td>';
1511 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1512 print
'<td class="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans(
'Duration') :
'').
'</td>';
1513 print
'<td colspan="3"> </td>';
1517 print
'<tr class="oddeven nohover">'.
"\n";
1520 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1521 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1526 if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
1527 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1528 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true, !empty($conf->global->FCKEDITOR_ENABLE_DETAILS), ROWS_2,
'90%');
1529 $doleditor->Create();
1533 $extrafields->fetch_name_optionals_label($objectline->table_element);
1535 if (is_object($objectline)) {
1536 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1538 if (!empty($temps)) {
1539 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1548 print
'<td class="center nowrap">';
1551 if (!
GETPOST(
'diday',
'int')) {
1552 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1554 $timewithnohour =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
1556 if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
1557 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1559 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1564 print
'<td class="right">';
1565 if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
1566 $selectmode =
'select';
1567 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
1568 $selectmode =
'text';
1570 $form->select_duration(
'duration', (!
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) ? 3600 : (60 * 60 *
GETPOST(
'durationhour',
'int') + 60 *
GETPOST(
'durationmin',
'int')), 0, $selectmode);
1574 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1589 print
'</form>'.
"\n";
1601 print
'<div class="tabsAction">';
1603 $parameters = array();
1604 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1606 if (empty($reshook)) {
1607 if ($user->socid == 0) {
1608 if ($action !=
'editdescription' && ($action !=
'presend')) {
1610 if ($object->statut ==
Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
1611 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
'ficheinter',
'creer')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) {
1612 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate">'.$langs->trans(
"Validate").
'</a></div>';
1614 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1619 if ($object->statut ==
Fichinter::STATUS_VALIDATED && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
'ficheinter',
'creer')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate))) {
1620 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify">';
1621 if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
1622 print $langs->trans(
"Modify");
1624 print $langs->trans(
"SetToDraft");
1631 if ($user->rights->ficheinter->creer) {
1632 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>';
1634 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1639 if (empty($user->socid)) {
1641 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) {
1642 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>';
1644 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1650 if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut ==
Fichinter::STATUS_DRAFT && $user->hasRight(
'ficheinter',
'creer') && (count($object->lines) > 0)) {
1651 print
'<div class="inline-block divButAction">';
1652 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/fichinter/card-rec.php?id='.$object->id.
'&action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$object->id).
'">'.$langs->trans(
"ChangeIntoRepeatableIntervention").
'</a>';
1658 $langs->load(
"propal");
1660 if ($user->rights->propal->creer) {
1661 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>';
1663 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddProp").
'</a></div>';
1670 $langs->load(
"bills");
1672 if ($user->hasRight(
'facture',
'creer')) {
1673 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>';
1675 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddBill").
'</a></div>';
1679 if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
1681 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>';
1683 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>';
1690 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>';
1694 if ($user->rights->ficheinter->creer) {
1695 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>';
1699 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.newToken(),
'delete', $permissiontodelete);
1706 if ($action !=
'presend') {
1707 print
'<div class="fichecenter"><div class="fichehalfleft">';
1713 $filedir = $conf->ficheinter->dir_output.
"/".$filename;
1714 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1715 $genallowed = $user->rights->ficheinter->lire;
1716 $delallowed = $user->rights->ficheinter->creer;
1717 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1720 $linktoelem = $form->showLinkToObjectBlock($object,
null, array(
'fichinter'));
1721 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1725 print
'<br><!-- Link to download main doc -->'.
"\n";
1731 print
'<br><!-- Link to sign -->';
1732 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1734 print showOnlineSignatureUrl(
'fichinter', $object->ref).
'<br>';
1737 print
'</div><div class="fichehalfright">';
1741 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.$object->id);
1744 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1746 $somethingshown =
$formactions->showactions($object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1748 print
'</div></div>';
1753 if (
GETPOST(
'modelselected')) {
1754 $action =
'presend';
1758 $modelmail =
'fichinter_send';
1759 $defaulttopic =
'SendInterventionRef';
1760 $diroutput = $conf->ficheinter->dir_output;
1761 $trackid =
'int'.$object->id;
1763 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
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(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage contracts.
Class to manage a WYSIWYG editor.
Class to manage interventions.
const STATUS_BILLED
Billed.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
const STATUS_CLOSED
Closed.
Class to manage intervention lines.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage notifications.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
convertDurationtoHour($duration_value, $duration_unit)
Convert duration to hour.
convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0)
Convert hours and minutes into seconds.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
fichinter_prepare_head($object)
Prepare array with list of tabs.
dol_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_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...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
showDirectDownloadLink($object)
Return string with full Url.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Create an intervention document on disk using template defined into FICHEINTER_ADDON_PDF.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.