34require
'../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.
'/ticket/class/actions_ticket.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formticket.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
53 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
54 include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
55 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
58 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcontract.class.php';
59 include_once DOL_DOCUMENT_ROOT.
'/core/lib/contract.lib.php';
60 include_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
64$langs->loadLangs(array(
"companies",
"other",
"ticket"));
69$track_id =
GETPOST(
'track_id',
'alpha', 3);
73$notifyTiers =
GETPOST(
"notify_tiers_at_create",
'alpha');
76$action =
GETPOST(
'action',
'aZ09');
77$cancel =
GETPOST(
'cancel',
'alpha');
78$backtopage =
GETPOST(
'backtopage',
'alpha');
79$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
80$contextpage =
GETPOST(
'contextpage',
'aZ');
83$sortfield =
GETPOST(
'sortfield',
'aZ09comma') ?
GETPOST(
'sortfield',
'aZ09comma') :
"a.datep";
84$sortorder =
GETPOST(
'sortorder',
'aZ09comma') ?
GETPOST(
'sortorder',
'aZ09comma') :
"desc";
85$search_rowid =
GETPOST(
'search_rowid');
86$search_agenda_label =
GETPOST(
'search_agenda_label');
88if (
GETPOST(
'actioncode',
'array')) {
89 $actioncode =
GETPOST(
'actioncode',
'array', 3);
90 if (!count($actioncode)) {
99$hookmanager->initHooks(array(
'ticketcard',
'globalcard'));
104$extrafields->fetch_name_optionals_label(
$object->table_element);
106$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
109$search_all =
GETPOST(
"search_all",
'alpha');
111foreach (
$object->fields as $key => $val) {
112 if (
GETPOST(
'search_'.$key,
'alpha')) {
113 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
117if (empty($action) && empty($id) && empty($ref)) {
122if (
GETPOST(
'modelselected',
'alpha')) {
129if ($id || $track_id || $ref) {
130 $res =
$object->fetch($id, $ref, $track_id);
142$url_page_current = DOL_URL_ROOT.
'/ticket/card.php';
145if ($user->socid > 0) {
146 $socid = $user->socid;
150$triggermodname =
'TICKET_MODIFY';
153$permissiontoread = $user->hasRight(
'ticket',
'read');
154$permissiontoadd = $user->hasRight(
'ticket',
'write');
155$permissiontodelete = $user->hasRight(
'ticket',
'delete');
157$permissiontomanage = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ticket',
'write')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ticket',
'manage_advance')));
158$permissiontoeditextra = $permissiontoadd;
159if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
161 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
164$upload_dir =
$conf->ticket->dir_output;
171$parameters = array();
172$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
174 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
178if (empty($reshook)) {
180 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
182 $search_agenda_label =
'';
185 $backurlforlist = DOL_URL_ROOT .
'/ticket/list.php';
187 if (empty($backtopage) || ($cancel && empty($id))) {
188 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
189 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
190 $backtopage = $backurlforlist;
192 $backtopage = DOL_URL_ROOT .
'/ticket/card.php?id=' . ((!empty($id) &&
$id > 0) ? $id :
'__ID__');
198 if (!empty($backtopageforcancel)) {
199 header(
"Location: " . $backtopageforcancel);
201 } elseif (!empty($backtopage)) {
202 header(
"Location: " . $backtopage);
208 if ((($action ==
'add' &&
GETPOST(
'save',
'alpha')) || ($action ==
'update' &&
$object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) {
209 $ifErrorAction = ($action ==
'add' ?
'create' :
'edit');
210 if ($action ==
'add') {
216 'ref' => [
'check' =>
'alpha',
'langs' =>
'Ref'],
217 'type_code' => [
'check' =>
'alpha',
'langs' =>
'TicketTypeRequest'],
218 'category_code' => [
'check' =>
'alpha',
'langs' =>
'TicketCategory'],
219 'severity_code' => [
'check' =>
'alpha',
'langs' =>
'TicketSeverity'],
220 'subject' => [
'check' =>
'alphanohtml',
'langs' =>
'Subject'],
221 'message' => [
'check' =>
'restricthtml',
'langs' =>
'Message']
226 if (!empty($error)) {
227 $action = $ifErrorAction;
230 $ret = $extrafields->setOptionalsFromPost(
null, $object);
234 $getRef =
GETPOST(
'ref',
'alpha');
236 if (!empty($getRef)) {
237 $isExistingRef =
$object->checkExistingRef($action, $getRef);
239 $isExistingRef =
true;
244 if ($isExistingRef) {
245 if ($action ==
'update') {
249 } elseif ($action ==
'add') {
254 if (!empty($getRef)) {
255 setEventMessage($langs->trans(
'TicketRefAlreadyUsed', $getRef,
$object->ref), $style);
267 $fk_user_assign =
GETPOSTINT(
'fk_user_assign');
271 if ($fk_user_assign > 0) {
272 $object->fk_user_assign = $fk_user_assign;
273 $object->status = $object::STATUS_ASSIGNED;
276 if ($action ==
'add') {
278 $object->type_label = $langs->trans($langs->getLabelFromKey($db,
$object->type_code,
'c_ticket_type',
'code',
'label'));
279 $object->category_label = $langs->trans($langs->getLabelFromKey($db,
$object->category_code,
'c_ticket_category',
'code',
'label'));
280 $object->severity_label = $langs->trans($langs->getLabelFromKey($db,
$object->severity_code,
'c_ticket_severity',
'code',
'label'));
281 $object->fk_user_create = $user->id;
282 $object->email_from = $user->email;
284 $notifyTiers =
GETPOST(
"notify_tiers_at_create",
'alpha');
285 $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1;
295 $action = $ifErrorAction;
300 $categories =
GETPOST(
'categories',
'array:int');
301 $object->setCategories($categories);
304 if ($action ==
'add') {
308 $type_contact =
GETPOST(
"type",
'alpha');
310 if ($contactid > 0 && $type_contact) {
312 $result =
$object->add_contact($contactid, $typeid,
'external');
316 if (
GETPOST(
'origin',
'alpha') ==
'projet') {
322 if ($projectid > 0) {
323 $object->setProject($projectid);
327 if (
getDolGlobalString(
'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND') && $permissiontomanage) {
328 if (!
$object->markAsRead($user) > 0) {
334 if ((empty($fk_user_assign) &&
getDolGlobalInt(
'TICKET_AUTO_ASSIGN_USER_CREATE') == 1) || (
getDolGlobalInt(
'TICKET_AUTO_ASSIGN_USER_CREATE') == 2)) {
335 $result =
$object->assignUser($user, $user->id, 1);
336 $object->add_contact($user->id,
"SUPPORTTEC",
'internal');
342 $object->copyFilesForTicket(
'');
348 if (!empty($backtopage)) {
352 $url =
'card.php?track_id=' . urlencode(
$object->track_id);
355 $url =
'card.php?track_id=' . urlencode(
$object->track_id);
358 header(
"Location: " . $url);
365 $action = $ifErrorAction;
370 if ($action ==
"set_read" && $permissiontomanage) {
373 if (
$object->markAsRead($user) > 0) {
374 setEventMessages($langs->trans(
'TicketMarkedAsRead'),
null,
'mesgs');
376 header(
"Location: card.php?track_id=" .
$object->track_id);
385 if ($action ==
"assign_user" &&
GETPOST(
'btn_assign_user',
'alpha') && $permissiontomanage) {
387 $useroriginassign =
$object->fk_user_assign;
397 $ret =
$object->assignUser($user, $usertoassign);
405 if ($useroriginassign > 0) {
406 $internal_contacts =
$object->listeContact(-1,
'internal', 0,
'SUPPORTTEC');
407 foreach ($internal_contacts as $key => $contact) {
408 if ($contact[
'id'] !== $usertoassign) {
409 $result =
$object->delete_contact($contact[
'rowid']);
418 if ($usertoassign > 0 && $usertoassign !== $useroriginassign) {
419 $result =
$object->add_contact($usertoassign,
"SUPPORTTEC",
'internal', $notrigger = 0);
428 if ($usertoassign > 0) {
430 $object->fetch_user($usertoassign);
431 setEventMessages($langs->trans(
'TicketAssigned'),
null,
'mesgs');
433 setEventMessages($langs->trans(
'TicketUnassigned'),
null,
'mesgs');
435 header(
"Location: card.php?track_id=" .
$object->track_id);
445 if ($action ==
'add_message' &&
GETPOSTISSET(
'btn_add_message') && $permissiontoread) {
449 if (!empty($backtopage)) {
452 $url =
'card.php?track_id=' . urlencode(
$object->track_id);
455 header(
"Location: " . $url);
463 if (($action ==
"confirm_close" || $action ==
"confirm_abandon") &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontomanage) {
469 if (
$object->close($user, ($action ==
"confirm_abandon" ? 1 : 0)) > 0) {
470 setEventMessages($langs->trans(
'TicketMarkedAsClosed'),
null,
'mesgs');
472 $url =
'card.php?track_id=' .
GETPOST(
'track_id',
'alpha');
473 header(
"Location: " . $url);
481 if ($action ==
"confirm_public_close" &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoadd) {
483 if ($_SESSION[
'email_customer'] ==
$object->origin_email || $_SESSION[
'email_customer'] ==
$object->thirdparty->email) {
486 if (
$object->close($user) > 0) {
487 setEventMessages(
'<div class="confirm">' . $langs->trans(
'TicketMarkedAsClosed') .
'</div>',
null,
'mesgs');
489 $url =
'card.php?track_id=' .
GETPOST(
'track_id',
'alpha');
490 header(
"Location: " . $url);
501 if ($action ==
'confirm_clone' &&
GETPOST(
'confirm',
'alpha') ==
"yes" && $permissiontomanage) {
505 header(
"Location: " . DOL_URL_ROOT .
"/ticket/card.php?id=".$newid);
514 if ($action ==
'confirm_delete_ticket' &&
GETPOST(
'confirm',
'alpha') ==
"yes" && $permissiontodelete) {
517 if (
$object->delete($user) > 0) {
518 setEventMessages(
'<div class="confirm">' . $langs->trans(
'TicketDeletedSuccess') .
'</div>',
null,
'mesgs');
519 header(
"Location: " . DOL_URL_ROOT .
"/ticket/list.php");
522 $langs->load(
"errors");
523 $mesg =
'<div class="error">' . $langs->trans(
$object->error) .
'</div>';
530 if ($action ==
'set_thirdparty' && $permissiontoadd) {
533 $url = $_SERVER[
"PHP_SELF"] .
'?track_id=' .
GETPOST(
'track_id',
'alpha');
534 header(
"Location: " . $url);
540 if ($action ==
'set_progression' && $permissiontoadd) {
544 $url =
'card.php?track_id=' .
$object->track_id;
545 header(
"Location: " . $url);
551 if ($action ==
'set_categories' && $permissiontoadd) {
555 $url =
'card.php?track_id=' .
$object->track_id;
556 header(
"Location: " . $url);
562 if ($action ==
'setsubject' && $permissiontoadd) {
564 if ($action ==
'setsubject') {
568 if ($action ==
'setsubject' && empty(
$object->subject)) {
570 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Subject")),
null,
'errors');
574 if (!
$object->update($user) >= 0) {
580 header(
"Location: " . $_SERVER[
'PHP_SELF'] .
"?track_id=" .
$object->track_id);
585 if ($action ==
'confirm_reopen' && $permissiontomanage && !
GETPOST(
'cancel')) {
588 if (
$object->status == Ticket::STATUS_CLOSED ||
$object->status == Ticket::STATUS_CANCELED) {
589 if (
$object->fk_user_assign !=
null) {
590 $res =
$object->setStatut(Ticket::STATUS_ASSIGNED,
null,
'', $triggermodname);
592 $res =
$object->setStatut(Ticket::STATUS_NOT_READ,
null,
'', $triggermodname);
595 $url =
'card.php?track_id=' .
$object->track_id;
596 header(
"Location: " . $url);
604 } elseif ($action ==
'classin' && $permissiontoadd) {
607 $object->setProject($projectid);
608 $url =
'card.php?track_id=' .
$object->track_id;
609 header(
"Location: " . $url);
612 } elseif ($action ==
'setcontract' && $permissiontoadd) {
616 $url =
'card.php?track_id=' .
$object->track_id;
617 header(
"Location: " . $url);
620 } elseif ($action ==
"set_message" && $permissiontoadd) {
624 $fieldtomodify =
GETPOST(
'message_initial',
'restricthtml');
626 $object->message = $fieldtomodify;
633 setEventMessages($langs->trans(
'TicketMessageSuccesfullyUpdated'),
null,
'mesgs');
641 } elseif ($action ==
'confirm_set_status' && $permissiontomanage && !
GETPOST(
'cancel')) {
646 $res =
$object->setStatut($new_status,
null,
'', $triggermodname);
648 if ($new_status != Ticket::STATUS_NOT_READ) {
649 $res =
$object->setReadDate($user, 1);
655 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"ticket SET date_read = null WHERE rowid = ".((int)
$object->id);
656 $resql = $db->query($sql);
658 dol_print_error($db);
661 $url =
'card.php?track_id=' .
$object->track_id;
662 header(
"Location: " . $url);
672 if ($action ==
"update_extras" && $permissiontoeditextra) {
675 $attribute_name =
GETPOST(
'attribute',
'aZ09');
677 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
683 $result =
$object->updateExtraField($attribute_name, $triggermodname);
691 $action =
'edit_extras';
695 if ($action ==
"change_property" &&
GETPOST(
'btn_update_ticket_prop',
'alpha') && $permissiontoadd) {
699 $object->severity_code =
GETPOST(
'update_value_severity',
'aZ09');
700 $object->category_code =
GETPOST(
'update_value_category',
'aZ09');
704 setEventMessages($langs->trans(
'TicketUpdated'),
null,
'mesgs');
713 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
715 $permissiondellink = $permissiontoadd;
716 include DOL_DOCUMENT_ROOT .
'/core/actions_dellink.inc.php';
719 include DOL_DOCUMENT_ROOT .
'/core/actions_printing.inc.php';
722 include DOL_DOCUMENT_ROOT .
'/core/actions_builddoc.inc.php';
725 $triggersendname =
'TICKET_SENTBYMAIL';
727 $autocopy =
'MAIN_MAIL_AUTOCOPY_TICKET_TO';
728 $trackid =
'tic' .
$object->id;
729 include DOL_DOCUMENT_ROOT .
'/core/actions_sendmails.inc.php';
732 if (
GETPOSTISSET(
'actionbis') && $action ==
'presend') {
733 $action =
'presend_addmessage';
742$userstat =
new User($db);
743$form =
new Form($db);
747$help_url =
'EN:Module_Ticket|FR:DocumentationModuleTicket';
749$title = $actionobject->getTitle($action, $object);
751llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-ticket page-card');
753if ($action ==
'create' || $action ==
'presend') {
754 if (empty($permissiontoadd)) {
762 $formticket->trackid =
'';
764 if (
GETPOST(
"mode",
"aZ09") ==
'init' && empty($_POST)) {
765 $formticket->clear_attached_files();
768 $formticket->withfromsocid = $socid ? $socid : $user->socid;
769 $formticket->withfromcontactid = $contactid ? $contactid :
'';
770 $formticket->withtitletopic = 1;
771 $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (
getDolGlobalString(
'TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION') ? 1 : 0));
772 $formticket->withusercreate = 0;
773 $formticket->withref = 1;
774 $formticket->fk_user_create = $user->id;
775 $formticket->withfile = 2;
776 $formticket->withextrafields = 1;
777 $formticket->param = array(
'origin' =>
GETPOST(
'origin'),
'originid' =>
GETPOST(
'originid'));
779 $formticket->withcancel = 1;
782 if (
GETPOST(
"mode",
"aZ09") ==
'init') {
783 $formticket->clear_attached_files();
786 $formticket->showForm(1,
'create', 0,
null, $action, $object);
789} elseif ($action ==
'edit' && $permissiontoadd &&
$object->status < Ticket::STATUS_CLOSED) {
790 if (empty($permissiontoadd)) {
800 $formticket->trackid =
'tic'.$object->id;
801 $formticket->withfromsocid =
$object->socid;
802 $formticket->withtitletopic = 1;
804 $formticket->withnotifytiersatcreate = 0;
805 $formticket->withusercreate = 0;
806 $formticket->withref = 1;
807 $formticket->fk_user_create = $user->id;
808 $formticket->withfile = 0;
809 $formticket->action =
'update';
810 $formticket->withextrafields = 1;
811 $formticket->param = array(
'origin' =>
GETPOST(
'origin'),
'originid' =>
GETPOST(
'originid'));
813 $formticket->withcancel = 1;
815 $formticket->showForm(0,
'edit', 0,
null, $action, $object);
819 if (!empty($res) && $res > 0) {
821 if (!$user->socid && (
getDolGlobalString(
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY') &&
$object->fk_user_assign != $user->id) && !$permissiontomanage) {
825 $trackid =
'tic'.$object->id;
830 if ($action ==
'close' && $permissiontomanage) {
831 $thirdparty_contacts =
$object->getInfosTicketExternalContact(1);
832 $contacts_select = array(
833 '-2' => $langs->trans(
'TicketNotifyAllTiersAtClose'),
834 '-3' => $langs->trans(
'TicketNotNotifyTiersAtClose')
836 foreach ($thirdparty_contacts as $thirdparty_contact) {
837 $contacts_select[$thirdparty_contact[
'id']] = $thirdparty_contact[
'civility'] .
' ' . $thirdparty_contact[
'lastname'] .
' ' . $thirdparty_contact[
'firstname'];
842 $formquestion = array(
844 'name' =>
'contactid',
846 'label' => $langs->trans(
'NotifyThirdpartyOnTicketClosing'),
847 'values' => $contacts_select,
848 'default' => $default
852 $formconfirm = $form->formconfirm($url_page_current.
"?track_id=".
$object->track_id, $langs->trans(
"CloseATicket"), $langs->trans(
"ConfirmCloseAticket"),
"confirm_close", $formquestion,
'', 1);
855 if ($action ==
'abandon' && $permissiontomanage) {
856 $formconfirm = $form->formconfirm($url_page_current.
"?track_id=".
$object->track_id, $langs->trans(
"AbandonTicket"), $langs->trans(
"ConfirmAbandonTicket"),
"confirm_abandon",
'',
'', 1);
859 if ($action ==
'delete' && $permissiontodelete) {
860 $formconfirm = $form->formconfirm($url_page_current.
"?track_id=".
$object->track_id, $langs->trans(
"Delete"), $langs->trans(
"ConfirmDeleteTicket"),
"confirm_delete_ticket",
'',
'', 1);
863 if ($action ==
'reopen' && $permissiontomanage) {
864 $formconfirm = $form->formconfirm($url_page_current.
'?track_id='.
$object->track_id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReOpenTicket'),
'confirm_reopen',
'',
'', 1);
867 if ($action ==
'set_status' && $permissiontomanage) {
870 $formconfirm = $form->formconfirm($url_page_current.
"?track_id=".
$object->track_id.
"&new_status=".$new_status, $langs->trans(
"TicketChangeStatus"), $langs->trans(
"TicketConfirmChangeStatus", $langs->transnoentities(
$object->labelStatusShort[$new_status])),
"confirm_set_status",
'',
'', 1);
873 if ($action ==
'clone') {
874 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk',
$object->ref),
'confirm_clone',
'',
'yes', 1);
878 $parameters = array(
'formConfirm' => $formconfirm);
879 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
880 if (empty($reshook)) {
881 $formconfirm .= $hookmanager->resPrint;
882 } elseif ($reshook > 0) {
883 $formconfirm = $hookmanager->resPrint;
890 if ($projectid > 0) {
891 $projectstat =
new Project($db);
892 if ($projectstat->fetch($projectid) > 0) {
893 $projectstat->fetch_thirdparty();
897 $userWrite = $projectstat->restrictedProjectArea($user,
'write');
903 print
dol_get_fiche_head($head,
'ticket', $langs->trans(
"Project"), 0, ($projectstat->public ?
'projectpub' :
'project'));
905 print
'<table class="border centpercent">';
907 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
910 print
'<tr><td>'.$langs->trans(
'Ref').
'</td><td colspan="3">';
912 if (!$user->hasRight(
'projet',
'all',
'lire')) {
913 $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
914 $projectstat->next_prev_filter =
"rowid:IN:".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
916 print $form->showrefnav($projectstat,
'ref', $linkback, 1,
'ref',
'ref',
'');
920 print
'<tr><td>'.$langs->trans(
"Label").
'</td><td>'.$projectstat->title.
'</td></tr>';
923 print
"<tr><td>".$langs->trans(
"ThirdParty").
"</td>";
924 print
'<td colspan="3">';
925 if ($projectstat->thirdparty->id > 0) {
926 print $projectstat->thirdparty->getNomUrl(1);
934 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
935 if ($projectstat->public) {
936 print $langs->trans(
'SharedProject');
938 print $langs->trans(
'PrivateProject');
944 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>'.$projectstat->getLibStatut(4).
'</td></tr>';
950 print
"ErrorRecordNotFound";
952 } elseif ($socid > 0) {
958 dol_banner_tab(
$object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
964 $object->next_prev_filter =
"te.fk_user_assign:=:".((int) $user->id);
965 } elseif ($user->socid > 0) {
966 $object->next_prev_filter =
"te.fk_soc:=:".((int) $user->socid);
971 print
dol_get_fiche_head($head,
'tabTicket', $langs->trans(
"Ticket"), -1,
'ticket', 0,
'',
'', 0,
'', 1);
973 $morehtmlref =
'<div class="refidno">';
975 if ($permissiontoadd && !$user->socid) {
976 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editsubject&token='.
newToken().
'&track_id='.urlencode(
$object->track_id).
'">'.img_edit($langs->transnoentitiesnoconv(
'SetTitle'), 0).
'</a> ';
978 if ($action !=
'editsubject') {
979 $morehtmlref .=
'<span class="smallonsmartphone">'.dolPrintLabel(
$object->subject).
'</span>';
981 $morehtmlref .=
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
982 $morehtmlref .=
'<input type="hidden" name="action" value="setsubject">';
983 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
984 $morehtmlref .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
985 $morehtmlref .=
'<input type="text" class="minwidth300" id="subject" name="subject" value="'.$object->subject.
'" autofocus="" spellcheck="false">';
986 $morehtmlref .=
'<input type="submit" class="smallpaddingimp button valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'">';
987 $morehtmlref .=
'<input type="submit" class="smallpaddingimp button button-cancel valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
988 $morehtmlref .=
'</form>';
993 if (
$object->fk_user_create > 0) {
994 $morehtmlref .=
'<br>';
997 $fuser =
new User($db);
998 $fuser->fetch(
$object->fk_user_create);
999 $morehtmlref .= $fuser->getNomUrl(-4);
1003 $createdfrompublicticket = 0;
1004 $createdfromemailcollector = 0;
1005 if (!empty(
$object->origin_email) && (empty(
$object->email_msgid) || preg_match(
'/dolibarr\-tic\d+/',
$object->email_msgid))) {
1007 $createdfrompublicticket = 1;
1008 } elseif (!empty(
$object->email_msgid)) {
1010 $createdfromemailcollector = 1;
1015 if ($createdfrompublicticket) {
1016 $htmltooltip .= $langs->trans(
"OriginEmail").
': '.
$object->origin_email;
1018 $morehtmlref .= ($createdbyshown ?
' - ' :
'<br>');
1020 $morehtmlref .= img_picto(
'',
'email',
'class="paddingrightonly"');
1021 $morehtmlref .=
dol_escape_htmltag(
$object->origin_email).
' <small class="hideonsmartphone opacitymedium">- '.$form->textwithpicto($langs->trans(
"CreatedByPublicPortal"), $htmltooltip, 1,
'help',
'', 0, 3,
'tooltipcreatedbyportal').
'</small>';
1022 } elseif ($createdfromemailcollector) {
1023 $langs->load(
"mails");
1025 $htmltooltip .=
'<b>'.$langs->trans(
"EmailMsgID").
':</b> '.
$object->email_msgid;
1026 $htmltooltip .=
'<br><b>'.$langs->trans(
"EmailDate").
':</b> '.
dol_print_date(
$object->email_date,
'dayhour');
1027 $htmltooltip .=
'<br><b>'.$langs->trans(
"MailFrom").
':</b> '.
$object->origin_email;
1028 $htmltooltip .=
'<br><b>'.$langs->trans(
"MailReply").
':</b> '.
$object->origin_replyto;
1029 $htmltooltip .=
'<br><b>'.$langs->trans(
"MailReferences").
':</b> '.
$object->origin_references;
1030 $morehtmlref .= ($createdbyshown ?
' - ' :
'<br>');
1032 $morehtmlref .= img_picto(
'From',
'email',
'class="paddingrightonly"');
1034 if (
$object->origin_replyto) {
1035 $morehtmlref .=
' - '.img_picto(
'ReplyTo',
'email',
'class="paddingrightonly"');
1038 $morehtmlref .=
' <small class="hideonsmartphone opacitymedium">- '.$form->textwithpicto($langs->trans(
"CreatedByEmailCollector"), $htmltooltip, 1,
'help',
'', 0, 3,
'tooltipcreatedbyemailcollector').
'</small>';
1041 $permissiontoedit =
$object->status < 8 && !$user->socid && $permissiontoadd;
1046 $morehtmlref .=
'<br>';
1047 if ($action !=
'editcustomer' && $permissiontoedit) {
1048 $morehtmlref .= img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth"');
1049 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editcustomer&token='.
newToken().
'&track_id='.
$object->track_id.
'">'.img_edit($langs->transnoentitiesnoconv(
'SetThirdParty'), 0).
'</a> ';
1051 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.
$object->track_id, (
string)
$object->socid, $action ==
'editcustomer' ?
'editcustomer' :
'none',
'', 1, 0, 0, array(), 1);
1053 $morehtmlref .=
' - <a href="'.DOL_URL_ROOT.
'/ticket/list.php?socid='.
$object->socid.
'&sortfield=t.datec&sortorder=desc'.(
getDolGlobalBool(
'TICKET_CLIENT_OTHER_TICKET_ONLY_OPEN') ?
'&search_fk_statut[]=openall' :
'').
'">'.img_picto($langs->trans(
"Tickets"),
'ticket',
'class="pictofixedwidth paddingright"').$langs->trans(
"TicketHistory").
'</a>';
1059 $langs->load(
"projects");
1060 $morehtmlref .=
'<br>';
1061 if ($permissiontoedit) {
1063 $morehtmlref .= img_picto($langs->trans(
"Project"),
'project'.((is_object(
$object->project) &&
$object->project->public) ?
'pub' :
''),
'class="pictofixedwidth"');
1064 if ($action !=
'classify') {
1065 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1067 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1069 if (!empty(
$object->fk_project)) {
1071 $morehtmlref .=
$object->project->getNomUrl(1);
1072 if (
$object->project->title) {
1073 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag(
$object->project->title).
'</span>';
1086 $langs->load(
'contracts');
1087 $morehtmlref .=
'<br>';
1088 if ($permissiontoedit) {
1089 $morehtmlref .= img_picto($langs->trans(
"Contract"),
'contract',
'class="pictofixedwidth"');
1090 if ($action ==
'edit_contrat') {
1092 $morehtmlref .= $formcontract->formSelectContract($_SERVER[
"PHP_SELF"].
'?id='.
$object->id,
$object->socid,
$object->fk_contract,
'contratid', 0, 1, 1, 1);
1094 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_contrat&token='.
newToken().
'&id='.
$object->id.
'">';
1095 $morehtmlref .= img_edit($langs->trans(
'SetContract'));
1096 $morehtmlref .=
'</a>';
1099 if (!empty(
$object->fk_contract)) {
1100 $contratstatic =
new Contrat($db);
1101 $contratstatic->fetch(
$object->fk_contract);
1103 $morehtmlref .= $contratstatic->getNomUrl(0, 0, 1);
1110 $morehtmlref .=
'</div>';
1112 $linkback =
'<a href="'.DOL_URL_ROOT.
'/ticket/list.php?restore_lastsearch_values=1"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
1114 dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref);
1116 print
'<div class="fichecenter">';
1117 print
'<div class="fichehalfleft">';
1118 print
'<div class="underbanner clearboth"></div>';
1120 print
'<table class="border tableforfield centpercent">';
1132 print
'<tr><td>'.$langs->trans(
"DateCreation").
'</td><td>';
1138 print
'<tr><td>'.$langs->trans(
"TicketReadOn").
'</td><td>';
1139 if (!empty(
$object->date_read)) {
1141 print
'<span class="opacitymedium"><span class="small"> - '.$langs->trans(
"TimeElapsedSince").
': ';
1149 print
'<tr><td>'.$langs->trans(
"TicketCloseOn").
'</td><td>';
1150 if (!empty(
$object->date_close)) {
1157 print
'<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
1158 print $langs->trans(
"AssignedTo");
1159 if (isset(
$object->status) &&
$object->status < $object::STATUS_CLOSED &&
GETPOST(
'set',
'alpha') !=
"assign_ticket" && $permissiontomanage) {
1160 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>';
1162 print
'</td></tr></table>';
1164 if (
GETPOST(
'set',
'alpha') !=
"assign_ticket" &&
$object->fk_user_assign > 0) {
1165 $userstat->fetch(
$object->fk_user_assign);
1166 print $userstat->getNomUrl(-1);
1170 if (
GETPOST(
'set',
'alpha') ==
"assign_ticket" &&
$object->status < 8 && !$user->socid && $permissiontomanage) {
1171 print
'<form method="post" name="ticket" enctype="multipart/form-data" action="'.$url_page_current.
'">';
1172 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1173 print
'<input type="hidden" name="action" value="assign_user">';
1174 print
'<input type="hidden" name="track_id" value="'.$object->track_id.
'">';
1175 print $form->select_dolusers(empty(
$object->fk_user_assign) ? $user->id :
$object->fk_user_assign,
'fk_user_assign', 1, null, 0,
'',
'',
'', 0, 0,
'', 0,
'',
'', 1);
1176 print
' <input type="submit" class="button smallpaddingimp" name="btn_assign_user" value="'.$langs->trans(
"Validate").
'" />';
1177 print
' <input type="submit" class="button smallpaddingimp" name="btn_cancel" value="'.$langs->trans(
"Cancel").
'" />';
1184 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
1185 print $langs->trans(
'Progression').
'</td><td class="left">';
1187 if ($permissiontoadd && $action !=
'progression' && isset(
$object->status) &&
$object->status < $object::STATUS_CLOSED && !$user->socid) {
1188 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>';
1190 print
'</tr></table>';
1192 if ($permissiontoadd && $action ==
'progression') {
1193 print
'<form action="'.$url_page_current.
'" method="post">';
1194 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1195 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1196 print
'<input type="hidden" name="action" value="set_progression">';
1197 print
'<input type="text" class="flat width75" name="progress" value="'.$object->progress.
'">';
1198 print
' <input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
1209 $num = count(
$object->linkedObjects);
1213 foreach (
$object->linkedObjects as $objecttype => $objects) {
1214 if ($objecttype ==
"fichinter") {
1215 '@phan-var-force Fichinter[] $objects';
1216 foreach ($objects as $fichinter) {
1219 $timing += $fichinter->duration;
1225 print $form->textwithpicto($langs->trans(
"TicketDurationAuto"), $langs->trans(
"TicketDurationAutoInfos"), 1);
1232 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1238 print
'</div><div class="fichehalfright">';
1241 print
'<form method="post" name="formticketproperties" action="'.$url_page_current.
'">';
1242 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1243 print
'<input type="hidden" name="action" value="change_property">';
1244 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1245 print
'<input type="hidden" name="trackid" value="'.$trackid.
'">';
1248 print
'<div class="div-table-responsive-no-min">';
1249 print
'<table class="border tableforfield centpercent margintable bordertopimp">';
1250 print
'<tr class="liste_titre">';
1251 print
'<td class="valignmiddle titlefield">';
1252 print
'<table class="nobordernopadding centpercent"><tr><td class="none" style="border-bottom: none !important;">';
1253 print $langs->trans(
'TicketProperties');
1254 if (
GETPOST(
'set',
'alpha') !=
'properties' && isset(
$object->status) && (
$object->status < $object::STATUS_NEED_MORE_INFO || !
getDolGlobalInt(
'TICKET_DISALLOW_CLASSIFICATION_MODIFICATION_EVEN_IF_CLOSED')) && $permissiontoadd) {
1255 print
'</td><td class="right" style="border-bottom: none !important;"><a class="editfielda" href="card.php?track_id='.$object->track_id.
'&set=properties">'.img_edit($langs->trans(
'Modify')).
'</a>';
1257 print
'</td></tr></table>';
1260 if (
GETPOST(
'set',
'alpha') ==
'properties' && $permissiontoadd) {
1261 print
'<input type="submit" class="button smallpaddingimp" name="btn_update_ticket_prop" value="'.$langs->trans(
"Modify").
'" />';
1266 if (
GETPOST(
'set',
'alpha') ==
'properties' && $permissiontoadd) {
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);
1320 print
'<!-- tag/categories -->'.
"\n";
1321 print
'<table class="border centpercent tableforfield">';
1323 print
'<td class="valignmiddle titlefield">';
1324 print
'<table class="nobordernopadding centpercent"><tr><td class="none">';
1325 print $langs->trans(
"Categories");
1326 if ($permissiontoadd && !in_array(
$object->status, [Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED]) && $action !=
'categories' && !$user->socid) {
1327 print
'</td><td class="right"><a class="editfielda" href="'.$url_page_current.
'?action=categories&token='.
newToken().
'&track_id='.urlencode(
$object->track_id).
'">'.img_edit($langs->trans(
'Modify')).
'</a>';
1333 if ($permissiontoadd && $action ==
'categories') {
1334 print
'<td colspan="3">';
1335 print
'<form action="'.$url_page_current.
'" method="POST">';
1336 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1337 print
'<input type="hidden" name="track_id" value="'.$track_id.
'">';
1338 print
'<input type="hidden" name="action" value="set_categories">';
1339 print $form->selectCategories(Categorie::TYPE_TICKET,
'categories', $object);
1340 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Save').
'">';
1344 print
'<td colspan="3">';
1345 print $form->showCategories(
$object->id, Categorie::TYPE_TICKET, 1);
1353 $actionobject->viewTicketOriginalMessage($user, $action, $object);
1357 print
'<!-- navbar with status -->';
1358 if (!$user->socid && $permissiontomanage && isset(
$object->status) &&
$object->status < $object::STATUS_CLOSED) {
1359 $actionobject->viewStatusActions($object);
1364 print
load_fiche_titre($langs->trans(
'Contacts'),
'',
'title_companies.png');
1366 print
'<div class="div-table-responsive-no-min">';
1367 print
'<div class="tagtable centpercent noborder allwidth">';
1369 print
'<div class="tagtr liste_titre">';
1370 print
'<div class="tagtd">'.$langs->trans(
"Source").
'</div>
1371 <div class="tagtd">' . $langs->trans(
"Company").
'</div>
1372 <div class="tagtd">' . $langs->trans(
"Contacts").
'</div>
1373 <div class="tagtd">' . $langs->trans(
"ContactType").
'</div>
1374 <div class="tagtd">' . $langs->trans(
"Phone").
'</div>
1375 <div class="tagtd center">' . $langs->trans(
"Status").
'</div>';
1376 print
'</div><!-- tagtr -->';
1379 $companystatic =
new Societe($db);
1380 $contactstatic =
new Contact($db);
1381 $userstatic =
new User($db);
1383 foreach (array(
'internal',
'external') as $source) {
1385 $tab = $tmpobject->listeContact(-1, $source);
1387 $num = is_array($tab) ? count($tab) : 0;
1389 foreach (array_keys($tab) as $i) {
1392 print
'<div class="tagtr '.($var ?
'pair' :
'impair').
'">';
1394 print
'<div class="tagtd left">';
1395 if ($tab_i[
'source'] ==
'internal') {
1396 echo $langs->trans(
"User");
1399 if ($tab_i[
'source'] ==
'external') {
1400 echo $langs->trans(
"ThirdPartyContact");
1404 print
'<div class="tagtd left">';
1406 if ($tab_i[
'socid'] > 0) {
1407 $companystatic->fetch($tab_i[
'socid']);
1408 echo $companystatic->getNomUrl(-1);
1410 if ($tab_i[
'socid'] < 0) {
1413 if (!$tab_i[
'socid']) {
1418 print
'<div class="tagtd">';
1419 if ($tab_i[
'source'] ==
'internal') {
1420 if ($userstatic->fetch($tab_i[
'id'])) {
1421 print $userstatic->getNomUrl(-1);
1424 if ($tab_i[
'source'] ==
'external') {
1425 if ($contactstatic->fetch($tab_i[
'id'])) {
1426 print $contactstatic->getNomUrl(-1);
1430 <div class="tagtd">' . $tab_i[
'libelle'].
'</div>';
1432 print
'<div class="tagtd">';
1436 if (array_key_exists(
'phone_perso', $tab_i) && !empty($tab_i[
'phone_perso'])) {
1438 print
'<br>'.dol_print_phone((
string) $tab_i[
'phone_perso'],
'', 0, 0,
'AC_TEL').
'<br>';
1440 if (!empty($tab_i[
'phone_mobile'])) {
1442 print
dol_print_phone($tab_i[
'phone_mobile'],
'', 0, 0,
'AC_TEL').
'<br>';
1446 print
'<div class="tagtd center">';
1448 echo
'<a href="contact.php?track_id='.$object->track_id.
'&action=swapstatut&token='.
newToken().
'&ligne='.$tab_i[
'rowid'].
'">';
1451 if ($tab_i[
'source'] ==
'internal') {
1452 $userstatic->id = $tab_i[
'id'];
1453 $userstatic->lastname = $tab_i[
'lastname'];
1454 $userstatic->firstname = $tab_i[
'firstname'];
1455 echo $userstatic->LibStatut($tab_i[
'statuscontact'], 3);
1457 if ($tab_i[
'source'] ==
'external') {
1458 $contactstatic->id = $tab_i[
'id'];
1459 $contactstatic->lastname = $tab_i[
'lastname'];
1460 $contactstatic->firstname = $tab_i[
'firstname'];
1461 echo $contactstatic->LibStatut($tab_i[
'statuscontact'], 3);
1469 print
'</div><!-- tagtr -->';
1475 print
'</div><!-- contact list -->';
1479 print
'</div></div>';
1480 print
'<div class="clearboth"></div>';
1486 if ($action !=
'presend' && $action !=
'presend_addmessage' && $action !=
'editline') {
1487 print
'<div class="tabsAction">'.
"\n";
1488 $parameters = array();
1489 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1491 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1494 if (empty($reshook)) {
1496 if (isset(
$object->status) &&
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage") {
1497 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email', $_SERVER[
"PHP_SELF"].
'?action=presend_addmessage&send_email=1&private_message=0&mode=init&token='.
newToken().
'&track_id='.
$object->track_id.
'#formmailbeforetitle',
'');
1501 if (isset(
$object->status) &&
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage") {
1502 print dolGetButtonAction(
'', $langs->trans(
'TicketAddPrivateMessage'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend_addmessage&mode=init&token='.
newToken().
'&track_id='.
$object->track_id.
'#formmailbeforetitle',
'');
1508 print dolGetButtonAction($langs->trans(
'UnableToCreateInterIfNoSocid'), $langs->trans(
'TicketAddIntervention'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1510 if (
$object->fk_soc > 0 && isset(
$object->status) &&
$object->status < Ticket::STATUS_CLOSED && $user->hasRight(
'ficheinter',
'creer')) {
1511 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,
'');
1515 if (isset(
$object->status) &&
$object->status >= 0 &&
$object->status < Ticket::STATUS_CLOSED && $permissiontomanage) {
1516 print dolGetButtonAction(
'', $langs->trans(
'CloseTicket'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.
newToken().
'&track_id='.
$object->track_id,
'');
1520 if (isset(
$object->status) &&
$object->status > 0 &&
$object->status < Ticket::STATUS_CLOSED && $permissiontomanage) {
1521 print dolGetButtonAction(
'', $langs->trans(
'AbandonTicket'),
'default', $_SERVER[
"PHP_SELF"].
'?action=abandon&token='.
newToken().
'&track_id='.
$object->track_id,
'');
1525 if ($permissiontomanage && !$user->socid && (isset(
$object->status) && (
$object->status == Ticket::STATUS_CLOSED ||
$object->status == Ticket::STATUS_CANCELED)) && !$user->socid) {
1526 print dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&track_id='.
$object->track_id,
'');
1530 if ($permissiontoedit) {
1531 print dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoedit);
1535 if ($permissiontoadd) {
1536 print dolGetButtonAction($langs->trans(
'ToClone'), $langs->trans(
'ToClone'),
'clone', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=clone&token='.
newToken(),
'', $permissiontoadd, array(
'attr' => array(
'class' =>
'reposition')));
1540 if ($permissiontodelete && !$user->socid) {
1541 print dolGetButtonAction($langs->trans(
'Delete'), $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&track_id='.
$object->track_id,
'',
true, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
1544 print
'</div>'.
"\n";
1548 if (
GETPOST(
'modelselected')) {
1549 $action =
'presend';
1552 if (
GETPOSTISSET(
'actionbis') && $action ==
'presend') {
1553 $action =
'presend_addmessage';
1557 if ($action ==
'presend' || $action ==
'presend_addmessage') {
1562 $outputlangs = $langs;
1565 $newlang =
GETPOST(
'lang_id',
'aZ09');
1567 $newlang =
$object->thirdparty->default_lang;
1569 if (!empty($newlang)) {
1571 $outputlangs->setDefaultLang($newlang);
1574 $arrayoffamiliestoexclude = array(
'objectamount');
1576 $action =
'add_message';
1577 $modelmail =
'ticket_send';
1580 $morehtmlright =
'';
1582 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
1588 print
'<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
1590 print
load_fiche_titre($langs->trans(
'TicketAddMessage'), $morehtmlright,
'fa-comment-dots');
1596 $formticket->action = $action;
1597 $formticket->track_id =
$object->track_id;
1598 $formticket->ref =
$object->ref;
1599 $formticket->id =
$object->id;
1600 $formticket->trackid =
'tic'.$object->id;
1602 $formticket->withfile = 2;
1603 $formticket->withcancel = 1;
1604 $formticket->param = array(
'fk_user_create' => $user->id);
1605 $formticket->param[
'langsmodels'] = (empty($newlang) ? $langs->defaultlang : $newlang);
1608 $formticket->param[
'models'] = $modelmail;
1609 $formticket->param[
'models_id'] =
GETPOSTINT(
'modelmailselected');
1611 $formticket->param[
'returnurl'] = $_SERVER[
"PHP_SELF"].
'?track_id='.urldecode(
$object->track_id);
1613 $formticket->withsubstit = 1;
1614 $formticket->substit = $substitutionarray;
1615 $formticket->backtopage = $backtopage;
1617 $formticket->withtitletopic = 1;
1619 $formticket->showMessageForm(
'100%', 0);
1626 $param =
'&id='.$object->id;
1627 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1628 $param .=
'&contextpage='.$contextpage;
1630 if ($limit > 0 && $limit !=
$conf->liste_limit) {
1631 $param .=
'&limit='.$limit;
1634 $param .=
'&actioncode='.urlencode($actioncode);
1636 if ($search_agenda_label) {
1637 $param .=
'&search_agenda_label='.urlencode($search_agenda_label);
1640 $morehtmlright =
'';
1642 $messagingUrl = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.
$object->track_id;
1643 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'MessageListViewType'),
'',
'fa fa-bars imgforviewmode', $messagingUrl,
'', 1);
1646 $btnstatus =
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage" && $action !=
"add_message";
1647 $url =
'card.php?track_id='.$object->track_id.
'&action=presend_addmessage&mode=init';
1648 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'TicketAddMessage'),
'',
'fa fa-comment-dots', $url,
'add-new-ticket-title-button', (
int) $btnstatus);
1651 $btnstatus =
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage" && $action !=
"add_message";
1652 $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);
1653 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', $url,
'add-new-ticket-even-button', (
int) $btnstatus);
1655 print_barre_liste($langs->trans(
"ActionsOnTicket"), 0, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 1);
1659 $filters[
'search_agenda_label'] = $search_agenda_label;
1660 $filters[
'search_rowid'] = $search_rowid;
1662 show_actions_messaging(
$conf, $langs, $db, $object,
null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
1665 if ($action !=
'presend' && $action !=
'presend_addmessage' && $action !=
'add_message') {
1666 print
'<div class="fichecenter"><div class="fichehalfleft">';
1667 print
'<a name="builddoc"></a>';
1673 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1674 $genallowed = $permissiontoadd;
1675 $delallowed = $permissiontodelete;
1679 $codelang =
$object->thirdparty->default_lang;
1682 print $formfile->showdocuments(
'ticket', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $codelang);
1685 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'ticket'), 1);
1686 $linktoelem = $tmparray[
'linktoelem'];
1687 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
1688 print $htmltoenteralink;
1690 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1693 print
'<br><!-- Link to public interface -->'.
"\n";
1698 print
'<div class="fichehalfright">';
1702 $morehtmlcenter =
'<div class="nowraponall">';
1703 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/ticket/messaging.php?id='.
$object->id);
1704 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/ticket/agenda.php?id='.
$object->id);
1705 $morehtmlcenter .=
'</div>';
1708 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1710 $somethingshown = $formactions->showactions($object,
'ticket', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class Actions of the module ticket.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
societe_prepare_head(Societe $object, $subtabs='')
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_now($mode='gmt')
Return date for now.
dol_print_ip($ip, $mode=0, $showname=0)
Return an IP formatted to be shown on screen.
dol_print_phone($phone, $countrycode='', $contactid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='paddingright')
Format phone numbers according to country.
roundUpToNextMultiple($n, $x=5)
Round to next multiple.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalBool($key, $default=false)
Return a Dolibarr global constant boolean value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
show_actions_messaging($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
Show html area with actions in messaging format.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Class to generate the form for creating a new ticket.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
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.