28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/actions_ticket.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formticket.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
38 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
39 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
40 include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
43 include_once DOL_DOCUMENT_ROOT.
'/core/lib/contract.lib.php';
44 include_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
45 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcontract.class.php';
49 $langs->loadLangs(array(
"companies",
"other",
"ticket"));
53 $socid =
GETPOST(
'socid',
'int');
54 $track_id =
GETPOST(
'track_id',
'alpha', 3);
56 $projectid =
GETPOST(
'projectid',
'int');
57 $cancel =
GETPOST(
'cancel',
'alpha');
58 $action =
GETPOST(
'action',
'aZ09');
59 $backtopage =
GETPOST(
'backtopage',
'alpha');
60 $contactid =
GETPOST(
'contactid',
'int');
62 $notifyTiers =
GETPOST(
"notify_tiers_at_create",
'alpha');
64 $sortfield =
GETPOST(
'sortfield',
'aZ09comma') ?
GETPOST(
'sortfield',
'aZ09comma') :
"a.datep";
65 $sortorder =
GETPOST(
'sortorder',
'aZ09comma') ?
GETPOST(
'sortorder',
'aZ09comma') :
"desc";
67 if (
GETPOST(
'actioncode',
'array')) {
68 $actioncode =
GETPOST(
'actioncode',
'array', 3);
69 if (!count($actioncode)) {
73 $actioncode =
GETPOST(
"actioncode",
"alpha", 3) ?
GETPOST(
"actioncode",
"alpha", 3) : (
GETPOST(
"actioncode") ==
'0' ?
'0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
75 $search_agenda_label =
GETPOST(
'search_agenda_label');
78 $hookmanager->initHooks(array(
'ticketcard',
'globalcard'));
84 $extrafields->fetch_name_optionals_label($object->table_element);
86 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
89 $search_all =
GETPOST(
"search_all",
'alpha');
91 foreach ($object->fields as $key => $val) {
92 if (
GETPOST(
'search_'.$key,
'alpha')) {
93 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
97 if (empty($action) && empty($id) && empty($ref)) {
102 if (
GETPOST(
'modelselected',
'alpha')) {
108 if ($id || $track_id || $ref) {
109 $res = $object->fetch($id, $ref, $track_id);
112 $track_id = $object->track_id;
117 $url_page_current = DOL_URL_ROOT.
'/ticket/card.php';
120 if ($user->socid > 0) $socid = $user->socid;
123 $triggermodname =
'TICKET_MODIFY';
124 $permissiontoadd = $user->rights->ticket->write;
135 $parameters = array();
136 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
142 if (empty($reshook)) {
144 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
146 $search_agenda_label =
'';
149 $backurlforlist = DOL_URL_ROOT.
'/ticket/list.php';
151 if (empty($backtopage) || ($cancel && empty($id))) {
152 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
153 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
154 $backtopage = $backurlforlist;
156 $backtopage = DOL_URL_ROOT.
'/ticket/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
162 if (!empty($backtopageforcancel)) {
163 header(
"Location: ".$backtopageforcancel);
165 } elseif (!empty($backtopage)) {
166 header(
"Location: ".$backtopage);
173 if (
GETPOST(
'save',
'alpha') && !empty($user->rights->ticket->write)) {
176 if (!
GETPOST(
"subject",
'alphanohtml')) {
178 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Subject")), null,
'errors');
180 } elseif (!
GETPOST(
"message",
'restricthtml')) {
182 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Message")), null,
'errors');
185 $ret = $extrafields->setOptionalsFromPost(null, $object);
193 $object->ref =
GETPOST(
"ref",
'alphanohtml');
194 $object->fk_soc =
GETPOST(
"socid",
'int') > 0 ?
GETPOST(
"socid",
'int') : 0;
195 $object->subject =
GETPOST(
"subject",
'alphanohtml');
196 $object->message =
GETPOST(
"message",
'restricthtml');
198 $object->type_code =
GETPOST(
"type_code",
'alpha');
199 $object->type_label = $langs->trans($langs->getLabelFromKey($db, $object->type_code,
'c_ticket_type',
'code',
'label'));
200 $object->category_code =
GETPOST(
"category_code",
'alpha');
201 $object->category_label = $langs->trans($langs->getLabelFromKey($db, $object->category_code,
'c_ticket_category',
'code',
'label'));
202 $object->severity_code =
GETPOST(
"severity_code",
'alpha');
203 $object->severity_label = $langs->trans($langs->getLabelFromKey($db, $object->severity_code,
'c_ticket_severity',
'code',
'label'));
204 $object->email_from = $user->email;
205 $notifyTiers =
GETPOST(
"notify_tiers_at_create",
'alpha');
206 $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1;
207 $fk_user_assign =
GETPOST(
"fk_user_assign",
'int');
208 if ($fk_user_assign > 0) {
209 $object->fk_user_assign = $fk_user_assign;
210 $object->status = $object::STATUS_ASSIGNED;
213 $object->fk_project = $projectid;
215 $id = $object->create($user);
224 $contactid =
GETPOST(
'contactid',
'int');
225 $type_contact =
GETPOST(
"type",
'alpha');
228 $categories =
GETPOST(
'categories',
'array');
229 $object->setCategories($categories);
231 if ($contactid > 0 && $type_contact) {
233 $result = $object->add_contact($contactid, $typeid,
'external');
237 if (
GETPOST(
'origin',
'alpha') ==
'projet') {
238 $projectid =
GETPOST(
'originid',
'int');
240 $projectid =
GETPOST(
'projectid',
'int');
243 if ($projectid > 0) {
244 $object->setProject($projectid);
248 if (!empty($conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND) && $user->rights->ticket->write) {
249 if ( ! $object->markAsRead($user) > 0) {
255 if (!empty($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE)) {
256 $result = $object->assignUser($user, $user->id, 1);
257 $object->add_contact($user->id,
"SUPPORTTEC",
'internal');
263 $object->copyFilesForTicket();
269 if (!empty($backtopage)) {
273 $url =
'card.php?track_id='.urlencode($object->track_id);
276 $url =
'card.php?track_id='.urlencode($object->track_id);
279 header(
"Location: ".$url);
290 if ($action ==
'update' && $user->rights->ticket->write && $object->status < Ticket::STATUS_CLOSED) {
296 array_push($object->errors, $langs->trans(
'ErrorTicketIsNotValid'));
301 if (!
GETPOST(
'subject',
'alpha')) {
303 array_push($object->errors, $langs->trans(
'ErrorFieldRequired', $langs->transnoentities(
'Subject')));
305 $ret = $extrafields->setOptionalsFromPost(null, $object);
314 $object->subject =
GETPOST(
'subject',
'alpha');
315 $object->type_code =
GETPOST(
'type_code',
'alpha');
316 $object->category_code =
GETPOST(
'category_code',
'alpha');
317 $object->severity_code =
GETPOST(
'severity_code',
'alpha');
319 $ret = $object->update($user);
322 $categories =
GETPOST(
'categories',
'array');
323 $object->setCategories($categories);
339 if (!empty($backtopage)) {
343 $url =
'card.php?track_id='.urlencode($object->track_id);
346 $url =
'card.php?track_id='.urlencode($object->track_id);
349 header(
'Location: '.$url);
355 if ($action ==
"mark_ticket_read" && $user->rights->ticket->write) {
356 $object->fetch(
'',
'',
GETPOST(
"track_id",
'alpha'));
358 if ($object->markAsRead($user) > 0) {
361 header(
"Location: card.php?track_id=".$object->track_id.
"&action=view");
370 if ($action ==
"assign_user" &&
GETPOST(
'btn_assign_user',
'alpha') && $user->rights->ticket->write) {
371 $object->fetch(
'',
'',
GETPOST(
"track_id",
'alpha'));
372 $useroriginassign = $object->fk_user_assign;
373 $usertoassign =
GETPOST(
'fk_user_assign',
'int');
382 $ret = $object->assignUser($user, $usertoassign);
390 if ($useroriginassign > 0) {
391 $internal_contacts = $object->listeContact(-1,
'internal', 0,
'SUPPORTTEC');
392 foreach ($internal_contacts as $key => $contact) {
393 if ($contact[
'id'] !== $usertoassign) {
394 $result = $object->delete_contact($contact[
'rowid']);
403 if ($usertoassign > 0 && $usertoassign!==$useroriginassign) {
404 $result = $object->add_contact($usertoassign,
"SUPPORTTEC",
'internal', $notrigger = 0);
414 $object->fetch_user($usertoassign);
419 header(
"Location: card.php?track_id=".$object->track_id.
"&action=view");
422 array_push($object->errors, $object->error);
428 if ($action ==
'add_message' &&
GETPOSTISSET(
'btn_add_message') && $user->rights->ticket->read) {
429 $ret = $object->newMessage($user, $action, (
GETPOST(
'private_message',
'alpha') ==
"on" ? 1 : 0));
432 if (!empty($backtopage)) {
436 $url =
'card.php?track_id='.urlencode($object->track_id);
439 $url =
'card.php?action=view&track_id='.urlencode($object->track_id);
442 header(
"Location: ".$url);
450 if (($action ==
"confirm_close" || $action ==
"confirm_abandon") &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $user->rights->ticket->write) {
451 $object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha'));
453 if ($object->close($user, ($action ==
"confirm_abandon" ? 1 : 0))) {
456 $url =
'card.php?action=view&track_id='.GETPOST(
'track_id',
'alpha');
457 header(
"Location: ".$url);
464 if ($action ==
"confirm_public_close" &&
GETPOST(
'confirm',
'alpha') ==
'yes') {
465 $object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha'));
466 if ($_SESSION[
'email_customer'] == $object->origin_email || $_SESSION[
'email_customer'] == $object->thirdparty->email) {
467 $object->close($user);
472 setEventMessages(
'<div class="confirm">'.$langs->trans(
'TicketMarkedAsClosed').
'</div>', null,
'mesgs');
474 $url =
'card.php?action=view_ticket&track_id='.GETPOST(
'track_id',
'alpha');
475 header(
"Location: ".$url);
482 if ($action ==
'confirm_delete_ticket' &&
GETPOST(
'confirm',
'alpha') ==
"yes" && $user->rights->ticket->delete) {
483 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
484 if ($object->delete($user) > 0) {
485 setEventMessages(
'<div class="confirm">'.$langs->trans(
'TicketDeletedSuccess').
'</div>', null,
'mesgs');
486 Header(
"Location: ".DOL_URL_ROOT.
"/ticket/list.php");
489 $langs->load(
"errors");
490 $mesg =
'<div class="error">'.$langs->trans($object->error).
'</div>';
497 if ($action ==
'set_thirdparty' && $user->rights->ticket->write) {
498 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
499 $result = $object->setCustomer(
GETPOST(
'editcustomer',
'int'));
500 $url =
'card.php?action=view&track_id='.GETPOST(
'track_id',
'alpha');
501 header(
"Location: ".$url);
506 if ($action ==
'set_progression' && $user->rights->ticket->write) {
507 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
508 $result = $object->setProgression(
GETPOST(
'progress',
'alpha'));
510 $url =
'card.php?action=view&track_id='.$object->track_id;
511 header(
"Location: ".$url);
516 if ($action ==
'set_categories' && $user->rights->ticket->write) {
517 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
518 $result = $object->setCategories(
GETPOST(
'categories',
'array'));
520 $url =
'card.php?action=view&track_id='.$object->track_id;
521 header(
"Location: ".$url);
526 if ($action ==
'setsubject' && $user->rights->ticket->write) {
527 if ($object->fetch(
GETPOST(
'id',
'int'))) {
528 if ($action ==
'setsubject') {
529 $object->subject =
GETPOST(
'subject',
'alphanohtml');
532 if ($action ==
'setsubject' && empty($object->subject)) {
534 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Subject")), null,
'errors');
538 if ($object->update($user) >= 0) {
539 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?track_id=".$object->track_id);
549 if ($action ==
'confirm_reopen' && $user->rights->ticket->manage && !
GETPOST(
'cancel')) {
550 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
552 if ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED) {
553 $res = $object->setStatut(Ticket::STATUS_ASSIGNED);
558 $url =
'card.php?action=view&track_id='.$object->track_id;
559 header(
"Location: ".$url);
567 } elseif ($action ==
'classin' && $user->rights->ticket->write) {
569 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
570 $object->setProject($projectid);
571 $url =
'card.php?action=view&track_id='.$object->track_id;
572 header(
"Location: ".$url);
575 } elseif ($action ==
'setcontract' && $user->rights->ticket->write) {
577 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
578 $object->setContract(
GETPOST(
'contractid',
'int'));
579 $url =
'card.php?action=view&track_id='.$object->track_id;
580 header(
"Location: ".$url);
583 } elseif ($action ==
"set_message" && $user->rights->ticket->manage) {
586 $object->fetch(
'',
'',
GETPOST(
'track_id',
'alpha'));
587 $oldvalue_message = $object->message;
588 $fieldtomodify =
GETPOST(
'message_initial',
'restricthtml');
590 $object->message = $fieldtomodify;
591 $ret = $object->update($user);
595 include_once DOL_DOCUMENT_ROOT.
'/core/class/utils_diff.class.php';
599 setEventMessages($langs->trans(
'TicketMessageSuccesfullyUpdated'), null,
'mesgs');
607 } elseif ($action ==
'confirm_set_status' && $user->rights->ticket->write && !
GETPOST(
'cancel')) {
609 if ($object->fetch(
GETPOST(
'id',
'int'),
GETPOST(
'track_id',
'alpha')) >= 0) {
610 $new_status =
GETPOST(
'new_status',
'int');
611 $old_status = $object->status;
612 $res = $object->setStatut($new_status);
615 $log_action = $langs->trans(
'TicketLogStatusChanged', $langs->transnoentities($object->statuts_short[$old_status]), $langs->transnoentities($object->statuts_short[$new_status]));
617 $url =
'card.php?action=view&track_id='.$object->track_id;
618 header(
"Location: ".$url);
628 if ($action ==
"update_extras" && !empty($permissiontoadd)) {
629 $object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha'));
631 $ret = $extrafields->setOptionalsFromPost(null, $object,
GETPOST(
'attribute',
'restricthtml'));
637 $result = $object->insertExtraFields(empty($triggermodname) ?
'' : $triggermodname, $user);
645 $action =
'edit_extras';
652 if ($action ==
"change_property" &&
GETPOST(
'btn_update_ticket_prop',
'alpha') && $user->rights->ticket->write) {
653 $object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha'));
655 $object->type_code =
GETPOST(
'update_value_type',
'aZ09');
656 $object->severity_code =
GETPOST(
'update_value_severity',
'aZ09');
657 $object->category_code =
GETPOST(
'update_value_category',
'aZ09');
659 $ret = $object->update($user);
672 $permissiondellink = $user->rights->ticket->write;
673 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
676 $upload_dir = $conf->ticket->dir_output;
677 $permissiontoadd = $user->rights->ticket->write;
678 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
681 $triggersendname =
'TICKET_SENTBYMAIL';
683 $autocopy =
'MAIN_MAIL_AUTOCOPY_TICKET_TO';
684 $trackid =
'tic'.$object->id;
685 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
688 if (
GETPOSTISSET(
'actionbis') && $action ==
'presend') {
689 $action =
'presend_addmessage';
698 $userstat =
new User($db);
705 $help_url =
'EN:Module_Ticket|FR:DocumentationModuleTicket';
707 $page_title = $actionobject->getTitle($action);
711 if ($action ==
'create' || $action ==
'presend') {
716 $formticket->withfromsocid = $socid ? $socid : $user->socid;
717 $formticket->withfromcontactid = $contactid ? $contactid :
'';
718 $formticket->withtitletopic = 1;
719 $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (empty($conf->global->TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION) ? 0 : 1));
720 $formticket->withusercreate = 0;
721 $formticket->withref = 1;
722 $formticket->fk_user_create = $user->id;
723 $formticket->withfile = 2;
724 $formticket->withextrafields = 1;
725 $formticket->param = array(
'origin' =>
GETPOST(
'origin'),
'originid' =>
GETPOST(
'originid'));
727 $formticket->withcancel = 1;
729 $formticket->showForm(1,
'create', 0);
781 } 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'
782 || $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') {
785 if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
790 if ($action ==
'close') {
791 $thirdparty_contacts = $object->getInfosTicketExternalContact();
792 $contacts_select = array(
793 '-2' => $langs->trans(
'TicketNotifyAllTiersAtClose'),
794 '-3' => $langs->trans(
'TicketNotNotifyTiersAtClose')
796 foreach ($thirdparty_contacts as $thirdparty_contact) {
797 $contacts_select[$thirdparty_contact[
'id']] = $thirdparty_contact[
'civility'] .
' ' . $thirdparty_contact[
'lastname'] .
' ' . $thirdparty_contact[
'firstname'];
801 $default = (!empty($conf->global->TICKET_NOTIFY_AT_CLOSING)) ? -2 : -3;
802 $formquestion = array(
804 'name' =>
'contactid',
806 'label' => $langs->trans(
'NotifyThirdpartyOnTicketClosing'),
807 'values' => $contacts_select,
808 'default' => $default
812 print
$form->formconfirm($url_page_current.
"?track_id=".$object->track_id, $langs->trans(
"CloseATicket"), $langs->trans(
"ConfirmCloseAticket"),
"confirm_close", $formquestion,
'', 1);
815 if ($action ==
'abandon') {
816 print
$form->formconfirm($url_page_current.
"?track_id=".$object->track_id, $langs->trans(
"AbandonTicket"), $langs->trans(
"ConfirmAbandonTicket"),
"confirm_abandon",
'',
'', 1);
817 if ($ret ==
'html') {
822 if ($action ==
'delete') {
823 print
$form->formconfirm($url_page_current.
"?track_id=".$object->track_id, $langs->trans(
"Delete"), $langs->trans(
"ConfirmDeleteTicket"),
"confirm_delete_ticket",
'',
'', 1);
826 if ($action ==
'reopen') {
827 print
$form->formconfirm($url_page_current.
'?track_id='.$object->track_id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReOpenTicket'),
'confirm_reopen',
'',
'', 1);
830 if ($action ==
'set_status') {
831 $new_status =
GETPOST(
'new_status');
833 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->statuts_short[$new_status])),
"confirm_set_status",
'',
'', 1);
837 if ($projectid > 0) {
838 $projectstat =
new Project($db);
839 if ($projectstat->fetch($projectid) > 0) {
840 $projectstat->fetch_thirdparty();
844 $userWrite = $projectstat->restrictedProjectArea($user,
'write');
850 print
dol_get_fiche_head($head,
'ticket', $langs->trans(
"Project"), 0, ($projectstat->public ?
'projectpub' :
'project'));
855 print
'<table class="border centpercent">';
857 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
860 print
'<tr><td width="30%">'.$langs->trans(
'Ref').
'</td><td colspan="3">';
862 if (empty($user->rights->projet->all->lire)) {
863 $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
864 $projectstat->next_prev_filter =
" rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
866 print
$form->showrefnav($projectstat,
'ref', $linkback, 1,
'ref',
'ref',
'');
870 print
'<tr><td>'.$langs->trans(
"Label").
'</td><td>'.$projectstat->title.
'</td></tr>';
873 print
"<tr><td>".$langs->trans(
"ThirdParty").
"</td>";
874 print
'<td colspan="3">';
875 if ($projectstat->thirdparty->id > 0) {
876 print $projectstat->thirdparty->getNomUrl(1);
884 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
885 if ($projectstat->public) {
886 print $langs->trans(
'SharedProject');
888 print $langs->trans(
'PrivateProject');
894 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>'.$projectstat->getLibStatut(4).
'</td></tr>';
900 print
"ErrorRecordNotFound";
902 } elseif ($socid > 0) {
903 $object->fetch_thirdparty();
908 dol_banner_tab($object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
913 if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
914 $object->next_prev_filter =
"te.fk_user_assign = '".$user->id.
"'";
915 } elseif ($user->socid > 0) {
916 $object->next_prev_filter =
"te.fk_soc = '".$user->socid.
"'";
923 $morehtmlref =
'<div class="refidno">';
924 $morehtmlref .= $object->subject;
926 if ($object->fk_user_create > 0) {
927 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
929 $fuser =
new User($db);
930 $fuser->fetch($object->fk_user_create);
931 $morehtmlref .= $fuser->getNomUrl(-1);
932 } elseif (!empty($object->email_msgid)) {
933 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
934 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
935 $morehtmlref .=
dol_escape_htmltag($object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.
$form->textwithpicto($langs->trans(
"CreatedByEmailCollector"), $langs->trans(
"EmailMsgID").
': '.$object->email_msgid).
')</small>';
936 } elseif (!empty($object->origin_email)) {
937 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
938 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
939 $morehtmlref .=
dol_escape_htmltag($object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.$langs->trans(
"CreatedByPublicPortal").
')</small>';
944 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' ';
945 if ($action !=
'editcustomer' && $object->status < 8 && !$user->socid && $user->rights->ticket->write) {
946 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editcustomer&token='.
newToken().
'&track_id='.$object->track_id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 0).
'</a> : ';
948 if ($action ==
'editcustomer') {
949 $morehtmlref .=
$form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'editcustomer',
'', 1, 0, 0, array(), 1);
951 $morehtmlref .=
$form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'none',
'', 1, 0, 0, array(), 1);
957 $langs->load(
"projects");
958 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
959 if ($user->rights->ticket->write) {
960 if ($action !=
'classify') {
961 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a>';
963 $morehtmlref .=
' : ';
964 if ($action ==
'classify') {
966 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
967 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
968 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
969 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1, 0,
'maxwidth500');
970 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
971 $morehtmlref .=
'</form>';
973 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
976 if (!empty($object->fk_project)) {
978 $proj->fetch($object->fk_project);
979 $morehtmlref .= $proj->getNomUrl(1);
986 $morehtmlref .=
'</div>';
988 $linkback =
'<a href="'.DOL_URL_ROOT.
'/ticket/list.php?restore_lastsearch_values=1"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
990 dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref);
992 print
'<div class="fichecenter">';
993 print
'<div class="fichehalfleft">';
994 print
'<div class="underbanner clearboth"></div>';
996 print
'<table class="border tableforfield centpercent">';
999 print
'<tr><td class="titlefield">'.$langs->trans(
"TicketTrackId").
'</td><td>';
1000 if (!empty($object->track_id)) {
1001 if (empty($object->ref)) {
1002 $object->ref = $object->id;
1003 print
$form->showrefnav($object,
'id', $linkback, 1,
'rowid',
'track_id');
1005 print $object->track_id;
1008 print $langs->trans(
'None');
1014 print
$form->editfieldkey(
"Subject",
'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid,
'string');
1016 print
$form->editfieldval(
"Subject",
'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid,
'string');
1020 print
'<tr><td>'.$langs->trans(
"DateCreation").
'</td><td>';
1043 print
'<tr><td>'.$langs->trans(
"TicketReadOn").
'</td><td>';
1044 if (!empty($object->date_read)) {
1047 print
' / <i>'.convertSecondToTime(
roundUpToNextMultiple($now - $object->date_read, 60)).
'</i></span>';
1052 print
'<tr><td>'.$langs->trans(
"TicketCloseOn").
'</td><td>';
1053 if (!empty($object->date_close)) {
1060 print
'<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
1061 print $langs->trans(
"AssignedTo");
1062 if (isset($object->status) && $object->status < $object::STATUS_CLOSED &&
GETPOST(
'set',
'alpha') !=
"assign_ticket" && $user->rights->ticket->manage) {
1063 print
'</td><td class="right"><a class="editfielda" href="'.$url_page_current.
'?track_id='.$object->track_id.
'&action=view&set=assign_ticket">'.
img_edit($langs->trans(
'Modify'),
'').
'</a>';
1065 print
'</td></tr></table>';
1067 if (
GETPOST(
'set',
'alpha') !=
"assign_ticket" && $object->fk_user_assign > 0) {
1068 $userstat->fetch($object->fk_user_assign);
1069 print $userstat->getNomUrl(-1);
1073 if (
GETPOST(
'set',
'alpha') ==
"assign_ticket" && $object->status < 8 && !$user->socid && $user->rights->ticket->write) {
1074 print
'<form method="post" name="ticket" enctype="multipart/form-data" action="'.$url_page_current.
'">';
1075 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1076 print
'<input type="hidden" name="action" value="assign_user">';
1077 print
'<input type="hidden" name="track_id" value="'.$object->track_id.
'">';
1079 print
$form->select_dolusers(empty($object->fk_user_assign)?$user->id:$object->fk_user_assign,
'fk_user_assign', 1);
1080 print
' <input type="submit" class="button small" name="btn_assign_user" value="'.$langs->trans(
"Validate").
'" />';
1087 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
1088 print $langs->trans(
'Progression').
'</td><td class="left">';
1090 if ($action !=
'progression' && isset($object->status) && $object->status < $object::STATUS_CLOSED && !$user->socid) {
1091 print
'<td class="right"><a class="editfielda" href="'.$url_page_current.
'?action=progression&track_id='.$object->track_id.
'">'.
img_edit($langs->trans(
'Modify')).
'</a></td>';
1093 print
'</tr></table>';
1095 if ($user->rights->ticket->write && $action ==
'progression') {
1096 print
'<form action="'.$url_page_current.
'" method="post">';
1097 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1098 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1099 print
'<input type="hidden" name="action" value="set_progression">';
1100 print
'<input type="text" class="flat width75" name="progress" value="'.$object->progress.
'">';
1101 print
' <input type="submit" class="button button-edit small" value="'.$langs->trans(
'Modify').
'">';
1104 print($object->progress > 0 ? $object->progress :
'0').
'%';
1111 $object->fetchObjectLinked();
1112 $num = count($object->linkedObjects);
1116 foreach ($object->linkedObjects as $objecttype => $objects) {
1117 if ($objecttype =
"fichinter") {
1118 foreach ($objects as $fichinter) {
1120 $timing += $fichinter->duration;
1126 print
$form->textwithpicto($langs->trans(
"TicketDurationAuto"), $langs->trans(
"TicketDurationAutoInfos"), 1);
1128 print $foundinter ?
convertSecondToTime($timing,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY) :
'';
1133 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1139 print
'</div><div class="fichehalfright">';
1142 print
'<form method="post" name="formticketproperties" action="'.$url_page_current.
'">';
1143 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1144 print
'<input type="hidden" name="action" value="change_property">';
1145 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1147 print
'<div class="underbanner clearboth"></div>';
1151 print
'<table class="border centpercent tableforfield">';
1153 print
'<td class="valignmiddle titlefield">';
1154 print
'<table class="nobordernopadding centpercent"><tr><td class="titlefield">';
1155 print $langs->trans(
"Categories");
1156 if ($action !=
'categories' && !$user->socid) {
1157 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>';
1162 if ($user->rights->ticket->write && $action ==
'categories') {
1163 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_TICKET,
'',
'parent', 64, 0, 1);
1164 if (is_array($cate_arbo)) {
1166 print
'<td colspan="3">';
1167 print
'<form action="'.$url_page_current.
'" method="post">';
1168 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1169 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1170 print
'<input type="hidden" name="action" value="set_categories">';
1173 $cats = $category->containing($object->id,
'ticket');
1174 $arrayselected = array();
1175 foreach ($cats as $cat) {
1176 $arrayselected[] = $cat->id;
1179 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1180 print
'<input type="submit" class="button button-edit small" value="'.$langs->trans(
'Save').
'">';
1185 print
'<td colspan="3">';
1186 print
$form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
1194 $actionobject->viewTicketOriginalMessage($user, $action, $object);
1197 print
'<div class="div-table-responsive-no-min">';
1198 print
'<table class="noborder tableforfield centpercent margintable">';
1199 print
'<tr class="liste_titre">';
1201 print $langs->trans(
'TicketProperties');
1204 if (
GETPOST(
'set',
'alpha') ==
'properties' && $user->rights->ticket->write) {
1205 print
'<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans(
"Modify").
'" />';
1208 if (isset($object->status) && $object->status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) {
1209 print
' <a class="editfielda" href="card.php?track_id='.$object->track_id.
'&action=view&set=properties">'.
img_edit($langs->trans(
'Modify')).
'</a>';
1215 if (
GETPOST(
'set',
'alpha') ==
'properties' && $user->rights->ticket->write) {
1218 print
'<td class="titlefield">';
1219 print $langs->trans(
'Type');
1221 $formticket->selectTypesTickets($object->type_code,
'update_value_type',
'', 2);
1227 print $langs->trans(
'TicketCategory');
1229 $formticket->selectGroupTickets($object->category_code,
'update_value_category',
'', 2, 0, 0, 0,
'maxwidth500 widthcentpercentminusxx');
1235 print $langs->trans(
'TicketSeverity');
1237 $formticket->selectSeveritiesTickets($object->severity_code,
'update_value_severity',
'', 2);
1242 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
1243 if (!empty($object->type_code)) {
1244 print $langs->getLabelFromKey($db,
'TicketTypeShort'.$object->type_code,
'c_ticket_type',
'code',
'label', $object->type_code);
1248 print
'<tr><td>'.$langs->trans(
"TicketCategory").
'</td><td>';
1249 if (!empty($object->category_code)) {
1250 print $langs->getLabelFromKey($db,
'TicketCategoryShort'.$object->category_code,
'c_ticket_category',
'code',
'label', $object->category_code);
1254 print
'<tr><td>'.$langs->trans(
"TicketSeverity").
'</td><td>';
1255 if (!empty($object->severity_code)) {
1256 print $langs->getLabelFromKey($db,
'TicketSeverityShort'.$object->severity_code,
'c_ticket_severity',
'code',
'label', $object->severity_code);
1266 print
'<!-- navbar with status -->';
1267 if (!$user->socid && $user->rights->ticket->write && isset($object->status) && $object->status < $object::STATUS_CLOSED &&
GETPOST(
'set') !==
'properties') {
1268 $actionobject->viewStatusActions($object);
1272 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
1273 print
load_fiche_titre($langs->trans(
'Contacts'),
'',
'title_companies.png');
1275 print
'<div class="div-table-responsive-no-min">';
1276 print
'<div class="tagtable centpercent noborder allwidth">';
1278 print
'<div class="tagtr liste_titre">';
1279 print
'<div class="tagtd">'.$langs->trans(
"Source").
'</div>
1280 <div class="tagtd">' . $langs->trans(
"Company").
'</div>
1281 <div class="tagtd">' . $langs->trans(
"Contacts").
'</div>
1282 <div class="tagtd">' . $langs->trans(
"ContactType").
'</div>
1283 <div class="tagtd">' . $langs->trans(
"Phone").
'</div>
1284 <div class="tagtd center">' . $langs->trans(
"Status").
'</div>';
1285 print
'</div><!-- tagtr -->';
1288 $companystatic =
new Societe($db);
1289 $contactstatic =
new Contact($db);
1290 $userstatic =
new User($db);
1292 foreach (array(
'internal',
'external') as $source) {
1293 $tmpobject = $object;
1294 $tab = $tmpobject->listeContact(-1, $source);
1299 print
'<div class="tagtr '.($var ?
'pair' :
'impair').
'">';
1301 print
'<div class="tagtd left">';
1302 if ($tab[$i][
'source'] ==
'internal') {
1303 echo $langs->trans(
"User");
1306 if ($tab[$i][
'source'] ==
'external') {
1307 echo $langs->trans(
"ThirdPartyContact");
1311 print
'<div class="tagtd left">';
1313 if ($tab[$i][
'socid'] > 0) {
1314 $companystatic->fetch($tab[$i][
'socid']);
1315 echo $companystatic->getNomUrl(-1);
1317 if ($tab[$i][
'socid'] < 0) {
1318 echo $conf->global->MAIN_INFO_SOCIETE_NOM;
1320 if (!$tab[$i][
'socid']) {
1325 print
'<div class="tagtd">';
1326 if ($tab[$i][
'source'] ==
'internal') {
1327 if ($userstatic->fetch($tab[$i][
'id'])) {
1328 print $userstatic->getNomUrl(-1);
1331 if ($tab[$i][
'source'] ==
'external') {
1332 if ($contactstatic->fetch($tab[$i][
'id'])) {
1333 print $contactstatic->getNomUrl(-1);
1337 <div class="tagtd">' . $tab[$i][
'libelle'].
'</div>';
1339 print
'<div class="tagtd">';
1341 print
dol_print_phone($tab[$i][
'phone'],
'',
'',
'',
'AC_TEL').
'<br>';
1343 if (!empty($tab[$i][
'phone_perso'])) {
1345 print
'<br>'.dol_print_phone($tab[$i][
'phone_perso'],
'',
'',
'',
'AC_TEL').
'<br>';
1347 if (!empty($tab[$i][
'phone_mobile'])) {
1349 print
dol_print_phone($tab[$i][
'phone_mobile'],
'',
'',
'',
'AC_TEL').
'<br>';
1353 print
'<div class="tagtd center">';
1354 if ($object->status >= 0) {
1355 echo
'<a href="contact.php?track_id='.$object->track_id.
'&action=swapstatut&ligne='.$tab[$i][
'rowid'].
'">';
1358 if ($tab[$i][
'source'] ==
'internal') {
1359 $userstatic->id = $tab[$i][
'id'];
1360 $userstatic->lastname = $tab[$i][
'lastname'];
1361 $userstatic->firstname = $tab[$i][
'firstname'];
1362 echo $userstatic->LibStatut($tab[$i][
'statuscontact'], 3);
1364 if ($tab[$i][
'source'] ==
'external') {
1365 $contactstatic->id = $tab[$i][
'id'];
1366 $contactstatic->lastname = $tab[$i][
'lastname'];
1367 $contactstatic->firstname = $tab[$i][
'firstname'];
1368 echo $contactstatic->LibStatut($tab[$i][
'statuscontact'], 3);
1370 if ($object->status >= 0) {
1376 print
'</div><!-- tagtr -->';
1382 print
'</div><!-- contact list -->';
1386 print
'</div></div>';
1387 print
'<div style="clear:both"></div>';
1393 if ($action !=
'presend' && $action !=
'presend_addmessage' && $action !=
'editline') {
1394 print
'<div class="tabsAction">'.
"\n";
1395 $parameters = array();
1396 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1401 if (empty($reshook)) {
1403 if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage") {
1404 print
dolGetButtonAction(
'', $langs->trans(
'TicketAddMessage'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend_addmessage&mode=init&token='.
newToken().
'&track_id='.$object->track_id,
'');
1410 print
dolGetButtonAction($langs->trans(
'UnableToCreateInterIfNoSocid'), $langs->trans(
'TicketAddIntervention'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1412 if ($object->fk_soc > 0 && isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) {
1413 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,
'');
1423 if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
1424 print
dolGetButtonAction(
'', $langs->trans(
'CloseTicket'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.
newToken().
'&track_id='.$object->track_id,
'');
1428 if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
1429 print
dolGetButtonAction(
'', $langs->trans(
'AbandonTicket'),
'default', $_SERVER[
"PHP_SELF"].
'?action=abandon&token='.
newToken().
'&track_id='.$object->track_id,
'');
1433 if (!$user->socid && (isset($object->status) && ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED)) && !$user->socid) {
1434 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&track_id='.$object->track_id,
'');
1438 if ($user->rights->ticket->delete && !$user->socid) {
1439 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&track_id='.$object->track_id,
'');
1442 print
'</div>'.
"\n";
1448 if (
GETPOST(
'modelselected')) {
1449 $action =
'presend';
1452 if (
GETPOSTISSET(
'actionbis') && $action ==
'presend') {
1453 $action =
'presend_addmessage';
1457 if ($action ==
'presend' || $action ==
'presend_addmessage') {
1458 if ($object->fk_soc > 0) {
1459 $object->fetch_thirdparty();
1462 $outputlangs = $langs;
1464 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
1465 $newlang =
GETPOST(
'lang_id',
'aZ09');
1466 } elseif ($conf->global->MAIN_MULTILANGS && empty($newlang) && is_object($object->thirdparty)) {
1467 $newlang = $object->thirdparty->default_lang;
1469 if (!empty($newlang)) {
1470 $outputlangs =
new Translate(
"", $conf);
1471 $outputlangs->setDefaultLang($newlang);
1474 $arrayoffamiliestoexclude = array(
'objectamount');
1476 $action =
'add_message';
1477 $modelmail =
'ticket_send';
1480 $morehtmlright =
'';
1483 $morehtmlright .=
$form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"TicketMessageSubstitutionReplacedByGenericValues").
'</span>', $help, 1,
'helpclickable',
'', 0, 3,
'helpsubstitution');
1487 print
load_fiche_titre($langs->trans(
'TicketAddMessage'), $morehtmlright,
'messages@ticket');
1493 $formticket->action = $action;
1494 $formticket->track_id = $object->track_id;
1495 $formticket->ref = $object->ref;
1496 $formticket->id = $object->id;
1498 $formticket->withfile = 2;
1499 $formticket->withcancel = 1;
1500 $formticket->param = array(
'fk_user_create' => $user->id);
1501 $formticket->param[
'langsmodels'] = (empty($newlang) ? $langs->defaultlang : $newlang);
1504 $formticket->param[
'models'] = $modelmail;
1505 $formticket->param[
'models_id'] =
GETPOST(
'modelmailselected',
'int');
1507 $formticket->param[
'returnurl'] = $_SERVER[
"PHP_SELF"].
'?track_id='.$object->track_id;
1509 $formticket->withsubstit = 1;
1510 $formticket->substit = $substitutionarray;
1511 $formticket->backtopage = $backtopage;
1513 $formticket->showMessageForm(
'100%');
1518 if (!empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) {
1519 $param =
'&id='.$object->id;
1520 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1521 $param .=
'&contextpage='.$contextpage;
1523 if ($limit > 0 && $limit != $conf->liste_limit) {
1524 $param .=
'&limit='.$limit;
1527 $param .=
'&actioncode='.urlencode($actioncode);
1529 if ($search_agenda_label) {
1530 $param .=
'&search_agenda_label='.urlencode($search_agenda_label);
1533 $morehtmlright =
'';
1535 $messagingUrl = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.$object->track_id;
1536 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'MessageListViewType'),
'',
'fa fa-bars imgforviewmode', $messagingUrl,
'', 1);
1539 $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage" && $action !=
"add_message";
1540 $url =
'card.php?track_id='.$object->track_id.
'&action=presend_addmessage&mode=init';
1541 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'TicketAddMessage'),
'',
'fa fa-comment-dots', $url,
'add-new-ticket-title-button', $btnstatus);
1544 $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage" && $action !=
"add_message"; ;
1545 $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);
1546 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', $url,
'add-new-ticket-even-button', $btnstatus);
1548 print_barre_liste($langs->trans(
"ActionsOnTicket"), 0, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 1);
1552 $filters[
'search_agenda_label'] = $search_agenda_label;
1553 show_ticket_messaging($conf, $langs, $db, $object, null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
1556 if ($action !=
'presend' && $action !=
'presend_addmessage' && $action !=
'add_message') {
1557 print
'<div class="fichecenter"><div class="fichehalfleft">';
1558 print
'<a name="builddoc"></a>';
1561 $linktoelem =
$form->showLinkToObjectBlock($object, null, array(
'ticket'));
1562 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
1565 print
'<br><!-- Link to public interface -->'.
"\n";
1569 if (empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) {
1570 print
'<div class="fichehalfright">';
1574 $morehtmlcenter =
'<div class="nowraponall">';
1575 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/ticket/messaging.php?id='.$object->id);
1576 $morehtmlcenter .=
' ';
1577 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/ticket/agenda.php?id='.$object->id);
1578 $morehtmlcenter .=
'</div>';
1581 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1583 $somethingshown =
$formactions->showactions($object,
'ticket', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter);
project_prepare_head(Project $project, $moreparam= '')
Prepare array with list of tabs.
show_ticket_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 for ticket messaging.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action== 'set') elseif($action== 'specimen') elseif($action== 'setmodel') elseif($action== 'del') elseif($action== 'setdoc') $formactions
View.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
ticket_prepare_head($object)
Build tabs for a Ticket object.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
dol_print_phone($phone, $countrycode= '', $cid=0, $socid=0, $addlink= '', $separ=" ", $withpicto= '', $titlealt= '', $adddivfloat=0)
Format phone numbers according to country.
dolGetButtonAction($label, $html= '', $actionType= 'default', $url= '', $id= '', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage categories.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage translations.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
showDirectPublicLink($object)
Return string with full Url.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Class Actions of the module ticket.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
isModEnabled($module)
Is Dolibarr module enabled.
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.
roundUpToNextMultiple($n, $x=5)
Round to next multiple.
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.