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);
69 $extrafields->fetch_name_optionals_label($object->table_element);
82 if (!$user->rights->ticket->read) {
86 if ($user->socid > 0 && ($object->fk_soc != $user->socid))
91 if (!$user->socid && ($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);
103 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
108 $_SESSION[
'ticket-view-type'] =
"list";
112 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
115 $search_agenda_label =
'';
124 $form =
new Form($db);
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) $title = $object->ref.
' '.$object->name.
' - '.$langs->trans(
"Info");
130 $help_url =
'FR:DocumentationModuleTicket';
134 $object->fetch_thirdparty();
139 dol_banner_tab($object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
144 if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
145 $object->next_prev_filter =
"te.fk_user_assign = '".$user->id.
"'";
146 } elseif ($user->socid > 0) {
147 $object->next_prev_filter =
"te.fk_soc = '".$user->socid.
"'";
153 $morehtmlref =
'<div class="refidno">';
154 $morehtmlref .= $object->subject;
156 if ($object->fk_user_create > 0) {
157 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
159 $langs->load(
"users");
160 $fuser =
new User($db);
161 $fuser->fetch($object->fk_user_create);
162 $morehtmlref .= $fuser->getNomUrl(0);
164 if (!empty($object->origin_email)) {
165 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
166 $morehtmlref .= $object->origin_email.
' <small>('.$langs->trans(
"TicketEmailOriginIssuer").
')</small>';
170 if (!empty($conf->societe->enabled))
172 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty');
176 $morehtmlref .=
' : ';
177 if ($action ==
'editcustomer') {
178 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'editcustomer',
'', 1, 0, 0, array(), 1);
180 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'none',
'', 1, 0, 0, array(), 1);
185 if (!empty($conf->projet->enabled))
187 $langs->load(
"projects");
188 $morehtmlref .=
'<br>'.$langs->trans(
'Project');
189 if ($user->rights->ticket->write)
191 if ($action !=
'classify') {
193 $morehtmlref .=
' : ';
195 if ($action ==
'classify') {
197 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
198 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
199 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
200 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1);
201 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
202 $morehtmlref .=
'</form>';
204 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
207 if (!empty($object->fk_project)) {
209 $proj->fetch($object->fk_project);
210 $morehtmlref .= $proj->getNomUrl(1);
217 $morehtmlref .=
'</div>';
219 $linkback =
'<a href="'.dol_buildpath(
'/ticket/list.php', 1).
'"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
221 dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
228 if (!empty($object->id))
230 $param =
'&id='.$object->id;
231 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.$contextpage;
232 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.$limit;
236 $messagingUrl = DOL_URL_ROOT.
'/ticket/messaging.php?track_id='.$object->track_id;
237 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'ShowAsConversation'),
'',
'fa fa-comments imgforviewmode', $messagingUrl,
'', 1);
238 $messagingUrl = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.$object->track_id;
239 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'MessageListViewType'),
'',
'fa fa-list-alt imgforviewmode', $messagingUrl,
'', 1, array(
'morecss'=>
'btnTitleSelected'));
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"]);
249 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', $url,
'add-new-ticket-even-button', $btnstatus);
251 print_barre_liste($langs->trans(
"ActionsOnTicket"), 0,
$_SERVER[
"PHP_SELF"],
'', $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 1);
255 $filters[
'search_agenda_label'] = $search_agenda_label;
256 show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
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.
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).
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.