31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/ticket/class/actions_ticket.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formticket.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
41if (isModEnabled(
'project')) {
42 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
43 include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
44 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
46if (isModEnabled(
'contrat')) {
47 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcontract.class.php';
48 include_once DOL_DOCUMENT_ROOT.
'/core/lib/contract.lib.php';
49 include_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
53$langs->loadLangs(array(
"companies",
"other",
"ticket"));
58$track_id =
GETPOST(
'track_id',
'alpha', 3);
59$socid =
GETPOST(
'socid',
'int');
60$contactid =
GETPOST(
'contactid',
'int');
61$projectid =
GETPOST(
'projectid',
'int');
62$notifyTiers =
GETPOST(
"notify_tiers_at_create",
'alpha');
64$action =
GETPOST(
'action',
'aZ09');
65$cancel =
GETPOST(
'cancel',
'alpha');
66$backtopage =
GETPOST(
'backtopage',
'alpha');
67$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
69$sortfield =
GETPOST(
'sortfield',
'aZ09comma') ?
GETPOST(
'sortfield',
'aZ09comma') :
"a.datep";
70$sortorder =
GETPOST(
'sortorder',
'aZ09comma') ?
GETPOST(
'sortorder',
'aZ09comma') :
"desc";
71$search_rowid =
GETPOST(
'search_rowid');
72$search_agenda_label =
GETPOST(
'search_agenda_label');
74if (
GETPOST(
'actioncode',
'array')) {
75 $actioncode =
GETPOST(
'actioncode',
'array', 3);
76 if (!count($actioncode)) {
85$hookmanager->initHooks(array(
'ticketcard',
'globalcard'));
91$extrafields->fetch_name_optionals_label($object->table_element);
93$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
96$search_all =
GETPOST(
"search_all",
'alpha');
98foreach ($object->fields as $key => $val) {
99 if (
GETPOST(
'search_'.$key,
'alpha')) {
100 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
104if (empty($action) && empty($id) && empty($ref)) {
109if (
GETPOST(
'modelselected',
'alpha')) {
115if ($id || $track_id || $ref) {
116 $res = $object->fetch($id, $ref, $track_id);
119 $track_id = $object->track_id;
128$url_page_current = DOL_URL_ROOT.
'/ticket/card.php';
131if ($user->socid > 0) {
132 $socid = $user->socid;
136$triggermodname =
'TICKET_MODIFY';
139$permissiontoread = $user->hasRight(
'ticket',
'read');
140$permissiontoadd = $user->hasRight(
'ticket',
'write');
141$permissiontodelete = $user->hasRight(
'ticket',
'delete');
143$upload_dir = $conf->ticket->dir_output;
151$parameters = array();
152$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
158if (empty($reshook)) {
160 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
162 $search_agenda_label =
'';
165 $backurlforlist = DOL_URL_ROOT.
'/ticket/list.php';
167 if (empty($backtopage) || ($cancel && empty($id))) {
168 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
169 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
170 $backtopage = $backurlforlist;
172 $backtopage = DOL_URL_ROOT.
'/ticket/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
178 if (!empty($backtopageforcancel)) {
179 header(
"Location: ".$backtopageforcancel);
181 } elseif (!empty($backtopage)) {
182 header(
"Location: ".$backtopage);
189 if (
GETPOST(
'save',
'alpha') && $permissiontoadd) {
192 if (!
GETPOST(
"type_code",
'alpha')) {
194 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"TicketTypeRequest")),
null,
'errors');
196 } elseif (!
GETPOST(
"category_code",
'alpha')) {
198 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"TicketCategory")),
null,
'errors');
200 } elseif (!
GETPOST(
"severity_code",
'alpha')) {
202 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"TicketSeverity")),
null,
'errors');
204 } elseif (!
GETPOST(
"subject",
'alphanohtml')) {
206 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Subject")),
null,
'errors');
208 } elseif (!
GETPOST(
"message",
'restricthtml')) {
210 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Message")),
null,
'errors');
213 $ret = $extrafields->setOptionalsFromPost(
null, $object);
221 $getRef =
GETPOST(
"ref",
'alphanohtml');
224 if ($test->fetch(
'', $getRef) > 0) {
225 $object->ref = $object->getDefaultRef();
226 $object->track_id =
null;
227 setEventMessage($langs->trans(
'TicketRefAlreadyUsed', $getRef, $object->ref));
229 $object->ref = $getRef;
232 $object->fk_soc = $object->socid =
GETPOST(
"socid",
'int') > 0 ?
GETPOST(
"socid",
'int') : 0;
233 $object->subject =
GETPOST(
"subject",
'alphanohtml');
234 $object->message =
GETPOST(
"message",
'restricthtml');
236 $object->type_code =
GETPOST(
"type_code",
'alpha');
237 $object->type_label = $langs->trans($langs->getLabelFromKey($db, $object->type_code,
'c_ticket_type',
'code',
'label'));
238 $object->category_code =
GETPOST(
"category_code",
'alpha');
239 $object->category_label = $langs->trans($langs->getLabelFromKey($db, $object->category_code,
'c_ticket_category',
'code',
'label'));
240 $object->severity_code =
GETPOST(
"severity_code",
'alpha');
241 $object->severity_label = $langs->trans($langs->getLabelFromKey($db, $object->severity_code,
'c_ticket_severity',
'code',
'label'));
242 $object->fk_user_create = $user->id;
243 $object->email_from = $user->email;
244 $object->origin_email =
null;
246 $notifyTiers =
GETPOST(
"notify_tiers_at_create",
'alpha');
247 $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1;
249 $fk_user_assign =
GETPOST(
"fk_user_assign",
'int');
250 if ($fk_user_assign > 0) {
251 $object->fk_user_assign = $fk_user_assign;
252 $object->status = $object::STATUS_ASSIGNED;
255 $object->fk_project = $projectid;
256 $object->fk_contract =
GETPOST(
'fk_contract',
'int');
259 $id = $object->create($user);
268 $contactid =
GETPOST(
'contactid',
'int');
269 $type_contact =
GETPOST(
"type",
'alpha');
272 $categories =
GETPOST(
'categories',
'array');
273 $object->setCategories($categories);
275 if ($contactid > 0 && $type_contact) {
277 $result = $object->add_contact($contactid, $typeid,
'external');
281 if (
GETPOST(
'origin',
'alpha') ==
'projet') {
282 $projectid =
GETPOST(
'originid',
'int');
284 $projectid =
GETPOST(
'projectid',
'int');
287 if ($projectid > 0) {
288 $object->setProject($projectid);
292 if (
getDolGlobalString(
'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND') && $user->hasRight(
'ticket',
'write')) {
293 if (! $object->markAsRead($user) > 0) {
300 $result = $object->assignUser($user, $user->id, 1);
301 $object->add_contact($user->id,
"SUPPORTTEC",
'internal');
307 $object->copyFilesForTicket(
'');
313 if (!empty($backtopage)) {
317 $url =
'card.php?track_id='.urlencode($object->track_id);
320 $url =
'card.php?track_id='.urlencode($object->track_id);
323 header(
"Location: ".$url);
335 if ($action ==
'update' && $permissiontoadd && $object->status < Ticket::STATUS_CLOSED) {
341 array_push($object->errors, $langs->trans(
'ErrorTicketIsNotValid'));
346 if (!
GETPOST(
'subject',
'alpha')) {
348 array_push($object->errors, $langs->trans(
'ErrorFieldRequired', $langs->transnoentities(
'Subject')));
350 $ret = $extrafields->setOptionalsFromPost(
null, $object);
359 $object->subject =
GETPOST(
'subject',
'alpha');
360 $object->type_code =
GETPOST(
'type_code',
'alpha');
361 $object->category_code =
GETPOST(
'category_code',
'alpha');
362 $object->severity_code =
GETPOST(
'severity_code',
'alpha');
364 $ret = $object->update($user);
367 $categories =
GETPOST(
'categories',
'array');
368 $object->setCategories($categories);
384 if (!empty($backtopage)) {
388 $url =
'card.php?track_id='.urlencode($object->track_id);
391 $url =
'card.php?track_id='.urlencode($object->track_id);
394 header(
'Location: '.$url);
400 if ($action ==
"set_read" && $permissiontoadd) {
401 $object->fetch(
'',
'',
GETPOST(
"track_id",
'alpha'));
403 if ($object->markAsRead($user) > 0) {
406 header(
"Location: card.php?track_id=".$object->track_id);
415 if ($action ==
"assign_user" &&
GETPOST(
'btn_assign_user',
'alpha') && $permissiontoadd) {
416 $object->fetch(
'',
'',
GETPOST(
"track_id",
'alpha'));
417 $useroriginassign = $object->fk_user_assign;
418 $usertoassign =
GETPOST(
'fk_user_assign',
'int');
427 $ret = $object->assignUser($user, $usertoassign);
435 if ($useroriginassign > 0) {
436 $internal_contacts = $object->listeContact(-1,
'internal', 0,
'SUPPORTTEC');
437 foreach ($internal_contacts as $key => $contact) {
438 if ($contact[
'id'] !== $usertoassign) {
439 $result = $object->delete_contact($contact[
'rowid']);
448 if ($usertoassign > 0 && $usertoassign!==$useroriginassign) {
449 $result = $object->add_contact($usertoassign,
"SUPPORTTEC",
'internal', $notrigger = 0);
459 $object->fetch_user($usertoassign);
462 header(
"Location: card.php?track_id=".$object->track_id);
465 array_push($object->errors, $object->error);
472 if ($action ==
'add_message' && GETPOSTISSET(
'btn_add_message') && $permissiontoread) {
473 $ret = $object->newMessage($user, $action, (
GETPOST(
'private_message',
'alpha') ==
"1" ? 1 : 0), 0);
476 if (!empty($backtopage)) {
479 $url =
'card.php?track_id='.urlencode($object->track_id);
482 header(
"Location: ".$url);
490 if (($action ==
"confirm_close" || $action ==
"confirm_abandon") &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoadd) {
491 $object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha'));
493 if ($object->close($user, ($action ==
"confirm_abandon" ? 1 : 0))) {
496 $url =
'card.php?track_id='.GETPOST(
'track_id',
'alpha');
497 header(
"Location: ".$url);
504 if ($action ==
"confirm_public_close" &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoadd) {
505 $object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha'));
506 if ($_SESSION[
'email_customer'] == $object->origin_email || $_SESSION[
'email_customer'] == $object->thirdparty->email) {
507 $object->close($user);
509 setEventMessages(
'<div class="confirm">'.$langs->trans(
'TicketMarkedAsClosed').
'</div>',
null,
'mesgs');
511 $url =
'card.php?track_id='.GETPOST(
'track_id',
'alpha');
512 header(
"Location: ".$url);
519 if ($action ==
'confirm_delete_ticket' &&
GETPOST(
'confirm',
'alpha') ==
"yes" && $permissiontodelete) {
520 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
521 if ($object->delete($user) > 0) {
522 setEventMessages(
'<div class="confirm">'.$langs->trans(
'TicketDeletedSuccess').
'</div>',
null,
'mesgs');
523 Header(
"Location: ".DOL_URL_ROOT.
"/ticket/list.php");
526 $langs->load(
"errors");
527 $mesg =
'<div class="error">'.$langs->trans($object->error).
'</div>';
534 if ($action ==
'set_thirdparty' && $user->hasRight(
'ticket',
'write')) {
535 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
536 $result = $object->setCustomer(
GETPOST(
'editcustomer',
'int'));
537 $url = $_SERVER[
"PHP_SELF"].
'?track_id='.
GETPOST(
'track_id',
'alpha');
538 header(
"Location: ".$url);
544 if ($action ==
'set_progression' && $user->hasRight(
'ticket',
'write')) {
545 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
546 $result = $object->setProgression(
GETPOST(
'progress',
'alpha'));
548 $url =
'card.php?track_id='.$object->track_id;
549 header(
"Location: ".$url);
555 if ($action ==
'set_categories' && $user->hasRight(
'ticket',
'write')) {
556 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
557 $result = $object->setCategories(
GETPOST(
'categories',
'array'));
559 $url =
'card.php?track_id='.$object->track_id;
560 header(
"Location: ".$url);
566 if ($action ==
'setsubject' && $user->hasRight(
'ticket',
'write')) {
567 if ($object->fetch(
GETPOST(
'id',
'int'))) {
568 if ($action ==
'setsubject') {
569 $object->subject =
GETPOST(
'subject',
'alphanohtml');
572 if ($action ==
'setsubject' && empty($object->subject)) {
574 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Subject")),
null,
'errors');
578 if ($object->update($user) >= 0) {
579 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?track_id=".$object->track_id);
589 if ($action ==
'confirm_reopen' && $user->hasRight(
'ticket',
'manage') && !
GETPOST(
'cancel')) {
590 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
592 if ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED) {
593 $res = $object->setStatut(Ticket::STATUS_ASSIGNED,
null,
'',
'TICKET_MODIFY');
595 $url =
'card.php?track_id='.$object->track_id;
596 header(
"Location: ".$url);
604 } elseif ($action ==
'classin' && $permissiontoadd) {
606 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
607 $object->setProject($projectid);
608 $url =
'card.php?track_id='.$object->track_id;
609 header(
"Location: ".$url);
612 } elseif ($action ==
'setcontract' && $permissiontoadd) {
614 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
615 $object->setContract(
GETPOST(
'contractid',
'int'));
616 $url =
'card.php?track_id='.$object->track_id;
617 header(
"Location: ".$url);
620 } elseif ($action ==
"set_message" && $user->hasRight(
'ticket',
'manage')) {
622 $object->fetch(
'',
'',
GETPOST(
'track_id',
'alpha'));
624 $fieldtomodify =
GETPOST(
'message_initial',
'restricthtml');
626 $object->message = $fieldtomodify;
627 $ret = $object->update($user);
633 setEventMessages($langs->trans(
'TicketMessageSuccesfullyUpdated'),
null,
'mesgs');
641 } elseif ($action ==
'confirm_set_status' && $permissiontoadd && !
GETPOST(
'cancel')) {
643 if ($object->fetch(
GETPOST(
'id',
'int'),
GETPOST(
'track_id',
'alpha')) >= 0) {
644 $new_status =
GETPOST(
'new_status',
'int');
646 $res = $object->setStatut($new_status);
648 $url =
'card.php?track_id='.$object->track_id;
649 header(
"Location: ".$url);
659 if ($action ==
"update_extras" && $permissiontoadd) {
660 $object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha'));
662 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
668 $result = $object->insertExtraFields(empty($triggermodname) ?
'' : $triggermodname, $user);
676 $action =
'edit_extras';
683 if ($action ==
"change_property" &&
GETPOST(
'btn_update_ticket_prop',
'alpha') && $permissiontoadd) {
684 $object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha'));
686 $object->type_code =
GETPOST(
'update_value_type',
'aZ09');
687 $object->severity_code =
GETPOST(
'update_value_severity',
'aZ09');
688 $object->category_code =
GETPOST(
'update_value_category',
'aZ09');
690 $ret = $object->update($user);
701 $permissiondellink = $user->hasRight(
'ticket',
'write');
702 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
705 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
709 $triggersendname =
'TICKET_SENTBYMAIL';
711 $autocopy =
'MAIN_MAIL_AUTOCOPY_TICKET_TO';
712 $trackid =
'tic'.$object->id;
713 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
716 if (GETPOSTISSET(
'actionbis') && $action ==
'presend') {
717 $action =
'presend_addmessage';
726$userstat =
new User($db);
727$form =
new Form($db);
729if (isModEnabled(
'project')) {
733$help_url =
'EN:Module_Ticket|FR:DocumentationModuleTicket';
735$title = $actionobject->getTitle($action);
739if ($action ==
'create' || $action ==
'presend') {
744 $formticket->trackid =
'';
745 $formticket->withfromsocid = $socid ? $socid : $user->socid;
746 $formticket->withfromcontactid = $contactid ? $contactid :
'';
747 $formticket->withtitletopic = 1;
748 $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (
getDolGlobalString(
'TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION') ? 1 : 0));
749 $formticket->withusercreate = 0;
750 $formticket->withref = 1;
751 $formticket->fk_user_create = $user->id;
752 $formticket->withfile = 2;
753 $formticket->withextrafields = 1;
754 $formticket->param = array(
'origin' =>
GETPOST(
'origin'),
'originid' =>
GETPOST(
'originid'));
756 $formticket->withcancel = 1;
759 if (
GETPOST(
"mode",
"aZ09") ==
'init') {
760 $formticket->clear_attached_files();
762 $formticket->showForm(1,
'create', 0,
null, $action);
814} elseif (empty($action) || $action ==
'view' || $action ==
'addlink' || $action ==
'dellink' || $action ==
'presend' || $action ==
'presend_addmessage' || $action ==
'close' || $action ==
'abandon' || $action ==
'delete' || $action ==
'editcustomer' || $action ==
'progression' || $action ==
'categories' || $action ==
'reopen'
815 || $action==
'edit_contrat' || $action ==
'editsubject' || $action ==
'edit_extras' || $action ==
'update_extras' || $action ==
'edit_extrafields' || $action ==
'set_extrafields' || $action ==
'classify' || $action ==
'sel_contract' || $action ==
'edit_message_init' || $action ==
'set_status' || $action ==
'dellink') {
818 if (!$user->socid && (
getDolGlobalString(
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $object->fk_user_assign != $user->id) && !$user->hasRight(
'ticket',
'manage')) {
823 if ($action ==
'close') {
824 $thirdparty_contacts = $object->getInfosTicketExternalContact(1);
825 $contacts_select = array(
826 '-2' => $langs->trans(
'TicketNotifyAllTiersAtClose'),
827 '-3' => $langs->trans(
'TicketNotNotifyTiersAtClose')
829 foreach ($thirdparty_contacts as $thirdparty_contact) {
830 $contacts_select[$thirdparty_contact[
'id']] = $thirdparty_contact[
'civility'] .
' ' . $thirdparty_contact[
'lastname'] .
' ' . $thirdparty_contact[
'firstname'];
835 $formquestion = array(
837 'name' =>
'contactid',
839 'label' => $langs->trans(
'NotifyThirdpartyOnTicketClosing'),
840 'values' => $contacts_select,
841 'default' => $default
845 print $form->formconfirm($url_page_current.
"?track_id=".$object->track_id, $langs->trans(
"CloseATicket"), $langs->trans(
"ConfirmCloseAticket"),
"confirm_close", $formquestion,
'', 1);
848 if ($action ==
'abandon') {
849 print $form->formconfirm($url_page_current.
"?track_id=".$object->track_id, $langs->trans(
"AbandonTicket"), $langs->trans(
"ConfirmAbandonTicket"),
"confirm_abandon",
'',
'', 1);
852 if ($action ==
'delete') {
853 print $form->formconfirm($url_page_current.
"?track_id=".$object->track_id, $langs->trans(
"Delete"), $langs->trans(
"ConfirmDeleteTicket"),
"confirm_delete_ticket",
'',
'', 1);
856 if ($action ==
'reopen') {
857 print $form->formconfirm($url_page_current.
'?track_id='.$object->track_id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReOpenTicket'),
'confirm_reopen',
'',
'', 1);
860 if ($action ==
'set_status') {
861 $new_status =
GETPOST(
'new_status');
863 print $form->formconfirm($url_page_current.
"?track_id=".$object->track_id.
"&new_status=".
GETPOST(
'new_status'), $langs->trans(
"TicketChangeStatus"), $langs->trans(
"TicketConfirmChangeStatus", $langs->transnoentities($object->labelStatusShort[$new_status])),
"confirm_set_status",
'',
'', 1);
867 if ($projectid > 0) {
868 $projectstat =
new Project($db);
869 if ($projectstat->fetch($projectid) > 0) {
870 $projectstat->fetch_thirdparty();
874 $userWrite = $projectstat->restrictedProjectArea($user,
'write');
880 print
dol_get_fiche_head($head,
'ticket', $langs->trans(
"Project"), 0, ($projectstat->public ?
'projectpub' :
'project'));
882 print
'<table class="border centpercent">';
884 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
887 print
'<tr><td width="30%">'.$langs->trans(
'Ref').
'</td><td colspan="3">';
889 if (!$user->hasRight(
'projet',
'all',
'lire')) {
890 $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
891 $projectstat->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
893 print $form->showrefnav($projectstat,
'ref', $linkback, 1,
'ref',
'ref',
'');
897 print
'<tr><td>'.$langs->trans(
"Label").
'</td><td>'.$projectstat->title.
'</td></tr>';
900 print
"<tr><td>".$langs->trans(
"ThirdParty").
"</td>";
901 print
'<td colspan="3">';
902 if ($projectstat->thirdparty->id > 0) {
903 print $projectstat->thirdparty->getNomUrl(1);
911 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
912 if ($projectstat->public) {
913 print $langs->trans(
'SharedProject');
915 print $langs->trans(
'PrivateProject');
921 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>'.$projectstat->getLibStatut(4).
'</td></tr>';
927 print
"ErrorRecordNotFound";
929 } elseif ($socid > 0) {
930 $object->fetch_thirdparty();
935 dol_banner_tab($object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
941 $object->next_prev_filter =
"te.fk_user_assign = ".((int) $user->id);
942 } elseif ($user->socid > 0) {
943 $object->next_prev_filter =
"te.fk_soc = ".((int) $user->socid);
950 $morehtmlref =
'<div class="refidno">';
951 $morehtmlref .= $object->subject;
953 if ($object->fk_user_create > 0) {
954 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
956 $fuser =
new User($db);
957 $fuser->fetch($object->fk_user_create);
958 $morehtmlref .= $fuser->getNomUrl(-1);
959 } elseif (!empty($object->email_msgid)) {
960 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
961 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
962 $htmltooltip = $langs->trans(
"EmailMsgID").
': '.$object->email_msgid;
963 $htmltooltip .=
'<br>'.$langs->trans(
"EmailDate").
': '.
dol_print_date($object->email_date,
'dayhour');
964 $morehtmlref .=
dol_escape_htmltag($object->origin_email).
' <small class="hideonsmartphone opacitymedium">- '.$form->textwithpicto($langs->trans(
"CreatedByEmailCollector"), $htmltooltip, 1,
'help',
'', 0, 3,
'tooltip').
'</small>';
965 } elseif (!empty($object->origin_email)) {
966 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
967 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
968 $htmltooptip = $langs->trans(
"IP").
': '.$object->ip;
969 $morehtmlref .=
dol_escape_htmltag($object->origin_email).
' <small class="hideonsmartphone opacitymedium">- '.$form->textwithpicto($langs->trans(
"CreatedByPublicPortal"), $htmltooptip, 1,
'help',
'', 0, 3,
'tooltip').
'</small>';
972 $permissiontoedit = $object->status < 8 && !$user->socid && $user->rights->ticket->write;
976 if (isModEnabled(
"societe")) {
977 $morehtmlref .=
'<br>';
978 $morehtmlref .=
img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth"');
979 if ($action !=
'editcustomer' && $permissiontoedit) {
980 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editcustomer&token='.newToken().
'&track_id='.$object->track_id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetThirdParty'), 0).
'</a> ';
982 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid, $action ==
'editcustomer' ?
'editcustomer' :
'none',
'', 1, 0, 0, array(), 1);
983 if (!empty($object->socid)) {
984 $morehtmlref .=
' - <a href="'.DOL_URL_ROOT.
'/ticket/list.php?socid='.$object->socid.
'&sortfield=t.datec&sortorder=desc">'.
img_picto($langs->trans(
"Tickets"),
'ticket',
'class="pictofixedwidth"').
' '.$langs->trans(
"TicketHistory").
'</a>';
989 if (isModEnabled(
'project')) {
990 $langs->load(
"projects");
991 $morehtmlref .=
'<br>';
992 if ($permissiontoedit) {
993 $object->fetch_project();
994 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project'.((is_object($object->project) && $object->project->public) ?
'pub' :
''),
'class="pictofixedwidth"');
995 if ($action !=
'classify') {
996 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
998 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1000 if (!empty($object->fk_project)) {
1001 $object->fetch_project();
1002 $morehtmlref .= $object->project->getNomUrl(1);
1003 if ($object->project->title) {
1004 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($object->project->title).
'</span>';
1013 if (isModEnabled(
'contrat')) {
1014 $langs->load(
'contracts');
1015 $morehtmlref .=
'<br>';
1016 if ($permissiontoedit) {
1017 $morehtmlref .=
img_picto($langs->trans(
"Contract"),
'contract',
'class="pictofixedwidth"');
1018 if ($action ==
'edit_contrat') {
1020 $morehtmlref .= $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $object->socid, $object->fk_contract,
'contratid', 0, 1, 1, 1);
1022 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_contrat&token='.newToken().
'&id='.$object->id.
'">';
1023 $morehtmlref .=
img_edit($langs->trans(
'SetContract'));
1024 $morehtmlref .=
'</a>';
1027 if (!empty($object->fk_contract)) {
1028 $contratstatic =
new Contrat($db);
1029 $contratstatic->fetch($object->fk_contract);
1031 $morehtmlref .= $contratstatic->getNomUrl(0,
'', 1);
1037 $morehtmlref .=
'</div>';
1039 $linkback =
'<a href="'.DOL_URL_ROOT.
'/ticket/list.php?restore_lastsearch_values=1"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
1041 dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref);
1043 print
'<div class="fichecenter">';
1044 print
'<div class="fichehalfleft">';
1045 print
'<div class="underbanner clearboth"></div>';
1047 print
'<table class="border tableforfield centpercent">';
1050 print
'<tr><td class="titlefield">'.$langs->trans(
"TicketTrackId").
'</td><td>';
1051 if (!empty($object->track_id)) {
1052 if (empty($object->ref)) {
1053 $object->ref = $object->id;
1054 print $form->showrefnav($object,
'id', $linkback, 1,
'rowid',
'track_id');
1059 print $langs->trans(
'None');
1065 print $form->editfieldkey(
"Subject",
'subject', $object->subject, $object, $user->hasRight(
'ticket',
'write') && !$user->socid,
'string');
1067 print $form->editfieldval(
"Subject",
'subject', $object->subject, $object, $user->hasRight(
'ticket',
'write') && !$user->socid,
'string');
1071 print
'<tr><td>'.$langs->trans(
"DateCreation").
'</td><td>';
1094 print
'<tr><td>'.$langs->trans(
"TicketReadOn").
'</td><td>';
1095 if (!empty($object->date_read)) {
1098 print
' / <i>'.convertSecondToTime(
roundUpToNextMultiple($now - $object->date_read, 60)).
'</i></span>';
1103 print
'<tr><td>'.$langs->trans(
"TicketCloseOn").
'</td><td>';
1104 if (!empty($object->date_close)) {
1111 print
'<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
1112 print $langs->trans(
"AssignedTo");
1113 if (isset($object->status) && $object->status < $object::STATUS_CLOSED &&
GETPOST(
'set',
'alpha') !=
"assign_ticket" && $user->hasRight(
'ticket',
'manage')) {
1114 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>';
1116 print
'</td></tr></table>';
1118 if (
GETPOST(
'set',
'alpha') !=
"assign_ticket" && $object->fk_user_assign > 0) {
1119 $userstat->fetch($object->fk_user_assign);
1120 print $userstat->getNomUrl(-1);
1124 if (
GETPOST(
'set',
'alpha') ==
"assign_ticket" && $object->status < 8 && !$user->socid && $user->hasRight(
'ticket',
'write')) {
1125 print
'<form method="post" name="ticket" enctype="multipart/form-data" action="'.$url_page_current.
'">';
1126 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1127 print
'<input type="hidden" name="action" value="assign_user">';
1128 print
'<input type="hidden" name="track_id" value="'.$object->track_id.
'">';
1130 print $form->select_dolusers(empty($object->fk_user_assign) ? $user->id : $object->fk_user_assign,
'fk_user_assign', 1);
1131 print
' <input type="submit" class="button small" name="btn_assign_user" value="'.$langs->trans(
"Validate").
'" />';
1138 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
1139 print $langs->trans(
'Progression').
'</td><td class="left">';
1141 if ($action !=
'progression' && isset($object->status) && $object->status < $object::STATUS_CLOSED && !$user->socid) {
1142 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>';
1144 print
'</tr></table>';
1146 if ($user->hasRight(
'ticket',
'write') && $action ==
'progression') {
1147 print
'<form action="'.$url_page_current.
'" method="post">';
1148 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1149 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1150 print
'<input type="hidden" name="action" value="set_progression">';
1151 print
'<input type="text" class="flat width75" name="progress" value="'.$object->progress.
'">';
1152 print
' <input type="submit" class="button button-edit small" value="'.$langs->trans(
'Modify').
'">';
1155 print($object->progress > 0 ? $object->progress :
'0').
'%';
1161 if (isModEnabled(
'ficheinter')) {
1162 $object->fetchObjectLinked();
1163 $num = count($object->linkedObjects);
1167 foreach ($object->linkedObjects as $objecttype => $objects) {
1168 if ($objecttype ==
"fichinter") {
1169 foreach ($objects as $fichinter) {
1171 $timing += $fichinter->duration;
1177 print $form->textwithpicto($langs->trans(
"TicketDurationAuto"), $langs->trans(
"TicketDurationAutoInfos"), 1);
1184 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1190 print
'</div><div class="fichehalfright">';
1193 print
'<form method="post" name="formticketproperties" action="'.$url_page_current.
'">';
1194 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1195 print
'<input type="hidden" name="action" value="change_property">';
1196 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1197 print
'<input type="hidden" name="trackid" value="'.$trackid.
'">';
1200 if (isModEnabled(
'categorie')) {
1201 print
'<div class="underbanner clearboth"></div>';
1202 print
'<table class="border centpercent tableforfield">';
1204 print
'<td class="valignmiddle titlefield">';
1205 print
'<table class="nobordernopadding centpercent"><tr><td class="titlefield">';
1206 print $langs->trans(
"Categories");
1207 if ($action !=
'categories' && !$user->socid) {
1208 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>';
1213 if ($user->hasRight(
'ticket',
'write') && $action ==
'categories') {
1214 $cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET,
'',
'parent', 64, 0, 1);
1215 if (is_array($cate_arbo)) {
1217 print
'<td colspan="3">';
1218 print
'<form action="'.$url_page_current.
'" method="post">';
1219 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1220 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1221 print
'<input type="hidden" name="action" value="set_categories">';
1224 $cats = $category->containing($object->id,
'ticket');
1225 $arrayselected = array();
1226 foreach ($cats as $cat) {
1227 $arrayselected[] = $cat->id;
1230 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1231 print
'<input type="submit" class="button button-edit small" value="'.$langs->trans(
'Save').
'">';
1236 print
'<td colspan="3">';
1237 print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
1245 $actionobject->viewTicketOriginalMessage($user, $action, $object);
1248 print
'<div class="div-table-responsive-no-min">';
1249 print
'<table class="noborder tableforfield centpercent margintable">';
1250 print
'<tr class="liste_titre">';
1252 print $langs->trans(
'TicketProperties');
1255 if (
GETPOST(
'set',
'alpha') ==
'properties' && $user->hasRight(
'ticket',
'write')) {
1256 print
'<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans(
"Modify").
'" />';
1259 if (isset($object->status) && ($object->status < $object::STATUS_NEED_MORE_INFO ||
getDolGlobalString(
'TICKET_ALLOW_CLASSIFICATION_MODIFICATION_EVEN_IF_CLOSED')) && $user->hasRight(
'ticket',
'write')) {
1260 print
' <a class="editfielda" href="card.php?track_id='.$object->track_id.
'&set=properties">'.
img_edit($langs->trans(
'Modify')).
'</a>';
1266 if (
GETPOST(
'set',
'alpha') ==
'properties' && $user->hasRight(
'ticket',
'write')) {
1269 print
'<td class="titlefield">';
1270 print $langs->trans(
'Type');
1272 $formticket->selectTypesTickets($object->type_code,
'update_value_type',
'', 2);
1278 print $langs->trans(
'TicketCategory');
1280 $formticket->selectGroupTickets($object->category_code,
'update_value_category',
'', 2, 0, 0, 0,
'maxwidth500 widthcentpercentminusxx');
1286 print $langs->trans(
'TicketSeverity');
1288 $formticket->selectSeveritiesTickets($object->severity_code,
'update_value_severity',
'', 2);
1293 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
1294 if (!empty($object->type_code)) {
1295 print $langs->getLabelFromKey($db,
'TicketTypeShort'.$object->type_code,
'c_ticket_type',
'code',
'label', $object->type_code);
1300 if (!empty($object->category_code)) {
1301 $s = $langs->getLabelFromKey($db,
'TicketCategoryShort'.$object->category_code,
'c_ticket_category',
'code',
'label', $object->category_code);
1303 print
'<tr><td>'.$langs->trans(
"TicketCategory").
'</td><td class="tdoverflowmax200" title="'.
dol_escape_htmltag($s).
'">';
1307 print
'<tr><td>'.$langs->trans(
"TicketSeverity").
'</td><td>';
1308 if (!empty($object->severity_code)) {
1309 print $langs->getLabelFromKey($db,
'TicketSeverityShort'.$object->severity_code,
'c_ticket_severity',
'code',
'label', $object->severity_code);
1319 print
'<!-- navbar with status -->';
1320 if (!$user->socid && $user->hasRight(
'ticket',
'write') && isset($object->status) && $object->status < $object::STATUS_CLOSED &&
GETPOST(
'set') !==
'properties') {
1321 $actionobject->viewStatusActions($object);
1326 print
load_fiche_titre($langs->trans(
'Contacts'),
'',
'title_companies.png');
1328 print
'<div class="div-table-responsive-no-min">';
1329 print
'<div class="tagtable centpercent noborder allwidth">';
1331 print
'<div class="tagtr liste_titre">';
1332 print
'<div class="tagtd">'.$langs->trans(
"Source").
'</div>
1333 <div class="tagtd">' . $langs->trans(
"Company").
'</div>
1334 <div class="tagtd">' . $langs->trans(
"Contacts").
'</div>
1335 <div class="tagtd">' . $langs->trans(
"ContactType").
'</div>
1336 <div class="tagtd">' . $langs->trans(
"Phone").
'</div>
1337 <div class="tagtd center">' . $langs->trans(
"Status").
'</div>';
1338 print
'</div><!-- tagtr -->';
1341 $companystatic =
new Societe($db);
1342 $contactstatic =
new Contact($db);
1343 $userstatic =
new User($db);
1345 foreach (array(
'internal',
'external') as $source) {
1346 $tmpobject = $object;
1347 $tab = $tmpobject->listeContact(-1, $source);
1352 print
'<div class="tagtr '.($var ?
'pair' :
'impair').
'">';
1354 print
'<div class="tagtd left">';
1355 if ($tab[$i][
'source'] ==
'internal') {
1356 echo $langs->trans(
"User");
1359 if ($tab[$i][
'source'] ==
'external') {
1360 echo $langs->trans(
"ThirdPartyContact");
1364 print
'<div class="tagtd left">';
1366 if ($tab[$i][
'socid'] > 0) {
1367 $companystatic->fetch($tab[$i][
'socid']);
1368 echo $companystatic->getNomUrl(-1);
1370 if ($tab[$i][
'socid'] < 0) {
1373 if (!$tab[$i][
'socid']) {
1378 print
'<div class="tagtd">';
1379 if ($tab[$i][
'source'] ==
'internal') {
1380 if ($userstatic->fetch($tab[$i][
'id'])) {
1381 print $userstatic->getNomUrl(-1);
1384 if ($tab[$i][
'source'] ==
'external') {
1385 if ($contactstatic->fetch($tab[$i][
'id'])) {
1386 print $contactstatic->getNomUrl(-1);
1390 <div class="tagtd">' . $tab[$i][
'libelle'].
'</div>';
1392 print
'<div class="tagtd">';
1394 print
dol_print_phone($tab[$i][
'phone'],
'',
'',
'',
'AC_TEL').
'<br>';
1396 if (!empty($tab[$i][
'phone_perso'])) {
1398 print
'<br>'.dol_print_phone($tab[$i][
'phone_perso'],
'',
'',
'',
'AC_TEL').
'<br>';
1400 if (!empty($tab[$i][
'phone_mobile'])) {
1402 print
dol_print_phone($tab[$i][
'phone_mobile'],
'',
'',
'',
'AC_TEL').
'<br>';
1406 print
'<div class="tagtd center">';
1407 if ($object->status >= 0) {
1408 echo
'<a href="contact.php?track_id='.$object->track_id.
'&action=swapstatut&ligne='.$tab[$i][
'rowid'].
'">';
1411 if ($tab[$i][
'source'] ==
'internal') {
1412 $userstatic->id = $tab[$i][
'id'];
1413 $userstatic->lastname = $tab[$i][
'lastname'];
1414 $userstatic->firstname = $tab[$i][
'firstname'];
1415 echo $userstatic->LibStatut($tab[$i][
'statuscontact'], 3);
1417 if ($tab[$i][
'source'] ==
'external') {
1418 $contactstatic->id = $tab[$i][
'id'];
1419 $contactstatic->lastname = $tab[$i][
'lastname'];
1420 $contactstatic->firstname = $tab[$i][
'firstname'];
1421 echo $contactstatic->LibStatut($tab[$i][
'statuscontact'], 3);
1423 if ($object->status >= 0) {
1429 print
'</div><!-- tagtr -->';
1435 print
'</div><!-- contact list -->';
1439 print
'</div></div>';
1440 print
'<div class="clearboth"></div>';
1446 if ($action !=
'presend' && $action !=
'presend_addmessage' && $action !=
'editline') {
1447 print
'<div class="tabsAction">'.
"\n";
1448 $parameters = array();
1449 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1454 if (empty($reshook)) {
1456 if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage") {
1457 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',
'');
1461 if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage") {
1462 print
dolGetButtonAction(
'', $langs->trans(
'TicketAddPrivateMessage'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend_addmessage&mode=init&token='.newToken().
'&track_id='.$object->track_id.
'#formmailbeforetitle',
'');
1468 print
dolGetButtonAction($langs->trans(
'UnableToCreateInterIfNoSocid'), $langs->trans(
'TicketAddIntervention'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1470 if ($object->fk_soc > 0 && isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $user->hasRight(
'ficheinter',
'creer')) {
1471 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,
'');
1475 if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->hasRight(
'ticket',
'write')) {
1476 print
dolGetButtonAction(
'', $langs->trans(
'CloseTicket'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.newToken().
'&track_id='.$object->track_id,
'');
1480 if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->hasRight(
'ticket',
'write')) {
1481 print
dolGetButtonAction(
'', $langs->trans(
'AbandonTicket'),
'default', $_SERVER[
"PHP_SELF"].
'?action=abandon&token='.newToken().
'&track_id='.$object->track_id,
'');
1485 if (!$user->socid && (isset($object->status) && ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED)) && !$user->socid) {
1486 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.newToken().
'&track_id='.$object->track_id,
'');
1490 if ($user->hasRight(
'ticket',
'delete') && !$user->socid) {
1491 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.newToken().
'&track_id='.$object->track_id,
'');
1494 print
'</div>'.
"\n";
1500 if (
GETPOST(
'modelselected')) {
1501 $action =
'presend';
1504 if (GETPOSTISSET(
'actionbis') && $action ==
'presend') {
1505 $action =
'presend_addmessage';
1509 if ($action ==
'presend' || $action ==
'presend_addmessage') {
1510 if ($object->fk_soc > 0) {
1511 $object->fetch_thirdparty();
1514 $outputlangs = $langs;
1517 $newlang =
GETPOST(
'lang_id',
'aZ09');
1518 } elseif (
getDolGlobalInt(
'MAIN_MULTILANGS') && empty($newlang) && is_object($object->thirdparty)) {
1519 $newlang = $object->thirdparty->default_lang;
1521 if (!empty($newlang)) {
1522 $outputlangs =
new Translate(
"", $conf);
1523 $outputlangs->setDefaultLang($newlang);
1526 $arrayoffamiliestoexclude = array(
'objectamount');
1528 $action =
'add_message';
1529 $modelmail =
'ticket_send';
1532 $morehtmlright =
'';
1535 $morehtmlright .= $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"TicketMessageSubstitutionReplacedByGenericValues").
'</span>', $help, 1,
'helpclickable',
'', 0, 3,
'helpsubstitution');
1539 print
'<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
1541 print
load_fiche_titre($langs->trans(
'TicketAddMessage'), $morehtmlright,
'messages@ticket');
1547 $formticket->action = $action;
1548 $formticket->track_id = $object->track_id;
1549 $formticket->ref = $object->ref;
1550 $formticket->id = $object->id;
1551 $formticket->trackid =
'tic'.$object->id;
1553 $formticket->withfile = 2;
1554 $formticket->withcancel = 1;
1555 $formticket->param = array(
'fk_user_create' => $user->id);
1556 $formticket->param[
'langsmodels'] = (empty($newlang) ? $langs->defaultlang : $newlang);
1559 $formticket->param[
'models'] = $modelmail;
1560 $formticket->param[
'models_id'] =
GETPOST(
'modelmailselected',
'int');
1562 $formticket->param[
'returnurl'] = $_SERVER[
"PHP_SELF"].
'?track_id='.$object->track_id;
1564 $formticket->withsubstit = 1;
1565 $formticket->substit = $substitutionarray;
1566 $formticket->backtopage = $backtopage;
1568 $formticket->showMessageForm(
'100%');
1574 $param =
'&id='.$object->id;
1575 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1576 $param .=
'&contextpage='.$contextpage;
1578 if ($limit > 0 && $limit != $conf->liste_limit) {
1579 $param .=
'&limit='.$limit;
1582 $param .=
'&actioncode='.urlencode($actioncode);
1584 if ($search_agenda_label) {
1585 $param .=
'&search_agenda_label='.urlencode($search_agenda_label);
1588 $morehtmlright =
'';
1590 $messagingUrl = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.$object->track_id;
1591 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'MessageListViewType'),
'',
'fa fa-bars imgforviewmode', $messagingUrl,
'', 1);
1594 $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage" && $action !=
"add_message";
1595 $url =
'card.php?track_id='.$object->track_id.
'&action=presend_addmessage&mode=init';
1596 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'TicketAddMessage'),
'',
'fa fa-comment-dots', $url,
'add-new-ticket-title-button', $btnstatus);
1599 $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage" && $action !=
"add_message";
1600 $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);
1601 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', $url,
'add-new-ticket-even-button', $btnstatus);
1603 print_barre_liste($langs->trans(
"ActionsOnTicket"), 0, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 1);
1607 $filters[
'search_agenda_label'] = $search_agenda_label;
1608 $filters[
'search_rowid'] = $search_rowid;
1610 show_actions_messaging($conf, $langs, $db, $object,
null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
1613 if ($action !=
'presend' && $action !=
'presend_addmessage' && $action !=
'add_message') {
1614 print
'<div class="fichecenter"><div class="fichehalfleft">';
1615 print
'<a name="builddoc"></a>';
1618 $linktoelem = $form->showLinkToObjectBlock($object,
null, array(
'ticket'));
1619 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1622 print
'<br><!-- Link to public interface -->'.
"\n";
1627 print
'<div class="fichehalfright">';
1631 $morehtmlcenter =
'<div class="nowraponall">';
1632 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/ticket/messaging.php?id='.$object->id);
1633 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/ticket/agenda.php?id='.$object->id);
1634 $morehtmlcenter .=
'</div>';
1637 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1639 $somethingshown =
$formactions->showactions($object,
'ticket', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter);
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 Actions of the module ticket.
Class to manage categories.
Class to manage contracts.
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.
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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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)
Set event message in dol_events session object.
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_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0)
Format phone numbers according to country.
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)
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.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dolPrintLabel($s)
Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on...
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
show_actions_messaging($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
Show html area with actions in messaging format.
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...
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.