24 require
'../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/actions_ticket.class.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formticket.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
"/core/lib/company.lib.php";
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
34 $langs->loadLangs(array(
'companies',
'other',
'ticket'));
39 $track_id =
GETPOST(
'track_id',
'alpha', 3);
40 $socid =
GETPOST(
'socid',
'int');
41 $action =
GETPOST(
'action',
'aZ09');
43 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
44 $sortfield =
GETPOST(
"sortfield",
"aZ09comma");
45 $sortorder =
GETPOST(
"sortorder",
'aZ09comma');
47 $page = is_numeric($page) ? $page : 0;
48 $page = $page == -1 ? 0 : $page;
49 if (!$sortfield) $sortfield =
"a.datep,a.id";
50 if (!$sortorder) $sortorder =
"desc";
51 $offset = $limit * $page;
52 $pageprev = $page - 1;
53 $pagenext = $page + 1;
55 if (
GETPOST(
'actioncode',
'array'))
57 $actioncode =
GETPOST(
'actioncode',
'array', 3);
58 if (!count($actioncode)) $actioncode =
'0';
60 $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));
62 $search_agenda_label =
GETPOST(
'search_agenda_label');
65 $object->fetch($id, $ref, $track_id);
68 $extrafields->fetch_name_optionals_label($object->table_element);
81 if (!$user->rights->ticket->read) {
85 if ($user->socid > 0 && ($object->fk_soc != $user->socid))
90 if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
100 $parameters = array(
'id'=>$socid);
101 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
102 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
107 $_SESSION[
'ticket-view-type'] =
"messaging";
111 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
114 $search_agenda_label =
'';
123 $form =
new Form($db);
124 $userstat =
new User($db);
127 $title = $langs->trans(
"Ticket").
' - '.$object->ref.
' '.$object->name;
128 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.
' '.$object->name.
' - '.$langs->trans(
"Info");
129 $help_url =
'FR:DocumentationModuleTicket';
133 $object->fetch_thirdparty();
138 dol_banner_tab($object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
143 if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
144 $object->next_prev_filter =
"te.fk_user_assign = '".$user->id.
"'";
145 } elseif ($user->socid > 0) {
146 $object->next_prev_filter =
"te.fk_soc = '".$user->socid.
"'";
152 $morehtmlref =
'<div class="refidno">';
153 $morehtmlref .= $object->subject;
155 if ($object->fk_user_create > 0) {
156 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
158 $langs->load(
"users");
159 $fuser =
new User($db);
160 $fuser->fetch($object->fk_user_create);
161 $morehtmlref .= $fuser->getNomUrl(0);
163 if (!empty($object->origin_email)) {
164 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
165 $morehtmlref .= $object->origin_email.
' <small>('.$langs->trans(
"TicketEmailOriginIssuer").
')</small>';
169 if (!empty($conf->societe->enabled))
171 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty');
175 $morehtmlref .=
' : ';
176 if ($action ==
'editcustomer') {
177 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'editcustomer',
'', 1, 0, 0, array(), 1);
179 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'none',
'', 1, 0, 0, array(), 1);
184 if (!empty($conf->projet->enabled))
186 $langs->load(
"projects");
187 $morehtmlref .=
'<br>'.$langs->trans(
'Project');
188 if ($user->rights->ticket->write)
190 if ($action !=
'classify') {
192 $morehtmlref .=
' : ';
194 if ($action ==
'classify') {
196 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
197 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
198 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
199 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1);
200 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
201 $morehtmlref .=
'</form>';
203 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
206 if (!empty($object->fk_project)) {
208 $proj->fetch($object->fk_project);
209 $morehtmlref .= $proj->getNomUrl(1);
216 $morehtmlref .=
'</div>';
218 $linkback =
'<a href="'.dol_buildpath(
'/ticket/list.php', 1).
'"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
220 dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
227 if (!empty($object->id))
229 $param =
'&id='.$object->id;
230 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.$contextpage;
231 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.$limit;
235 $messagingUrl = DOL_URL_ROOT.
'/ticket/messaging.php?track_id='.$object->track_id;
236 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'ShowAsConversation'),
'',
'fa fa-comments imgforviewmode', $messagingUrl,
'', 1, array(
'morecss'=>
'btnTitleSelected'));
237 $messagingUrl = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.$object->track_id;
238 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'MessageListViewType'),
'',
'fa fa-list-alt imgforviewmode', $messagingUrl,
'', 1);
242 $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage";
243 $url =
'card.php?track_id='.$object->track_id.
'&action=presend_addmessage&mode=init';
244 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'TicketAddMessage'),
'',
'fa fa-comment-dots', $url,
'add-new-ticket-title-button', $btnstatus);
247 $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage";
248 $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);
249 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', $url,
'add-new-ticket-even-button', $btnstatus);
252 print_barre_liste($langs->trans(
"ActionsOnTicket"), 0,
$_SERVER[
"PHP_SELF"],
'', $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 1);
256 $filters[
'search_agenda_label'] = $search_agenda_label;
257 show_ticket_messaging($conf, $langs, $db, $object, null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
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.
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.
Class to manage Dolibarr users.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
Class to manage projects.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.