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";
51 require_once DOL_DOCUMENT_ROOT.
"/core/modules/fichinter/mod_" .
getDolGlobalString(
'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');
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);
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);
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 ==
'confirm_done' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
228 $result = $object->setClose($user);
233 $outputlangs = $langs;
236 $newlang =
GETPOST(
'lang_id',
'aZ09');
239 $newlang = $object->thirdparty->default_lang;
241 if (!empty($newlang)) {
243 $outputlangs->setDefaultLang($newlang);
248 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
251 $mesg = $object->error;
253 } elseif ($action ==
'add' && $user->hasRight(
'ficheinter',
'creer')) {
254 $selectedLines =
GETPOST(
'toselect',
'array');
255 $object->socid = $socid;
256 $object->duration = (int)
GETPOST(
'duration',
'int');
257 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
258 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
259 $object->author = $user->id;
260 $object->description =
GETPOST(
'description',
'restricthtml');
262 $object->ref_client = $ref_client;
263 $object->model_pdf =
GETPOST(
'model',
'alpha');
264 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
265 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
267 if ($object->socid > 0) {
269 if (!empty($origin) && !empty($originid)) {
272 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
273 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
275 $subelement = $regs[2];
279 if ($element ==
'order') {
280 $element = $subelement =
'commande';
282 if ($element ==
'propal') {
283 $element =
'comm/propal';
284 $subelement =
'propal';
286 if ($element ==
'contract') {
287 $element = $subelement =
'contrat';
290 $object->origin = $origin;
291 $object->origin_id = $originid;
294 $object->linked_objects[$object->origin] = $object->origin_id;
295 if (is_array($_POST[
'other_linked_objects']) && !empty($_POST[
'other_linked_objects'])) {
296 $object->linked_objects = array_merge($object->linked_objects, $_POST[
'other_linked_objects']);
302 $ret = $extrafields->setOptionalsFromPost(
null, $object);
311 $id = $object->create($user);
316 $classname = ucfirst($subelement);
317 $srcobject =
new $classname($db);
319 dol_syslog(
"Try to find source object origin=".$object->origin.
" originid=".$object->origin_id.
" to add lines");
320 $result = $srcobject->fetch($object->origin_id);
322 $srcobject->fetch_thirdparty();
323 $lines = $srcobject->lines;
324 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
325 $srcobject->fetch_lines();
326 $lines = $srcobject->lines;
329 if (is_array($lines)) {
330 $num = count($lines);
332 for ($i = 0; $i < $num; $i++) {
333 if (!in_array($lines[$i]->
id, $selectedLines)) {
343 if ($lines[$i]->fk_product > 0) {
345 $prod->id = $lines[$i]->fk_product;
349 $prod->getMultiLangs();
351 $prod->fetch($lines[$i]->fk_product);
352 $outputlangs = $langs;
354 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
355 $newlang =
GETPOST(
'lang_id',
'aZ09');
357 if (empty($newlang)) {
358 $newlang = $srcobject->thirdparty->default_lang;
360 if (!empty($newlang)) {
362 $outputlangs->setDefaultLang($newlang);
364 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"libelle"])) ? $prod->multilangs[$outputlangs->defaultlang][
"libelle"] : $lines[$i]->product_label;
366 $prod->fetch($lines[$i]->fk_product);
367 $label = $lines[$i]->product_label;
370 if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
371 switch ($prod->duration_unit) {
380 $mult = 3600 * 24 * 7;
383 $mult = (int) 3600 * 24 * (365 / 12);
386 $mult = 3600 * 24 * 365;
389 $duration = $prod->duration_value * $mult * $lines[$i]->qty;
392 $desc = $lines[$i]->product_ref;
400 $desc .=
' ('.$langs->trans(
'Quantity').
': '.$lines[$i]->qty.
')';
403 $date_intervention =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
412 $extrafields->fetch_name_optionals_label($object->table_element_line);
413 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
415 $result = $object->addline(
432 $langs->load(
"errors");
438 $langs->load(
"errors");
445 $ret = $extrafields->setOptionalsFromPost(
null, $object);
453 $array_options = $extrafields->getOptionalsFromPost($object->table_element);
455 $object->array_options = $array_options;
457 $result = $object->create($user);
461 $langs->load(
"errors");
469 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty"));
473 } elseif ($action ==
'update' && $user->hasRight(
'ficheinter',
'creer')) {
474 $object->socid = $socid;
475 $object->fk_project = (int)
GETPOST(
'projectid',
'int');
476 $object->fk_contrat = (int)
GETPOST(
'contratid',
'int');
477 $object->author = $user->id;
478 $object->description =
GETPOST(
'description',
'restricthtml');
480 $object->ref_client = $ref_client;
482 $result = $object->update($user);
486 } elseif ($action ==
'classin' && $user->hasRight(
'ficheinter',
'creer')) {
488 $result = $object->setProject(
GETPOST(
'projectid',
'int'));
492 } elseif ($action ==
'setcontract' && $user->hasRight(
'contrat',
'creer')) {
494 $result = $object->set_contrat($user,
GETPOST(
'contratid',
'int'));
498 } elseif ($action ==
'setref_client' && $user->hasRight(
'ficheinter',
'creer')) {
500 $result = $object->setRefClient($user,
GETPOST(
'ref_client',
'alpha'));
504 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'supprimer')) {
505 $result = $object->delete($user);
510 header(
'Location: '.DOL_URL_ROOT.
'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
512 } elseif ($action ==
'setdescription' && $user->hasRight(
'ficheinter',
'creer')) {
513 $result = $object->set_description($user,
GETPOST(
'description'));
517 } elseif ($action ==
"addline" && $user->hasRight(
'ficheinter',
'creer')) {
520 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description"));
524 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Duration"));
528 $mesg = $langs->trans(
"ErrorValueTooHigh");
534 $desc =
GETPOST(
'np_desc',
'restricthtml');
535 $date_intervention =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
539 $extrafields->fetch_name_optionals_label($object->table_element_line);
540 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
542 $result = $object->addline(
552 $outputlangs = $langs;
555 $newlang =
GETPOST(
'lang_id',
'aZ09');
558 $newlang = $object->thirdparty->default_lang;
560 if (!empty($newlang)) {
562 $outputlangs->setDefaultLang($newlang);
571 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
574 $mesg = $object->error;
578 } elseif ($action ==
'classifybilled' && $user->hasRight(
'ficheinter',
'creer')) {
582 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
587 } elseif ($action ==
'classifyunbilled' && $user->hasRight(
'ficheinter',
'creer')) {
591 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
594 $mesg = $object->error;
596 } elseif ($action ==
'confirm_reopen' && $user->hasRight(
'ficheinter',
'creer')) {
600 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
603 $mesg = $object->error;
605 } elseif ($action ==
'updateline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOST(
'save',
'alpha')) {
608 if ($objectline->fetch($lineid) <= 0) {
613 if ($object->fetch($objectline->fk_fichinter) <= 0) {
617 $object->fetch_thirdparty();
619 $desc =
GETPOST(
'np_desc',
'restricthtml');
620 $date_inter =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
623 $objectline->date = $date_inter;
624 $objectline->desc = $desc;
625 $objectline->duration = $duration;
628 $extrafields->fetch_name_optionals_label($object->table_element_line);
629 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
630 if (is_array($array_options)) {
631 $objectline->array_options = array_merge($objectline->array_options, $array_options);
634 $result = $objectline->update($user);
641 $outputlangs = $langs;
644 $newlang =
GETPOST(
'lang_id',
'aZ09');
647 $newlang = $object->thirdparty->default_lang;
649 if (!empty($newlang)) {
651 $outputlangs->setDefaultLang($newlang);
657 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
659 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $user->hasRight(
'ficheinter',
'creer')) {
662 if ($objectline->fetch($lineid) <= 0) {
666 $result = $objectline->deleteline($user);
668 if ($object->fetch($objectline->fk_fichinter) <= 0) {
674 $outputlangs = $langs;
677 $newlang =
GETPOST(
'lang_id',
'aZ09');
680 $newlang = $object->thirdparty->default_lang;
682 if (!empty($newlang)) {
684 $outputlangs->setDefaultLang($newlang);
689 } elseif ($action ==
'up' && $user->hasRight(
'ficheinter',
'creer')) {
691 $object->line_up($lineid);
694 $outputlangs = $langs;
697 $newlang =
GETPOST(
'lang_id',
'aZ09');
700 $newlang = $object->thirdparty->default_lang;
702 if (!empty($newlang)) {
704 $outputlangs->setDefaultLang($newlang);
710 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
712 } elseif ($action ==
'down' && $user->hasRight(
'ficheinter',
'creer')) {
713 $object->line_down($lineid);
716 $outputlangs = $langs;
719 $newlang =
GETPOST(
'lang_id',
'aZ09');
722 $newlang = $object->thirdparty->default_lang;
724 if (!empty($newlang)) {
726 $outputlangs->setDefaultLang($newlang);
732 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#'.$lineid);
737 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
740 $triggersendname =
'FICHINTER_SENTBYMAIL';
741 $autocopy =
'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
742 $trackid =
'int'.$object->id;
743 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
746 $upload_dir = $conf->ficheinter->dir_output;
747 $permissiontoadd = $user->rights->ficheinter->creer;
748 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
750 if ($action ==
'update_extras') {
751 $object->oldcopy =
dol_clone($object, 2);
754 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
761 $result = $object->insertExtraFields(
'INTERVENTION_MODIFY');
769 $action =
'edit_extras';
773 if (
getDolGlobalString(
'MAIN_DISABLE_CONTACTS_TAB') && $user->hasRight(
'ficheinter',
'creer')) {
774 if ($action ==
'addcontact') {
775 if ($result > 0 && $id > 0) {
778 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
782 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
785 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
786 $langs->load(
"errors");
787 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
789 $mesg = $object->error;
792 } elseif ($action ==
'swapstatut') {
794 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
795 } elseif ($action ==
'deletecontact') {
797 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
800 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
814$form =
new Form($db);
816if (isModEnabled(
'contrat')) {
819if (isModEnabled(
'project')) {
824$help_url =
'EN:Module_Interventions';
826llxHeader(
'', $langs->trans(
"Intervention"), $help_url);
828if ($action ==
'create') {
833 print
load_fiche_titre($langs->trans(
"AddIntervention"),
'',
'intervention');
842 $res = $soc->fetch($socid);
845 if (
GETPOST(
'origin',
'alphanohtml') &&
GETPOST(
'originid',
'int')) {
848 $element = $subelement =
GETPOST(
'origin',
'alphanohtml');
849 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin',
'alphanohtml'), $regs)) {
851 $subelement = $regs[2];
854 if ($element ==
'project') {
855 $projectid =
GETPOST(
'originid',
'int');
858 if ($element ==
'order' || $element ==
'commande') {
859 $element = $subelement =
'commande';
861 if ($element ==
'propal') {
862 $element =
'comm/propal';
863 $subelement =
'propal';
865 if ($element ==
'contract') {
866 $element = $subelement =
'contrat';
871 $classname = ucfirst($subelement);
872 $objectsrc =
new $classname($db);
873 $objectsrc->fetch(
GETPOST(
'originid'));
874 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
875 $objectsrc->fetch_lines();
876 $lines = $objectsrc->lines;
878 $objectsrc->fetch_thirdparty();
880 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
882 $soc = $objectsrc->thirdparty;
884 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private :
GETPOST(
'note_private',
'restricthtml')));
885 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public :
GETPOST(
'note_public',
'restricthtml'));
888 $objectsrc->fetch_optionals();
889 $object->array_options = $objectsrc->array_options;
892 $srccontactslist = $objectsrc->liste_contact(-1,
'external', 1);
895 $projectid =
GETPOST(
'projectid',
'int');
898 if (!$conf->global->FICHEINTER_ADDON) {
899 dol_print_error($db, $langs->trans(
"Error").
" ".$langs->trans(
"Error_FICHEINTER_ADDON_NotDefined"));
905 $obj = $conf->global->FICHEINTER_ADDON;
915 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
916 print
'<input type="hidden" name="token" value="'.newToken().
'">';
917 print
'<input type="hidden" name="socid" value='.$soc->id.
'>';
918 print
'<input type="hidden" name="action" value="add">';
919 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
923 print
'<table class="border centpercent">';
925 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"ThirdParty").
'</td><td>'.$soc->getNomUrl(1).
'</td></tr>';
928 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
"Draft").
'</td></tr>';
931 print
'<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans(
'RefCustomer').
'</td><td class="valuefieldcreate">';
932 print
'<input type="text" name="ref_client" value="'.GETPOST(
'ref_client').
'"></td>';
936 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
938 print
'<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
GETPOST(
'description').
'</textarea>';
942 if (isModEnabled(
'project')) {
945 $langs->load(
"project");
947 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
954 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid');
955 if ($numprojet == 0) {
956 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>';
962 if (isModEnabled(
'contrat')) {
963 $langs->load(
"contracts");
964 print
'<tr><td>'.$langs->trans(
"Contract").
'</td><td>';
965 $numcontrat = $formcontract->select_contract($soc->id,
GETPOST(
'contratid',
'int'),
'contratid', 0, 1, 1);
966 if ($numcontrat == 0) {
967 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>';
974 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
977 print $form->selectarray(
'model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
982 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
984 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
985 print $doleditor->Create(1);
990 if (empty($user->socid)) {
992 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
994 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
995 print $doleditor->Create(1);
1001 $parameters = array();
1002 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1003 print $hookmanager->resPrint;
1004 if (empty($reshook)) {
1005 print $object->showOptionals($extrafields,
'create');
1009 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1010 $newclassname = $classname;
1011 if ($newclassname ==
'Propal') {
1012 $newclassname =
'CommercialProposal';
1014 print
'<tr><td>'.$langs->trans($newclassname).
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1043 if (is_object($objectsrc)) {
1044 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1045 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1046 } elseif ($origin ==
'project' && !empty($projectid)) {
1047 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1052 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1055 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1056 $title = $langs->trans(
'Services');
1059 print
'<div class="div-table-responsive-no-min">';
1060 print
'<table class="noborder centpercent">';
1062 $objectsrc->printOriginLinesList(!
getDolGlobalString(
'FICHINTER_PRINT_PRODUCTS') ?
'services' :
'');
1070 print
'<form name="fichinter" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1071 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1072 print
'<input type="hidden" name="action" value="create">';
1073 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1077 if (is_object($objectsrc)) {
1078 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1079 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1080 } elseif ($origin ==
'project' && !empty($projectid)) {
1081 print
'<input type="hidden" name="projectid" value="'.$projectid.
'">';
1083 print
'<table class="border centpercent">';
1084 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ThirdParty").
'</td><td>';
1085 print $form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0,
null, 0,
'minwidth300');
1086 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>';
1092 print $form->buttonsSaveCancel(
"CreateDraftIntervention");
1096} elseif ($id > 0 || !empty($ref)) {
1099 $object->fetch($id, $ref);
1100 $object->fetch_thirdparty();
1103 $soc->fetch($object->socid);
1113 print
dol_get_fiche_head($head,
'card', $langs->trans(
"InterventionCard"), -1,
'intervention');
1118 if ($action ==
'delete') {
1119 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteIntervention'), $langs->trans(
'ConfirmDeleteIntervention'),
'confirm_delete',
'', 0, 1);
1123 if ($action ==
'validate') {
1125 $ref = substr($object->ref, 1, 4);
1126 if ($ref ==
'PROV') {
1127 $numref = $object->getNextNumRef($soc);
1128 if (empty($numref)) {
1133 $numref = $object->ref;
1135 $text = $langs->trans(
'ConfirmValidateIntervention', $numref);
1136 if (isModEnabled(
'notification')) {
1137 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1138 $notify =
new Notify($db);
1140 $text .= $notify->confirmMessage(
'FICHINTER_VALIDATE', $object->socid, $object);
1143 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateIntervention'), $text,
'confirm_validate',
'', 1, 1);
1147 if ($action ==
'classifydone') {
1148 $text = $langs->trans(
'ConfirmCloseIntervention');
1149 if (isModEnabled(
'notification')) {
1150 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1151 $notify =
new Notify($db);
1153 $text .= $notify->confirmMessage(
'FICHINTER_CLOSE', $object->socid, $object);
1155 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'CloseIntervention'), $text,
'confirm_done',
'', 0, 1);
1159 if ($action ==
'modify') {
1160 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ModifyIntervention'), $langs->trans(
'ConfirmModifyIntervention'),
'confirm_modify',
'', 0, 1);
1164 if ($action ==
'reopen') {
1165 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReopenIntervention', $object->ref),
'confirm_reopen',
'', 0, 1);
1169 if ($action ==
'ask_deleteline') {
1170 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&line_id='.$lineid, $langs->trans(
'DeleteInterventionLine'), $langs->trans(
'ConfirmDeleteInterventionLine'),
'confirm_deleteline',
'', 0, 1);
1174 if ($action ==
'clone') {
1176 $formquestion = array(
1182 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' => $form->select_company(
GETPOST(
'socid',
'int'),
'socid',
'',
'', 0, 0,
null, 0,
'minwidth200')));
1184 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneIntervention', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1187 if (!$formconfirm) {
1188 $parameters = array(
'formConfirm' => $formconfirm,
'lineid'=>$lineid);
1189 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1190 if (empty($reshook)) {
1191 $formconfirm .= $hookmanager->resPrint;
1192 } elseif ($reshook > 0) {
1193 $formconfirm = $hookmanager->resPrint;
1202 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1205 $morehtmlref =
'<div class="refidno">';
1207 $morehtmlref.=$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'', 0, 1);
1208 $morehtmlref.=$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, $user->hasRight(
'ficheinter',
'creer'),
'string',
'',
null,
null,
'', 1);
1210 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'customer');
1212 if (isModEnabled(
'project')) {
1213 $langs->load(
"projects");
1214 $morehtmlref .=
'<br>';
1215 if ($usercancreate) {
1216 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1217 if ($action !=
'classify') {
1218 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1220 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1222 if (!empty($object->fk_project)) {
1224 $proj->fetch($object->fk_project);
1225 $morehtmlref .= $proj->getNomUrl(1);
1227 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1232 $morehtmlref .=
'</div>';
1234 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1237 print
'<div class="fichecenter">';
1238 print
'<div class="fichehalfleft">';
1239 print
'<div class="underbanner clearboth"></div>';
1241 print
'<table class="border tableforfield centpercent">';
1245 print
'<tr><td class="titlefield">'.$langs->trans(
"Dateo").
'</td>';
1247 print $object->dateo ?
dol_print_date($object->dateo,
'daytext') :
' ';
1252 print
'<tr><td>'.$langs->trans(
"Datee").
'</td>';
1254 print $object->datee ?
dol_print_date($object->datee,
'daytext') :
' ';
1259 print
'<tr><td>'.$langs->trans(
"Datet").
'</td>';
1261 print $object->datet ?
dol_print_date($object->datet,
'daytext') :
' ';
1267 print
'<tr><td class="titlefield">';
1268 print $form->editfieldkey(
"Description",
'description', $object->description, $object, $user->hasRight(
'ficheinter',
'creer'),
'textarea');
1270 print $form->editfieldval(
"Description",
'description', $object->description, $object, $user->hasRight(
'ficheinter',
'creer'),
'textarea:8');
1275 if (isModEnabled(
'contrat')) {
1276 $langs->load(
'contracts');
1280 print
'<table class="nobordernopadding centpercent"><tr><td>';
1281 print $langs->trans(
'Contract');
1283 if ($action !=
'contrat') {
1284 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=contrat&id='.$object->id.
'">';
1285 print
img_edit($langs->trans(
'SetContract'), 1);
1288 print
'</tr></table>';
1290 if ($action ==
'contrat') {
1292 $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contrat,
'contratid', 0, 1, 1);
1294 if ($object->fk_contrat) {
1295 $contratstatic =
new Contrat($db);
1296 $contratstatic->fetch($object->fk_contrat);
1298 print $contratstatic->getNomUrl(0,
'', 1);
1309 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1314 print
'<div class="fichehalfright">';
1315 print
'<div class="underbanner clearboth"></div>';
1317 print
'<table class="border tableforfield centpercent">';
1321 print
'<tr><td class="titlefield">'.$langs->trans(
"TotalDuration").
'</td>';
1322 print
'<td>'.convertSecondToTime($object->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
' ('.
convertDurationtoHour($object->duration,
"s").
' '.$langs->trans(
"h").
')</td>';
1331 print
'<div class="clearboth"></div><br>';
1335 $blocname =
'contacts';
1336 $title = $langs->trans(
'ContactsAddresses');
1337 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1341 $blocname =
'notes';
1342 $title = $langs->trans(
'Notes');
1343 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1348 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" name="addinter" method="post">';
1349 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1350 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1351 if ($action ==
'editline') {
1352 print
'<input type="hidden" name="action" value="updateline">';
1353 print
'<input type="hidden" name="line_id" value="'.GETPOST(
'line_id',
'int').
'">';
1355 print
'<input type="hidden" name="action" value="addline">';
1357 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1360 $sql =
'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1361 $sql .=
' ft.date as date_intervention';
1362 $sql .=
' FROM '.MAIN_DB_PREFIX.
'fichinterdet as ft';
1363 $sql .=
' WHERE ft.fk_fichinter = '.((int) $object->id);
1365 $sql .=
' AND ft.duree <> 0';
1367 $sql .=
' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1369 $resql = $db->query($sql);
1371 $num = $db->num_rows($resql);
1376 print
'<table class="noborder centpercent">';
1377 print
'<tr class="liste_titre">';
1381 print
'<td width="5" class="center linecolnum"></td>';
1384 print
'<td class="liste_titre">'.$langs->trans(
'Description').
'</td>';
1385 print
'<td class="liste_titre center">'.$langs->trans(
'Date').
'</td>';
1386 print
'<td class="liste_titre right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1387 print
'<td class="liste_titre"> </td>';
1388 print
'<td class="liste_titre"> </td>';
1392 $objp = $db->fetch_object($resql);
1395 if ($action !=
'editline' ||
GETPOST(
'line_id',
'int') != $objp->rowid) {
1396 print
'<tr class="oddeven">';
1400 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1404 print
'<a name="'.$objp->rowid.
'"></a>';
1408 $objectline->fetch($objp->rowid);
1409 $objectline->fetch_optionals();
1411 $extrafields->fetch_name_optionals_label($objectline->table_element);
1413 if (!empty($extrafields)) {
1414 $temps = $objectline->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
1415 if (!empty($temps)) {
1416 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1425 print
'<td class="center" width="150">'.(!
getDolGlobalString(
'FICHINTER_DATE_WITHOUT_HOUR') ?
dol_print_date($db->jdate($objp->date_intervention),
'dayhour') :
dol_print_date($db->jdate($objp->date_intervention),
'day')).
'</td>';
1433 if ($object->statut == 0 && $user->hasRight(
'ficheinter',
'creer')) {
1434 print
'<td class="center">';
1435 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.newToken().
'&line_id='.$objp->rowid.
'#'.$objp->rowid.
'">';
1438 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteline&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1441 print
'<td class="center">';
1444 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=up&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1448 if ($i < $num - 1) {
1449 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=down&token='.newToken().
'&line_id='.$objp->rowid.
'">';
1456 print
'<td colspan="2"> </td>';
1463 if ($object->statut == 0 && $action ==
'editline' && $user->hasRight(
'ficheinter',
'creer') &&
GETPOST(
'line_id',
'int') == $objp->rowid) {
1464 print
'<tr class="oddeven nohover">';
1468 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1472 print
'<a name="'.$objp->rowid.
'"></a>';
1475 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1476 $doleditor =
new DolEditor(
'np_desc', $objp->description,
'', 164,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1477 $doleditor->Create();
1480 $objectline->fetch($objp->rowid);
1481 $objectline->fetch_optionals();
1483 $extrafields->fetch_name_optionals_label($objectline->table_element);
1485 if (!empty($extrafields)) {
1486 $temps = $objectline->showOptionals($extrafields,
'edit', array(),
'',
'', 1,
'line');
1487 if (!empty($temps)) {
1488 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
1497 print
'<td class="center nowrap">';
1499 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 0, 0, 0,
"date_intervention");
1501 print $form->selectDate($db->jdate($objp->date_intervention),
'di', 1, 1, 0,
"date_intervention");
1506 print
'<td class="right">';
1508 $selectmode =
'select';
1510 $selectmode =
'text';
1512 $form->select_duration(
'duration', $objp->duree, 0, $selectmode);
1516 print
'<td class="center" colspan="5" valign="center">';
1517 print
'<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans(
"Save").
'">';
1518 print
'<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></td>';
1528 if ($object->statut == 0 && $user->hasRight(
'ficheinter',
'creer') && $action !=
'editline' && !
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS')) {
1531 print
'<table class="noborder centpercent">';
1532 print
'<tr class="liste_titre">';
1536 print
'<td width="5" class="center linecolnum"></td>';
1540 print
'<a name="add"></a>';
1541 print $langs->trans(
'Description').
'</td>';
1542 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
1543 print
'<td class="right">'.(!
getDolGlobalString(
'FICHINTER_WITHOUT_DURATION') ? $langs->trans(
'Duration') :
'').
'</td>';
1544 print
'<td colspan="3"> </td>';
1548 print
'<tr class="oddeven nohover">'.
"\n";
1552 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
1558 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1559 $doleditor =
new DolEditor(
'np_desc',
GETPOST(
'np_desc',
'restricthtml'),
'', 100,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_2,
'90%');
1560 $doleditor->Create();
1564 $extrafields->fetch_name_optionals_label($objectline->table_element);
1566 if (is_object($objectline)) {
1567 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
1569 if (!empty($temps)) {
1570 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1579 print
'<td class="center nowrap">';
1582 if (!
GETPOST(
'diday',
'int')) {
1584 $timewithnohour =
dol_mktime(0, 0, 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1586 $timewithnohour =
dol_mktime($timearray[
'hours'], $timearray[
'minutes'], 0, $timearray[
'mon'], $timearray[
'mday'], $timearray[
'year']);
1589 $timewithnohour =
dol_mktime(
GETPOST(
'dihour',
'int'),
GETPOST(
'dimin',
'int'), 0,
GETPOST(
'dimonth',
'int'),
GETPOST(
'diday',
'int'),
GETPOST(
'diyear',
'int'));
1592 print $form->selectDate($timewithnohour,
'di', 0, 0, 0,
"addinter");
1594 print $form->selectDate($timewithnohour,
'di', 1, 1, 0,
"addinter");
1599 print
'<td class="right">';
1601 $selectmode =
'select';
1603 $selectmode =
'text';
1605 $form->select_duration(
'duration', (!
GETPOST(
'durationhour',
'int') && !
GETPOST(
'durationmin',
'int')) ? 3600 : (60 * 60 *
GETPOST(
'durationhour',
'int') + 60 *
GETPOST(
'durationmin',
'int')), 0, $selectmode);
1609 print
'<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans(
'Add').
'" name="addline"></td>';
1624 print
'</form>'.
"\n";
1636 print
'<div class="tabsAction">';
1638 $parameters = array();
1639 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1641 if (empty($reshook)) {
1642 if ($user->socid == 0) {
1643 if ($action !=
'editdescription' && ($action !=
'presend')) {
1646 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ficheinter',
'ficheinter_advance',
'validate'))) {
1647 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=validate">'.$langs->trans(
"Validate").
'</a></div>';
1649 print
'<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span></div>';
1655 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modify">';
1657 print $langs->trans(
"Modify");
1659 print $langs->trans(
"SetToDraft");
1666 if ($user->hasRight(
'ficheinter',
'creer')) {
1667 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>';
1669 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'ReOpen').
'</a></div>';
1674 if (empty($user->socid)) {
1676 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'ficheinter',
'ficheinter_advance',
'send')) {
1677 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>';
1679 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1686 print
'<div class="inline-block divButAction">';
1687 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>';
1693 $langs->load(
"propal");
1695 if ($user->hasRight(
'propal',
'creer')) {
1696 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>';
1698 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddProp").
'</a></div>';
1705 $langs->load(
"bills");
1707 if ($user->hasRight(
'facture',
'creer')) {
1708 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>';
1710 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddBill").
'</a></div>';
1716 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>';
1718 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>';
1725 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>';
1729 if ($user->hasRight(
'ficheinter',
'creer')) {
1730 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>';
1734 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.newToken(),
'delete', $permissiontodelete);
1741 if ($action !=
'presend') {
1742 print
'<div class="fichecenter"><div class="fichehalfleft">';
1748 $filedir = $conf->ficheinter->dir_output.
"/".$filename;
1749 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1750 $genallowed = $user->rights->ficheinter->lire;
1751 $delallowed = $user->rights->ficheinter->creer;
1752 print $formfile->showdocuments(
'ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
1755 $linktoelem = $form->showLinkToObjectBlock($object,
null, array(
'fichinter'));
1756 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1760 print
'<br><!-- Link to download main doc -->'.
"\n";
1766 print
'<br><!-- Link to sign -->';
1767 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
1769 print showOnlineSignatureUrl(
'fichinter', $object->ref).
'<br>';
1772 print
'</div><div class="fichehalfright">';
1776 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/fichinter/agenda.php?id='.$object->id);
1779 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1781 $somethingshown =
$formactions->showactions($object,
'fichinter', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1783 print
'</div></div>';
1788 if (
GETPOST(
'modelselected')) {
1789 $action =
'presend';
1793 $modelmail =
'fichinter_send';
1794 $defaulttopic =
'SendInterventionRef';
1795 $diroutput = $conf->ficheinter->dir_output;
1796 $trackid =
'int'.$object->id;
1798 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 a 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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.