33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/ticket/class/actions_ticket.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formticket.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
44if (isModEnabled(
'project')) {
45 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
46 include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
47 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
49if (isModEnabled(
'contract')) {
50 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcontract.class.php';
51 include_once DOL_DOCUMENT_ROOT.
'/core/lib/contract.lib.php';
52 include_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
64$langs->loadLangs(array(
"companies",
"other",
"ticket"));
69$track_id =
GETPOST(
'track_id',
'alpha', 3);
73$notifyTiers =
GETPOST(
"notify_tiers_at_create",
'alpha');
75$action =
GETPOST(
'action',
'aZ09');
76$cancel =
GETPOST(
'cancel',
'alpha');
77$backtopage =
GETPOST(
'backtopage',
'alpha');
78$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
81$sortfield =
GETPOST(
'sortfield',
'aZ09comma') ?
GETPOST(
'sortfield',
'aZ09comma') :
"a.datep";
82$sortorder =
GETPOST(
'sortorder',
'aZ09comma') ?
GETPOST(
'sortorder',
'aZ09comma') :
"desc";
83$search_rowid =
GETPOST(
'search_rowid');
84$search_agenda_label =
GETPOST(
'search_agenda_label');
86if (
GETPOST(
'actioncode',
'array')) {
87 $actioncode =
GETPOST(
'actioncode',
'array', 3);
88 if (!count($actioncode)) {
97$hookmanager->initHooks(array(
'ticketcard',
'globalcard'));
103$extrafields->fetch_name_optionals_label(
$object->table_element);
105$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
108$search_all =
GETPOST(
"search_all",
'alpha');
110foreach (
$object->fields as $key => $val) {
111 if (
GETPOST(
'search_'.$key,
'alpha')) {
112 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
116if (empty($action) && empty($id) && empty($ref)) {
121if (
GETPOST(
'modelselected',
'alpha')) {
127if ($id || $track_id || $ref) {
128 $res =
$object->fetch($id, $ref, $track_id);
140$url_page_current = DOL_URL_ROOT.
'/ticket/card.php';
143if ($user->socid > 0) {
144 $socid = $user->socid;
148$triggermodname =
'TICKET_MODIFY';
151$permissiontoread = $user->hasRight(
'ticket',
'read');
152$permissiontoadd = $user->hasRight(
'ticket',
'write');
153$permissiontodelete = $user->hasRight(
'ticket',
'delete');
155$upload_dir =
$conf->ticket->dir_output;
163$parameters = array();
164$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
170if (empty($reshook)) {
172 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
174 $search_agenda_label =
'';
177 $backurlforlist = DOL_URL_ROOT .
'/ticket/list.php';
179 if (empty($backtopage) || ($cancel && empty($id))) {
180 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
181 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
182 $backtopage = $backurlforlist;
184 $backtopage = DOL_URL_ROOT .
'/ticket/card.php?id=' . ((!empty($id) &&
$id > 0) ? $id :
'__ID__');
190 if (!empty($backtopageforcancel)) {
191 header(
"Location: " . $backtopageforcancel);
193 } elseif (!empty($backtopage)) {
194 header(
"Location: " . $backtopage);
200 if ((($action ==
'add' &&
GETPOST(
'save',
'alpha')) || ($action ==
'update' &&
$object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) {
201 $ifErrorAction = ($action ==
'add' ?
'create' :
'edit');
202 if ($action ==
'add') {
208 'ref' => [
'check' =>
'alpha',
'langs' =>
'Ref'],
209 'type_code' => [
'check' =>
'alpha',
'langs' =>
'TicketTypeRequest'],
210 'category_code' => [
'check' =>
'alpha',
'langs' =>
'TicketCategory'],
211 'severity_code' => [
'check' =>
'alpha',
'langs' =>
'TicketSeverity'],
212 'subject' => [
'check' =>
'alphanohtml',
'langs' =>
'Subject'],
213 'message' => [
'check' =>
'restricthtml',
'langs' =>
'Message']
218 if (!empty($error)) {
219 $action = $ifErrorAction;
222 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
226 $getRef =
GETPOST(
'ref',
'alpha');
228 if (!empty($getRef)) {
229 $isExistingRef =
$object->checkExistingRef($action, $getRef);
231 $isExistingRef =
true;
236 if ($isExistingRef) {
237 if ($action ==
'update') {
241 } elseif ($action ==
'add') {
246 if (!empty($getRef)) {
259 $fk_user_assign =
GETPOSTINT(
'fk_user_assign');
263 if ($fk_user_assign > 0) {
264 $object->fk_user_assign = $fk_user_assign;
265 $object->status = $object::STATUS_ASSIGNED;
268 if ($action ==
'add') {
270 $object->type_label = $langs->trans($langs->getLabelFromKey($db,
$object->type_code,
'c_ticket_type',
'code',
'label'));
271 $object->category_label = $langs->trans($langs->getLabelFromKey($db,
$object->category_code,
'c_ticket_category',
'code',
'label'));
272 $object->severity_label = $langs->trans($langs->getLabelFromKey($db,
$object->severity_code,
'c_ticket_severity',
'code',
'label'));
273 $object->fk_user_create = $user->id;
274 $object->email_from = $user->email;
276 $notifyTiers =
GETPOST(
"notify_tiers_at_create",
'alpha');
277 $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1;
287 $action = $ifErrorAction;
292 $categories =
GETPOST(
'categories',
'array');
293 $object->setCategories($categories);
296 if ($action ==
'add') {
300 $type_contact =
GETPOST(
"type",
'alpha');
302 if ($contactid > 0 && $type_contact) {
304 $result =
$object->add_contact($contactid, $typeid,
'external');
308 if (
GETPOST(
'origin',
'alpha') ==
'projet') {
314 if ($projectid > 0) {
315 $object->setProject($projectid);
319 if (
getDolGlobalString(
'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND') && $user->hasRight(
'ticket',
'write')) {
320 if (!
$object->markAsRead($user) > 0) {
326 if ((empty($fk_user_assign) &&
getDolGlobalInt(
'TICKET_AUTO_ASSIGN_USER_CREATE') == 1) || (
getDolGlobalInt(
'TICKET_AUTO_ASSIGN_USER_CREATE') == 2)) {
327 $result =
$object->assignUser($user, $user->id, 1);
328 $object->add_contact($user->id,
"SUPPORTTEC",
'internal');
334 $object->copyFilesForTicket(
'');
340 if (!empty($backtopage)) {
344 $url =
'card.php?track_id=' . urlencode(
$object->track_id);
347 $url =
'card.php?track_id=' . urlencode(
$object->track_id);
350 header(
"Location: " . $url);
357 $action = $ifErrorAction;
362 if ($action ==
"set_read" && $permissiontoadd) {
365 if (
$object->markAsRead($user) > 0) {
368 header(
"Location: card.php?track_id=" .
$object->track_id);
377 if ($action ==
"assign_user" &&
GETPOST(
'btn_assign_user',
'alpha') && $permissiontoadd) {
379 $useroriginassign =
$object->fk_user_assign;
389 $ret =
$object->assignUser($user, $usertoassign);
397 if ($useroriginassign > 0) {
398 $internal_contacts =
$object->listeContact(-1,
'internal', 0,
'SUPPORTTEC');
399 foreach ($internal_contacts as $key => $contact) {
400 if ($contact[
'id'] !== $usertoassign) {
401 $result =
$object->delete_contact($contact[
'rowid']);
410 if ($usertoassign > 0 && $usertoassign !== $useroriginassign) {
411 $result =
$object->add_contact($usertoassign,
"SUPPORTTEC",
'internal', $notrigger = 0);
421 $object->fetch_user($usertoassign);
424 header(
"Location: card.php?track_id=" .
$object->track_id);
434 if ($action ==
'add_message' && GETPOSTISSET(
'btn_add_message') && $permissiontoread) {
438 if (!empty($backtopage)) {
441 $url =
'card.php?track_id=' . urlencode(
$object->track_id);
444 header(
"Location: " . $url);
452 if (($action ==
"confirm_close" || $action ==
"confirm_abandon") &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoadd) {
454 if (GETPOSTISSET(
'contactid')) {
458 if (
$object->close($user, ($action ==
"confirm_abandon" ? 1 : 0))) {
461 $url =
'card.php?track_id=' .
GETPOST(
'track_id',
'alpha');
462 header(
"Location: " . $url);
470 if ($action ==
"confirm_public_close" &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoadd) {
472 if ($_SESSION[
'email_customer'] ==
$object->origin_email || $_SESSION[
'email_customer'] ==
$object->thirdparty->email) {
477 setEventMessages(
'<div class="confirm">' . $langs->trans(
'TicketMarkedAsClosed') .
'</div>',
null,
'mesgs');
479 $url =
'card.php?track_id=' .
GETPOST(
'track_id',
'alpha');
480 header(
"Location: " . $url);
488 if ($action ==
'confirm_delete_ticket' &&
GETPOST(
'confirm',
'alpha') ==
"yes" && $permissiontodelete) {
490 if (
$object->delete($user) > 0) {
491 setEventMessages(
'<div class="confirm">' . $langs->trans(
'TicketDeletedSuccess') .
'</div>',
null,
'mesgs');
492 header(
"Location: " . DOL_URL_ROOT .
"/ticket/list.php");
495 $langs->load(
"errors");
496 $mesg =
'<div class="error">' . $langs->trans(
$object->error) .
'</div>';
503 if ($action ==
'set_thirdparty' && $user->hasRight(
'ticket',
'write')) {
506 $url = $_SERVER[
"PHP_SELF"] .
'?track_id=' .
GETPOST(
'track_id',
'alpha');
507 header(
"Location: " . $url);
513 if ($action ==
'set_progression' && $user->hasRight(
'ticket',
'write')) {
517 $url =
'card.php?track_id=' .
$object->track_id;
518 header(
"Location: " . $url);
524 if ($action ==
'set_categories' && $user->hasRight(
'ticket',
'write')) {
528 $url =
'card.php?track_id=' .
$object->track_id;
529 header(
"Location: " . $url);
535 if ($action ==
'setsubject' && $user->hasRight(
'ticket',
'write')) {
537 if ($action ==
'setsubject') {
541 if ($action ==
'setsubject' && empty(
$object->subject)) {
543 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Subject")),
null,
'errors');
547 if (!
$object->update($user) >= 0) {
553 header(
"Location: " . $_SERVER[
'PHP_SELF'] .
"?track_id=" .
$object->track_id);
558 if ($action ==
'confirm_reopen' && $user->hasRight(
'ticket',
'manage') && !
GETPOST(
'cancel')) {
561 if (
$object->status == Ticket::STATUS_CLOSED ||
$object->status == Ticket::STATUS_CANCELED) {
562 if (
$object->fk_user_assign !=
null) {
563 $res =
$object->setStatut(Ticket::STATUS_ASSIGNED,
null,
'',
'TICKET_MODIFY');
565 $res =
$object->setStatut(Ticket::STATUS_NOT_READ,
null,
'',
'TICKET_MODIFY');
568 $url =
'card.php?track_id=' .
$object->track_id;
569 header(
"Location: " . $url);
577 } elseif ($action ==
'classin' && $permissiontoadd) {
580 $object->setProject($projectid);
581 $url =
'card.php?track_id=' .
$object->track_id;
582 header(
"Location: " . $url);
585 } elseif ($action ==
'setcontract' && $permissiontoadd) {
589 $url =
'card.php?track_id=' .
$object->track_id;
590 header(
"Location: " . $url);
593 } elseif ($action ==
"set_message" && $user->hasRight(
'ticket',
'manage')) {
597 $fieldtomodify =
GETPOST(
'message_initial',
'restricthtml');
599 $object->message = $fieldtomodify;
606 setEventMessages($langs->trans(
'TicketMessageSuccesfullyUpdated'),
null,
'mesgs');
614 } elseif ($action ==
'confirm_set_status' && $permissiontoadd && !
GETPOST(
'cancel')) {
619 $res =
$object->setStatut($new_status,
null,
'',
'TICKET_MODIFY');
622 $url =
'card.php?track_id=' .
$object->track_id;
623 header(
"Location: " . $url);
633 if ($action ==
"update_extras" && $permissiontoadd) {
636 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
642 $result =
$object->insertExtraFields(empty($triggermodname) ?
'' : $triggermodname, $user);
650 $action =
'edit_extras';
657 if ($action ==
"change_property" &&
GETPOST(
'btn_update_ticket_prop',
'alpha') && $permissiontoadd) {
661 $object->severity_code =
GETPOST(
'update_value_severity',
'aZ09');
662 $object->category_code =
GETPOST(
'update_value_category',
'aZ09');
675 $permissiondellink = $user->hasRight(
'ticket',
'write');
676 include DOL_DOCUMENT_ROOT .
'/core/actions_dellink.inc.php';
679 include DOL_DOCUMENT_ROOT .
'/core/actions_builddoc.inc.php';
682 $triggersendname =
'TICKET_SENTBYMAIL';
684 $autocopy =
'MAIN_MAIL_AUTOCOPY_TICKET_TO';
685 $trackid =
'tic' .
$object->id;
686 include DOL_DOCUMENT_ROOT .
'/core/actions_sendmails.inc.php';
689 if (GETPOSTISSET(
'actionbis') && $action ==
'presend') {
690 $action =
'presend_addmessage';
699$userstat =
new User($db);
700$form =
new Form($db);
703if (isModEnabled(
'project')) {
707$help_url =
'EN:Module_Ticket|FR:DocumentationModuleTicket';
709$title = $actionobject->getTitle($action);
711llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-ticket page-card');
713if ($action ==
'create' || $action ==
'presend') {
714 if (empty($permissiontoadd)) {
722 $formticket->trackid =
'';
724 if (
GETPOST(
"mode",
"aZ09") ==
'init' && empty($_POST)) {
725 $formticket->clear_attached_files();
728 $formticket->withfromsocid = $socid ? $socid : $user->socid;
729 $formticket->withfromcontactid = $contactid ? $contactid :
'';
730 $formticket->withtitletopic = 1;
731 $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (
getDolGlobalString(
'TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION') ? 1 : 0));
732 $formticket->withusercreate = 0;
733 $formticket->withref = 1;
734 $formticket->fk_user_create = $user->id;
735 $formticket->withfile = 2;
736 $formticket->withextrafields = 1;
737 $formticket->param = array(
'origin' =>
GETPOST(
'origin'),
'originid' =>
GETPOST(
'originid'));
739 $formticket->withcancel = 1;
742 if (
GETPOST(
"mode",
"aZ09") ==
'init') {
743 $formticket->clear_attached_files();
746 $formticket->showForm(1,
'create', 0,
null, $action,
$object);
749} elseif ($action ==
'edit' && $user->rights->ticket->write &&
$object->status < Ticket::STATUS_CLOSED) {
750 if (empty($permissiontoadd)) {
760 $formticket->trackid =
$object->track_id;
761 $formticket->withfromsocid =
$object->socid;
762 $formticket->withtitletopic = 1;
764 $formticket->withnotifytiersatcreate = 0;
765 $formticket->withusercreate = 0;
766 $formticket->withref = 1;
767 $formticket->fk_user_create = $user->id;
768 $formticket->withfile = 0;
769 $formticket->action =
'update';
770 $formticket->withextrafields = 1;
771 $formticket->param = array(
'origin' =>
GETPOST(
'origin'),
'originid' =>
GETPOST(
'originid'));
773 $formticket->withcancel = 1;
775 $formticket->showForm(0,
'edit', 0,
null, $action,
$object);
778} elseif (empty($action) || in_array($action, [
'builddoc',
'view',
'addlink',
'addlinkbyref',
'dellink',
'presend',
'presend_addmessage',
'close',
'abandon',
'delete',
'editcustomer',
'progression',
'categories',
'reopen',
'edit_contrat',
'editsubject',
'edit_extras',
'update_extras',
'edit_extrafields',
'set_extrafields',
'classify',
'sel_contract',
'edit_message_init',
'set_status'])) {
779 if (!empty($res) && $res > 0) {
781 if (!$user->socid && (
getDolGlobalString(
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY') &&
$object->fk_user_assign != $user->id) && !$user->hasRight(
'ticket',
'manage')) {
788 if ($action ==
'close') {
789 $thirdparty_contacts =
$object->getInfosTicketExternalContact(1);
790 $contacts_select = array(
791 '-2' => $langs->trans(
'TicketNotifyAllTiersAtClose'),
792 '-3' => $langs->trans(
'TicketNotNotifyTiersAtClose')
794 foreach ($thirdparty_contacts as $thirdparty_contact) {
795 $contacts_select[$thirdparty_contact[
'id']] = $thirdparty_contact[
'civility'] .
' ' . $thirdparty_contact[
'lastname'] .
' ' . $thirdparty_contact[
'firstname'];
800 $formquestion = array(
802 'name' =>
'contactid',
804 'label' => $langs->trans(
'NotifyThirdpartyOnTicketClosing'),
805 'values' => $contacts_select,
806 'default' => $default
810 $formconfirm = $form->formconfirm($url_page_current.
"?track_id=".
$object->track_id, $langs->trans(
"CloseATicket"), $langs->trans(
"ConfirmCloseAticket"),
"confirm_close", $formquestion,
'', 1);
813 if ($action ==
'abandon') {
814 $formconfirm = $form->formconfirm($url_page_current.
"?track_id=".
$object->track_id, $langs->trans(
"AbandonTicket"), $langs->trans(
"ConfirmAbandonTicket"),
"confirm_abandon",
'',
'', 1);
817 if ($action ==
'delete') {
818 $formconfirm = $form->formconfirm($url_page_current.
"?track_id=".
$object->track_id, $langs->trans(
"Delete"), $langs->trans(
"ConfirmDeleteTicket"),
"confirm_delete_ticket",
'',
'', 1);
821 if ($action ==
'reopen') {
822 $formconfirm = $form->formconfirm($url_page_current.
'?track_id='.
$object->track_id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReOpenTicket'),
'confirm_reopen',
'',
'', 1);
825 if ($action ==
'set_status') {
828 $formconfirm = $form->formconfirm($url_page_current.
"?track_id=".
$object->track_id.
"&new_status=".$new_status, $langs->trans(
"TicketChangeStatus"), $langs->trans(
"TicketConfirmChangeStatus", $langs->transnoentities(
$object->labelStatusShort[$new_status])),
"confirm_set_status",
'',
'', 1);
832 $parameters = array(
'formConfirm' => $formconfirm);
833 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
834 if (empty($reshook)) {
835 $formconfirm .= $hookmanager->resPrint;
836 } elseif ($reshook > 0) {
837 $formconfirm = $hookmanager->resPrint;
844 if ($projectid > 0) {
845 $projectstat =
new Project($db);
846 if ($projectstat->fetch($projectid) > 0) {
847 $projectstat->fetch_thirdparty();
851 $userWrite = $projectstat->restrictedProjectArea($user,
'write');
857 print
dol_get_fiche_head($head,
'ticket', $langs->trans(
"Project"), 0, ($projectstat->public ?
'projectpub' :
'project'));
859 print
'<table class="border centpercent">';
861 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
864 print
'<tr><td width="30%">'.$langs->trans(
'Ref').
'</td><td colspan="3">';
866 if (!$user->hasRight(
'projet',
'all',
'lire')) {
867 $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
868 $projectstat->next_prev_filter =
"rowid:IN:".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
870 print $form->showrefnav($projectstat,
'ref', $linkback, 1,
'ref',
'ref',
'');
874 print
'<tr><td>'.$langs->trans(
"Label").
'</td><td>'.$projectstat->title.
'</td></tr>';
877 print
"<tr><td>".$langs->trans(
"ThirdParty").
"</td>";
878 print
'<td colspan="3">';
879 if ($projectstat->thirdparty->id > 0) {
880 print $projectstat->thirdparty->getNomUrl(1);
888 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
889 if ($projectstat->public) {
890 print $langs->trans(
'SharedProject');
892 print $langs->trans(
'PrivateProject');
898 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>'.$projectstat->getLibStatut(4).
'</td></tr>';
904 print
"ErrorRecordNotFound";
906 } elseif ($socid > 0) {
912 dol_banner_tab(
$object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
918 $object->next_prev_filter =
"te.fk_user_assign:=:".((int) $user->id);
919 } elseif ($user->socid > 0) {
920 $object->next_prev_filter =
"te.fk_soc:=:".((int) $user->socid);
927 $morehtmlref =
'<div class="refidno">';
929 if ($user->hasRight(
'ticket',
'write') && !$user->socid) {
930 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editsubject&token='.
newToken().
'&track_id='.
$object->track_id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetTitle'), 0).
'</a> ';
932 if ($action !=
'editsubject') {
935 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
936 $morehtmlref .=
'<input type="hidden" name="action" value="setsubject">';
937 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
938 $morehtmlref .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
939 $morehtmlref .=
'<input type="text" class="minwidth300" id="subject" name="subject" value="'.$object->subject.
'" autofocus="">';
940 $morehtmlref .=
'<input type="submit" class="smallpaddingimp button valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'">';
941 $morehtmlref .=
'<input type="submit" class="smallpaddingimp button button-cancel vlignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
942 $morehtmlref .=
'</form>';
947 if (
$object->fk_user_create > 0) {
948 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
950 $fuser =
new User($db);
951 $fuser->fetch(
$object->fk_user_create);
952 $morehtmlref .= $fuser->getNomUrl(-1);
956 $createdfrompublicticket = 0;
957 $createdfromemailcollector = 0;
958 if (!empty(
$object->origin_email) && (empty(
$object->email_msgid) || preg_match(
'/dolibarr\-tic\d+/',
$object->email_msgid))) {
960 $createdfrompublicticket = 1;
961 } elseif (!empty(
$object->email_msgid)) {
963 $createdfromemailcollector = 1;
967 if ($createdfrompublicticket) {
968 $htmltooptip = $langs->trans(
"OriginEmail").
': '.
$object->origin_email;
969 $htmltooptip .=
'<br>'.$langs->trans(
"IP").
': '.
$object->ip;
970 $morehtmlref .= ($createdbyshown ?
' - ' :
'<br>');
971 $morehtmlref .= ($createdbyshown ?
'' : $langs->trans(
"CreatedBy").
' : ');
972 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
973 $morehtmlref .=
dol_escape_htmltag(
$object->origin_email).
' <small class="hideonsmartphone opacitymedium">- '.$form->textwithpicto($langs->trans(
"CreatedByPublicPortal"), $htmltooptip, 1,
'help',
'', 0, 3,
'tooltip').
'</small>';
974 } elseif ($createdfromemailcollector) {
975 $langs->load(
"mails");
976 $htmltooltip = $langs->trans(
"EmailMsgID").
': '.
$object->email_msgid;
977 $htmltooltip .=
'<br>'.$langs->trans(
"EmailDate").
': '.
dol_print_date(
$object->email_date,
'dayhour');
978 $htmltooltip .=
'<br>'.$langs->trans(
"MailFrom").
': '.
$object->origin_email;
979 $htmltooltip .=
'<br>'.$langs->trans(
"MailReply").
': '.
$object->origin_replyto;
980 $htmltooltip .=
'<br>'.$langs->trans(
"MailReferences").
': '.
$object->origin_references;
981 $morehtmlref .= ($createdbyshown ?
' - ' :
'<br>');
982 $morehtmlref .= ($createdbyshown ?
'' : $langs->trans(
"CreatedBy").
' : ');
983 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
984 $morehtmlref .=
dol_escape_htmltag(
$object->origin_email).
' <small class="hideonsmartphone opacitymedium">- '.$form->textwithpicto($langs->trans(
"CreatedByEmailCollector"), $htmltooltip, 1,
'help',
'', 0, 3,
'tooltip').
'</small>';
987 $permissiontoedit =
$object->status < 8 && !$user->socid && $user->hasRight(
'ticket',
'write');
991 if (isModEnabled(
"societe")) {
992 $morehtmlref .=
'<br>';
993 $morehtmlref .=
img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth"');
994 if ($action !=
'editcustomer' && $permissiontoedit) {
995 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editcustomer&token='.
newToken().
'&track_id='.
$object->track_id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetThirdParty'), 0).
'</a> ';
997 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.
$object->track_id,
$object->socid, $action ==
'editcustomer' ?
'editcustomer' :
'none',
'', 1, 0, 0, array(), 1);
999 $morehtmlref .=
' - <a href="'.DOL_URL_ROOT.
'/ticket/list.php?socid='.
$object->socid.
'&sortfield=t.datec&sortorder=desc'.(
getDolGlobalBool(
'TICKET_CLIENT_OTHER_TICKET_ONLY_OPEN')?
'&search_fk_statut[]=openall':
'').
'">'.
img_picto($langs->trans(
"Tickets"),
'ticket',
'class="pictofixedwidth"').
' '.$langs->trans(
"TicketHistory").
'</a>';
1004 if (isModEnabled(
'project')) {
1005 $langs->load(
"projects");
1006 $morehtmlref .=
'<br>';
1007 if ($permissiontoedit) {
1009 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project'.((is_object(
$object->project) &&
$object->project->public) ?
'pub' :
''),
'class="pictofixedwidth"');
1010 if ($action !=
'classify') {
1011 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1013 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1015 if (!empty(
$object->fk_project)) {
1017 $morehtmlref .=
$object->project->getNomUrl(1);
1018 if (
$object->project->title) {
1019 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag(
$object->project->title).
'</span>';
1028 if (isModEnabled(
'contract')) {
1029 $langs->load(
'contracts');
1030 $morehtmlref .=
'<br>';
1031 if ($permissiontoedit) {
1032 $morehtmlref .=
img_picto($langs->trans(
"Contract"),
'contract',
'class="pictofixedwidth"');
1033 if ($action ==
'edit_contrat') {
1035 $morehtmlref .= $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contract,
'contratid', 0, 1, 1, 1);
1037 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_contrat&token='.
newToken().
'&id='.
$object->id.
'">';
1038 $morehtmlref .=
img_edit($langs->trans(
'SetContract'));
1039 $morehtmlref .=
'</a>';
1042 if (!empty(
$object->fk_contract)) {
1043 $contratstatic =
new Contrat($db);
1044 $contratstatic->fetch(
$object->fk_contract);
1046 $morehtmlref .= $contratstatic->getNomUrl(0, 0, 1);
1052 $morehtmlref .=
'</div>';
1054 $linkback =
'<a href="'.DOL_URL_ROOT.
'/ticket/list.php?restore_lastsearch_values=1"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
1056 dol_banner_tab(
$object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref);
1058 print
'<div class="fichecenter">';
1059 print
'<div class="fichehalfleft">';
1060 print
'<div class="underbanner clearboth"></div>';
1062 print
'<table class="border tableforfield centpercent">';
1065 print
'<tr><td class="titlefield">'.$langs->trans(
"TicketTrackId").
'</td><td>';
1066 if (!empty(
$object->track_id)) {
1069 print $form->showrefnav(
$object,
'id', $linkback, 1,
'rowid',
'track_id');
1074 print $langs->trans(
'None');
1088 print
'<tr><td>'.$langs->trans(
"DateCreation").
'</td><td>';
1111 print
'<tr><td>'.$langs->trans(
"TicketReadOn").
'</td><td>';
1112 if (!empty(
$object->date_read)) {
1120 print
'<tr><td>'.$langs->trans(
"TicketCloseOn").
'</td><td>';
1121 if (!empty(
$object->date_close)) {
1128 print
'<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
1129 print $langs->trans(
"AssignedTo");
1130 if (isset(
$object->status) &&
$object->status < $object::STATUS_CLOSED &&
GETPOST(
'set',
'alpha') !=
"assign_ticket" && $user->hasRight(
'ticket',
'manage')) {
1131 print
'</td><td class="right"><a class="editfielda" href="'.$url_page_current.
'?track_id='.urlencode(
$object->track_id).
'&set=assign_ticket">'.
img_edit($langs->trans(
'Modify')).
'</a>';
1133 print
'</td></tr></table>';
1135 if (
GETPOST(
'set',
'alpha') !=
"assign_ticket" &&
$object->fk_user_assign > 0) {
1136 $userstat->fetch(
$object->fk_user_assign);
1137 print $userstat->getNomUrl(-1);
1141 if (
GETPOST(
'set',
'alpha') ==
"assign_ticket" &&
$object->status < 8 && !$user->socid && $user->hasRight(
'ticket',
'write')) {
1142 print
'<form method="post" name="ticket" enctype="multipart/form-data" action="'.$url_page_current.
'">';
1143 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1144 print
'<input type="hidden" name="action" value="assign_user">';
1145 print
'<input type="hidden" name="track_id" value="'.$object->track_id.
'">';
1147 print $form->select_dolusers(empty(
$object->fk_user_assign) ? $user->id :
$object->fk_user_assign,
'fk_user_assign', 1);
1148 print
' <input type="submit" class="button smallpaddingimp" name="btn_assign_user" value="'.$langs->trans(
"Validate").
'" />';
1155 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
1156 print $langs->trans(
'Progression').
'</td><td class="left">';
1158 if ($action !=
'progression' && isset(
$object->status) &&
$object->status < $object::STATUS_CLOSED && !$user->socid) {
1159 print
'<td class="right"><a class="editfielda" href="'.$url_page_current.
'?action=progression&token='.
newToken().
'&track_id='.urlencode(
$object->track_id).
'">'.
img_edit($langs->trans(
'Modify')).
'</a></td>';
1161 print
'</tr></table>';
1163 if ($user->hasRight(
'ticket',
'write') && $action ==
'progression') {
1164 print
'<form action="'.$url_page_current.
'" method="post">';
1165 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1166 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1167 print
'<input type="hidden" name="action" value="set_progression">';
1168 print
'<input type="text" class="flat width75" name="progress" value="'.$object->progress.
'">';
1169 print
' <input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
1178 if (isModEnabled(
'intervention')) {
1180 $num = count(
$object->linkedObjects);
1184 foreach (
$object->linkedObjects as $objecttype => $objects) {
1185 if ($objecttype ==
"fichinter") {
1186 '@phan-var-force Fichinter[] $objects';
1187 foreach ($objects as $fichinter) {
1190 $timing += $fichinter->duration;
1196 print $form->textwithpicto($langs->trans(
"TicketDurationAuto"), $langs->trans(
"TicketDurationAutoInfos"), 1);
1203 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1209 print
'</div><div class="fichehalfright">';
1212 print
'<form method="post" name="formticketproperties" action="'.$url_page_current.
'">';
1213 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1214 print
'<input type="hidden" name="action" value="change_property">';
1215 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1216 print
'<input type="hidden" name="trackid" value="'.$trackid.
'">';
1219 print
'<div class="div-table-responsive-no-min">';
1220 print
'<table class="border tableforfield centpercent margintable bordertopimp">';
1221 print
'<tr class="liste_titre">';
1223 print $langs->trans(
'TicketProperties');
1226 if (
GETPOST(
'set',
'alpha') ==
'properties' && $user->hasRight(
'ticket',
'write')) {
1227 print
'<input type="submit" class="button smallpaddingimp" name="btn_update_ticket_prop" value="'.$langs->trans(
"Modify").
'" />';
1230 if (isset(
$object->status) && (
$object->status < $object::STATUS_NEED_MORE_INFO || !
getDolGlobalInt(
'TICKET_DISALLOW_CLASSIFICATION_MODIFICATION_EVEN_IF_CLOSED')) && $user->hasRight(
'ticket',
'write')) {
1231 print
' <a class="editfielda" href="card.php?track_id='.$object->track_id.
'&set=properties">'.
img_edit($langs->trans(
'Modify')).
'</a>';
1237 if (
GETPOST(
'set',
'alpha') ==
'properties' && $user->hasRight(
'ticket',
'write')) {
1240 print
'<td class="titlefield">';
1241 print $langs->trans(
'Type');
1243 $formticket->selectTypesTickets(
$object->type_code,
'update_value_type',
'', 2);
1249 print $langs->trans(
'TicketCategory');
1251 $formticket->selectGroupTickets(
$object->category_code,
'update_value_category',
'', 2, 0, 0, 0,
'maxwidth500 widthcentpercentminusxx');
1257 print $langs->trans(
'TicketSeverity');
1259 $formticket->selectSeveritiesTickets(
$object->severity_code,
'update_value_severity',
'', 2);
1264 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
1265 if (!empty(
$object->type_code)) {
1266 print $langs->getLabelFromKey($db,
'TicketTypeShort'.
$object->type_code,
'c_ticket_type',
'code',
'label',
$object->type_code);
1271 if (!empty(
$object->category_code)) {
1272 $s = $langs->getLabelFromKey($db,
'TicketCategoryShort'.
$object->category_code,
'c_ticket_category',
'code',
'label',
$object->category_code);
1274 print
'<tr><td>'.$langs->trans(
"TicketCategory").
'</td><td class="tdoverflowmax200" title="'.
dol_escape_htmltag($s).
'">';
1278 print
'<tr><td>'.$langs->trans(
"TicketSeverity").
'</td><td>';
1279 if (!empty(
$object->severity_code)) {
1280 print $langs->getLabelFromKey($db,
'TicketSeverityShort'.
$object->severity_code,
'c_ticket_severity',
'code',
'label',
$object->severity_code);
1290 if (isModEnabled(
'category')) {
1291 print
'<table class="border centpercent tableforfield">';
1293 print
'<td class="valignmiddle titlefield">';
1294 print
'<table class="nobordernopadding centpercent"><tr><td class="titlefield">';
1295 print $langs->trans(
"Categories");
1296 if ($action !=
'categories' && !$user->socid) {
1297 print
'<td class="right"><a class="editfielda" href="'.$url_page_current.
'?action=categories&track_id='.
$object->track_id.
'">'.
img_edit($langs->trans(
'Modify')).
'</a></td>';
1302 if ($user->hasRight(
'ticket',
'write') && $action ==
'categories') {
1303 $cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET,
'',
'parent', 64, 0, 3);
1304 if (is_array($cate_arbo)) {
1306 print
'<td colspan="3">';
1307 print
'<form action="'.$url_page_current.
'" method="POST">';
1308 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1309 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1310 print
'<input type="hidden" name="action" value="set_categories">';
1313 $cats = $category->containing(
$object->id,
'ticket');
1314 $arrayselected = array();
1315 foreach ($cats as $cat) {
1316 $arrayselected[] = $cat->id;
1319 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'maxwidth500 widthcentpercentminusx', 0, 0);
1320 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Save').
'">';
1325 print
'<td colspan="3">';
1326 print $form->showCategories(
$object->id, Categorie::TYPE_TICKET, 1);
1334 $actionobject->viewTicketOriginalMessage($user, $action,
$object);
1338 print
'<!-- navbar with status -->';
1339 if (!$user->socid && $user->hasRight(
'ticket',
'write') && isset(
$object->status) &&
$object->status < $object::STATUS_CLOSED) {
1340 $actionobject->viewStatusActions(
$object);
1345 print
load_fiche_titre($langs->trans(
'Contacts'),
'',
'title_companies.png');
1347 print
'<div class="div-table-responsive-no-min">';
1348 print
'<div class="tagtable centpercent noborder allwidth">';
1350 print
'<div class="tagtr liste_titre">';
1351 print
'<div class="tagtd">'.$langs->trans(
"Source").
'</div>
1352 <div class="tagtd">' . $langs->trans(
"Company").
'</div>
1353 <div class="tagtd">' . $langs->trans(
"Contacts").
'</div>
1354 <div class="tagtd">' . $langs->trans(
"ContactType").
'</div>
1355 <div class="tagtd">' . $langs->trans(
"Phone").
'</div>
1356 <div class="tagtd center">' . $langs->trans(
"Status").
'</div>';
1357 print
'</div><!-- tagtr -->';
1360 $companystatic =
new Societe($db);
1361 $contactstatic =
new Contact($db);
1362 $userstatic =
new User($db);
1364 foreach (array(
'internal',
'external') as $source) {
1366 $tab = $tmpobject->listeContact(-1, $source);
1367 '@phan-var-force array<array{source:string,id:int,rowid:int,email:string,civility:string,firstname:string,lastname:string,labeltype:string,libelle:string,socid:int,code:string,status:int,statuscontact:string,fk_c_typecontact:string,phone:string,phone_mobile:string,phone_perso?:string,nom:string}> $tab';
1368 $num = is_array($tab) ? 0 : count($tab);
1370 foreach (array_keys($tab) as $i) {
1372 print
'<div class="tagtr '.($var ?
'pair' :
'impair').
'">';
1374 print
'<div class="tagtd left">';
1375 if ($tab[$i][
'source'] ==
'internal') {
1376 echo $langs->trans(
"User");
1379 if ($tab[$i][
'source'] ==
'external') {
1380 echo $langs->trans(
"ThirdPartyContact");
1384 print
'<div class="tagtd left">';
1386 if ($tab[$i][
'socid'] > 0) {
1387 $companystatic->fetch($tab[$i][
'socid']);
1388 echo $companystatic->getNomUrl(-1);
1390 if ($tab[$i][
'socid'] < 0) {
1393 if (!$tab[$i][
'socid']) {
1398 print
'<div class="tagtd">';
1399 if ($tab[$i][
'source'] ==
'internal') {
1400 if ($userstatic->fetch($tab[$i][
'id'])) {
1401 print $userstatic->getNomUrl(-1);
1404 if ($tab[$i][
'source'] ==
'external') {
1405 if ($contactstatic->fetch($tab[$i][
'id'])) {
1406 print $contactstatic->getNomUrl(-1);
1410 <div class="tagtd">' . $tab[$i][
'libelle'].
'</div>';
1412 print
'<div class="tagtd">';
1416 if (!empty($tab[$i][
'phone_perso'])) {
1418 print
'<br>'.dol_print_phone($tab[$i][
'phone_perso'],
'', 0, 0,
'AC_TEL').
'<br>';
1420 if (!empty($tab[$i][
'phone_mobile'])) {
1422 print
dol_print_phone($tab[$i][
'phone_mobile'],
'', 0, 0,
'AC_TEL').
'<br>';
1426 print
'<div class="tagtd center">';
1428 echo
'<a href="contact.php?track_id='.$object->track_id.
'&action=swapstatut&ligne='.$tab[$i][
'rowid'].
'">';
1431 if ($tab[$i][
'source'] ==
'internal') {
1432 $userstatic->id = $tab[$i][
'id'];
1433 $userstatic->lastname = $tab[$i][
'lastname'];
1434 $userstatic->firstname = $tab[$i][
'firstname'];
1435 echo $userstatic->LibStatut($tab[$i][
'statuscontact'], 3);
1437 if ($tab[$i][
'source'] ==
'external') {
1438 $contactstatic->id = $tab[$i][
'id'];
1439 $contactstatic->lastname = $tab[$i][
'lastname'];
1440 $contactstatic->firstname = $tab[$i][
'firstname'];
1441 echo $contactstatic->LibStatut($tab[$i][
'statuscontact'], 3);
1449 print
'</div><!-- tagtr -->';
1455 print
'</div><!-- contact list -->';
1459 print
'</div></div>';
1460 print
'<div class="clearboth"></div>';
1466 if ($action !=
'presend' && $action !=
'presend_addmessage' && $action !=
'editline') {
1467 print
'<div class="tabsAction">'.
"\n";
1468 $parameters = array();
1469 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1474 if (empty($reshook)) {
1476 if (isset(
$object->status) &&
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage") {
1477 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend_addmessage&send_email=1&private_message=0&mode=init&token='.
newToken().
'&track_id='.
$object->track_id.
'#formmailbeforetitle',
'');
1481 if (isset(
$object->status) &&
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage") {
1482 print
dolGetButtonAction(
'', $langs->trans(
'TicketAddPrivateMessage'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend_addmessage&mode=init&token='.
newToken().
'&track_id='.
$object->track_id.
'#formmailbeforetitle',
'');
1488 print
dolGetButtonAction($langs->trans(
'UnableToCreateInterIfNoSocid'), $langs->trans(
'TicketAddIntervention'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1490 if (
$object->fk_soc > 0 && isset(
$object->status) &&
$object->status < Ticket::STATUS_CLOSED && $user->hasRight(
'ficheinter',
'creer')) {
1491 print
dolGetButtonAction(
'', $langs->trans(
'TicketAddIntervention'),
'default', DOL_URL_ROOT.
'/fichinter/card.php?action=create&token='.
newToken().
'&socid='.
$object->fk_soc.
'&origin=ticket_ticket&originid='.
$object->id,
'');
1495 if (isset(
$object->status) &&
$object->status >= 0 &&
$object->status < Ticket::STATUS_CLOSED && $user->hasRight(
'ticket',
'write')) {
1496 print
dolGetButtonAction(
'', $langs->trans(
'CloseTicket'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.
newToken().
'&track_id='.
$object->track_id,
'');
1500 if (isset(
$object->status) &&
$object->status > 0 &&
$object->status < Ticket::STATUS_CLOSED && $user->hasRight(
'ticket',
'write')) {
1501 print
dolGetButtonAction(
'', $langs->trans(
'AbandonTicket'),
'default', $_SERVER[
"PHP_SELF"].
'?action=abandon&token='.
newToken().
'&track_id='.
$object->track_id,
'');
1505 if (!$user->socid && (isset(
$object->status) && (
$object->status == Ticket::STATUS_CLOSED ||
$object->status == Ticket::STATUS_CANCELED)) && !$user->socid) {
1510 if ($permissiontoedit) {
1511 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoedit);
1515 if ($user->hasRight(
'ticket',
'delete') && !$user->socid) {
1519 print
'</div>'.
"\n";
1523 if (
GETPOST(
'modelselected')) {
1524 $action =
'presend';
1527 if (GETPOSTISSET(
'actionbis') && $action ==
'presend') {
1528 $action =
'presend_addmessage';
1532 if ($action ==
'presend' || $action ==
'presend_addmessage') {
1537 $outputlangs = $langs;
1540 $newlang =
GETPOST(
'lang_id',
'aZ09');
1542 $newlang =
$object->thirdparty->default_lang;
1544 if (!empty($newlang)) {
1546 $outputlangs->setDefaultLang($newlang);
1549 $arrayoffamiliestoexclude = array(
'objectamount');
1551 $action =
'add_message';
1552 $modelmail =
'ticket_send';
1555 $morehtmlright =
'';
1559 $morehtmlright .= $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"TicketMessageSubstitutionReplacedByGenericValues").
'</span>', $help, 1,
'helpclickable',
'', 0, 3,
'helpsubstitution');
1563 print
'<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
1565 print
load_fiche_titre($langs->trans(
'TicketAddMessage'), $morehtmlright,
'messages@ticket');
1571 $formticket->action = $action;
1572 $formticket->track_id =
$object->track_id;
1573 $formticket->ref =
$object->ref;
1574 $formticket->id =
$object->id;
1575 $formticket->trackid =
'tic'.$object->id;
1577 $formticket->withfile = 2;
1578 $formticket->withcancel = 1;
1579 $formticket->param = array(
'fk_user_create' => $user->id);
1580 $formticket->param[
'langsmodels'] = (empty($newlang) ? $langs->defaultlang : $newlang);
1583 $formticket->param[
'models'] = $modelmail;
1584 $formticket->param[
'models_id'] =
GETPOSTINT(
'modelmailselected');
1586 $formticket->param[
'returnurl'] = $_SERVER[
"PHP_SELF"].
'?track_id='.
$object->track_id;
1588 $formticket->withsubstit = 1;
1589 $formticket->substit = $substitutionarray;
1590 $formticket->backtopage = $backtopage;
1592 $formticket->showMessageForm(
'100%');
1598 $param =
'&id='.$object->id;
1599 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1600 $param .=
'&contextpage='.$contextpage;
1602 if ($limit > 0 && $limit !=
$conf->liste_limit) {
1603 $param .=
'&limit='.$limit;
1606 $param .=
'&actioncode='.urlencode($actioncode);
1608 if ($search_agenda_label) {
1609 $param .=
'&search_agenda_label='.urlencode($search_agenda_label);
1612 $morehtmlright =
'';
1614 $messagingUrl = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.
$object->track_id;
1615 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'MessageListViewType'),
'',
'fa fa-bars imgforviewmode', $messagingUrl,
'', 1);
1618 $btnstatus =
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage" && $action !=
"add_message";
1619 $url =
'card.php?track_id='.$object->track_id.
'&action=presend_addmessage&mode=init';
1620 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'TicketAddMessage'),
'',
'fa fa-comment-dots', $url,
'add-new-ticket-title-button', (
int) $btnstatus);
1623 $btnstatus =
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage" && $action !=
"add_message";
1624 $url =
dol_buildpath(
'/comm/action/card.php', 1).
'?action=create&datep='.date(
'YmdHi').
'&origin=ticket&originid='.
$object->id.
'&projectid='.
$object->fk_project.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?track_id='.
$object->track_id);
1625 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', $url,
'add-new-ticket-even-button', (
int) $btnstatus);
1627 print_barre_liste($langs->trans(
"ActionsOnTicket"), 0, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 1);
1631 $filters[
'search_agenda_label'] = $search_agenda_label;
1632 $filters[
'search_rowid'] = $search_rowid;
1634 show_actions_messaging(
$conf, $langs, $db,
$object,
null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
1637 if ($action !=
'presend' && $action !=
'presend_addmessage' && $action !=
'add_message') {
1638 print
'<div class="fichecenter"><div class="fichehalfleft">';
1639 print
'<a name="builddoc"></a>';
1645 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1646 $genallowed = $permissiontoadd;
1647 $delallowed = $permissiontodelete;
1651 $codelang =
$object->thirdparty->default_lang;
1654 print $formfile->showdocuments(
'ticket', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', $codelang);
1657 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(
'ticket'), 1);
1658 $linktoelem = $tmparray[
'linktoelem'];
1659 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
1660 print $htmltoenteralink;
1662 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
1665 print
'<br><!-- Link to public interface -->'.
"\n";
1670 print
'<div class="fichehalfright">';
1674 $morehtmlcenter =
'<div class="nowraponall">';
1675 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/ticket/messaging.php?id='.
$object->id);
1676 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/ticket/agenda.php?id='.
$object->id);
1677 $morehtmlcenter .=
'</div>';
1680 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1682 $somethingshown = $formactions->showactions(
$object,
'ticket', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class Actions of the module ticket.
Class to manage categories.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
show_actions_messaging($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
Show html area with actions in messaging format.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='paddingright')
Format phone numbers according to country.
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.
roundUpToNextMultiple($n, $x=5)
Round to next multiple.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dolPrintLabel($s, $escapeonlyhtmltags=0)
Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalBool($key, $default=false)
Return a Dolibarr global constant boolean value.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Class to generate the form for creating a new ticket.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
showDirectPublicLink($object)
Return string with full Url.
ticket_prepare_head($object)
Build tabs for a Ticket object.