27 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
33 require_once DOL_DOCUMENT_ROOT.
"/core/lib/company.lib.php";
34 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
38 $langs->loadLangs(array(
'companies',
'ticket'));
41 $socid =
GETPOST(
"socid",
'int');
42 $action =
GETPOST(
"action",
'alpha');
43 $track_id =
GETPOST(
"track_id",
'alpha');
47 $type =
GETPOST(
'type',
'alpha');
48 $source =
GETPOST(
'source',
'alpha');
50 $ligne =
GETPOST(
'ligne',
'int');
51 $lineid =
GETPOST(
'lineid',
'int');
54 if ($user->socid > 0) {
55 $socid = $user->socid;
69 if ($action ==
'addcontact' && $user->rights->ticket->write) {
70 $result = $object->fetch($id,
'', $track_id);
72 if ($result > 0 && ($id > 0 || (!empty($track_id)))) {
75 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
79 Header(
"Location: ".$url_page_current.
"?id=".$object->id);
82 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
83 $langs->load(
"errors");
84 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"), null,
'errors');
92 if ($action ==
'swapstatut' && $user->rights->ticket->write) {
93 if ($object->fetch($id,
'', $track_id)) {
94 $result = $object->swapContactStatus($ligne);
101 if ($action ==
'deletecontact' && $user->rights->ticket->write) {
102 if ($object->fetch($id,
'', $track_id)) {
103 $result = $object->delete_contact($lineid);
106 Header(
"Location: ".$url_page_current.
"?id=".$object->id);
118 $help_url =
'FR:DocumentationModuleTicket';
119 llxHeader(
'', $langs->trans(
"TicketContacts"), $help_url);
121 $form =
new Form($db);
123 $contactstatic =
new Contact($db);
124 $userstatic =
new User($db);
126 if ($id > 0 || !empty($track_id) || !empty($ref)) {
127 if ($object->fetch($id, $ref, $track_id) > 0)
130 $object->fetch_thirdparty();
133 dol_banner_tab($object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
137 if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
138 $object->next_prev_filter =
"te.fk_user_assign = '".$user->id.
"'";
139 } elseif ($user->socid > 0) {
140 $object->next_prev_filter =
"te.fk_soc = '".$user->socid.
"'";
147 $morehtmlref =
'<div class="refidno">';
148 $morehtmlref .= $object->subject;
150 if ($object->fk_user_create > 0) {
151 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
153 $langs->load(
"users");
154 $fuser =
new User($db);
155 $fuser->fetch($object->fk_user_create);
156 $morehtmlref .= $fuser->getNomUrl(0);
158 if (!empty($object->origin_email)) {
159 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
160 $morehtmlref .= $object->origin_email.
' <small>('.$langs->trans(
"TicketEmailOriginIssuer").
')</small>';
164 if (!empty($conf->societe->enabled))
166 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty');
170 $morehtmlref .=
' : ';
171 if ($action ==
'editcustomer') {
172 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'editcustomer',
'', 1, 0, 0, array(), 1);
174 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid,
'none',
'', 1, 0, 0, array(), 1);
179 if (!empty($conf->projet->enabled))
181 $langs->load(
"projects");
182 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
183 if ($user->rights->ticket->write)
185 if ($action !=
'classify') {
187 $morehtmlref .=
' : ';
189 if ($action ==
'classify') {
191 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
192 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
193 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
194 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1);
195 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
196 $morehtmlref .=
'</form>';
198 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
201 if (!empty($object->fk_project)) {
203 $proj->fetch($object->fk_project);
204 $morehtmlref .= $proj->getNomUrl(1);
211 $morehtmlref .=
'</div>';
213 $linkback =
'<a href="'.dol_buildpath(
'/ticket/list.php', 1).
'"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
215 dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref, $param, 0,
'',
'', 1,
'');
221 $permission = $user->rights->ticket->write;
224 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
225 foreach ($dirtpls as $reldir) {
232 print "ErrorRecordNotFound";
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.
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.
Class to manage projects.
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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.