Go to the documentation of this file.
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;
50 $sortfield =
"a.datep,a.id";
55 $offset = $limit * $page;
56 $pageprev = $page - 1;
57 $pagenext = $page + 1;
59 if (
GETPOST(
'actioncode',
'array')) {
60 $actioncode =
GETPOST(
'actioncode',
'array', 3);
61 if (!count($actioncode)) {
65 $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));
67 $search_agenda_label =
GETPOST(
'search_agenda_label');
70 $object->fetch($id, $ref, $track_id);
74 $extrafields->fetch_name_optionals_label($object->table_element);
83 if ($user->socid > 0) $socid = $user->socid;
87 if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
91 if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
101 $parameters = array(
'id'=>$socid);
102 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
107 if (empty($reshook)) {
109 $_SESSION[
'ticket-view-type'] =
"list";
113 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
115 $search_agenda_label =
'';
125 $userstat =
new User($db);
128 $title = $langs->trans(
"Ticket").
' - '.$object->ref.
' '.$object->name;
129 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
130 $title = $object->ref.
' '.$object->name.
' - '.$langs->trans(
"Info");
132 $help_url =
'EN:Module_Agenda_En|FR:Module_Agenda';
137 $object->fetch_thirdparty();
142 dol_banner_tab($object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
147 if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
148 $object->next_prev_filter =
"te.fk_user_assign = '".$user->id.
"'";
149 } elseif ($user->socid > 0) {
150 $object->next_prev_filter =
"te.fk_soc = '".$user->socid.
"'";
154 print
dol_get_fiche_head($head,
'tabTicketLogs', $langs->trans(
"Ticket"), 0,
'ticket');
156 $morehtmlref =
'<div class="refidno">';
157 $morehtmlref .= $object->subject;
159 if ($object->fk_user_create > 0) {
160 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
162 $langs->load(
"users");
163 $fuser =
new User($db);
164 $fuser->fetch($object->fk_user_create);
165 $morehtmlref .= $fuser->getNomUrl(-1);
166 } elseif (!empty($object->email_msgid)) {
167 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
168 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
169 $morehtmlref .=
dol_escape_htmltag($object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.
$form->textwithpicto($langs->trans(
"CreatedByEmailCollector"), $langs->trans(
"EmailMsgID").
': '.$object->email_msgid).
')</small>';
170 } elseif (!empty($object->origin_email)) {
171 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
172 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
173 $morehtmlref .=
dol_escape_htmltag($object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.$langs->trans(
"CreatedByPublicPortal").
')</small>';
178 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty');
182 $morehtmlref .=
' : ';
183 if ($action ==
'editcustomer') {
184 $morehtmlref .=
$form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'editcustomer',
'', 1, 0, 0, array(), 1);
186 $morehtmlref .=
$form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'none',
'', 1, 0, 0, array(), 1);
192 $langs->load(
"projects");
193 $morehtmlref .=
'<br>'.$langs->trans(
'Project');
194 if ($user->rights->ticket->write) {
195 if ($action !=
'classify') {
197 $morehtmlref .=
' : ';
199 if ($action ==
'classify') {
201 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
202 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
203 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
204 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1);
205 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
206 $morehtmlref .=
'</form>';
208 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
211 if (!empty($object->fk_project)) {
213 $proj->fetch($object->fk_project);
214 $morehtmlref .= $proj->getNomUrl(1);
221 $morehtmlref .=
'</div>';
223 $linkback =
'<a href="'.DOL_URL_ROOT.
'/ticket/list.php"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
225 dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
232 if (!empty($object->id)) {
233 $param =
'&id='.$object->id;
234 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
235 $param .=
'&contextpage='.$contextpage;
237 if ($limit > 0 && $limit != $conf->liste_limit) {
238 $param .=
'&limit='.$limit;
243 $messagingUrl = DOL_URL_ROOT.
'/ticket/messaging.php?track_id='.$object->track_id;
244 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'ShowAsConversation'),
'',
'fa fa-comments imgforviewmode', $messagingUrl,
'', 1);
245 $messagingUrl = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.$object->track_id;
246 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'MessageListViewType'),
'',
'fa fa-bars imgforviewmode', $messagingUrl,
'', 1, array(
'morecss'=>
'btnTitleSelected'));
249 $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage";
250 $url =
'card.php?track_id='.$object->track_id.
'&action=presend_addmessage&mode=init';
251 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'TicketAddMessage'),
'',
'fa fa-comment-dots', $url,
'add-new-ticket-title-button', $btnstatus);
254 $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage";
255 $url = DOL_URL_ROOT.
'/comm/action/card.php?action=create&datep='.date(
'YmdHi').
'&origin=ticket&originid='.$object->id.
'&projectid='.$object->fk_project.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$object->id);
256 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', $url,
'add-new-ticket-even-button', $btnstatus);
258 print_barre_liste($langs->trans(
"ActionsOnTicket"), 0, $_SERVER[
"PHP_SELF"],
'', $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 1);
262 $filters[
'search_agenda_label'] = $search_agenda_label;
263 show_actions_done($conf, $langs, $db, $object,
null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
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.
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.
Class to manage projects.
ticket_prepare_head($object)
Build tabs for a Ticket object.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC', $module='')
Show html area with actions (done or not, ignore the name of function).
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
isModEnabled($module)
Is Dolibarr module enabled.
Class to manage Dolibarr users.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Class to generate the form for creating a new ticket.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session 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 ...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.