28require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
34require_once DOL_DOCUMENT_ROOT.
"/core/lib/company.lib.php";
35require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37if (isModEnabled(
'project')) {
38 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
39 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
40 include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
44$langs->loadLangs(array(
'companies',
'ticket'));
47$socid =
GETPOST(
"socid",
'int');
48$action =
GETPOST(
"action",
'alpha');
49$track_id =
GETPOST(
"track_id",
'alpha');
53$type =
GETPOST(
'type',
'alpha');
54$source =
GETPOST(
'source',
'alpha');
56$ligne =
GETPOST(
'ligne',
'int');
57$lineid =
GETPOST(
'lineid',
'int');
61$url_page_current = DOL_URL_ROOT.
'/ticket/contact.php';
67if ($user->socid > 0) {
68 $socid = $user->socid;
73if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
77if (!$user->socid && (
getDolGlobalString(
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $object->fk_user_assign != $user->id) && !$user->hasRight(
'ticket',
'manage')) {
81$permissiontoadd = $user->rights->ticket->write;
88if ($action ==
'addcontact' && $user->hasRight(
'ticket',
'write')) {
89 $result = $object->fetch($id,
'', $track_id);
91 if ($result > 0 && ($id > 0 || (!empty($track_id)))) {
97 $codecontact =
dol_getIdFromCode($db, $typeid,
'c_type_contact',
'rowid',
'code');
98 if ($codecontact==
'SUPPORTTEC') {
99 $internal_contacts = $object->listeContact(-1,
'internal', 0,
'SUPPORTTEC');
100 foreach ($internal_contacts as $key => $contact) {
101 if ($contact[
'id'] !== $contactid) {
103 $result = $object->delete_contact($contact[
'rowid']);
110 $ret = $object->assignUser($user, $contactid);
118 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
123 header(
"Location: ".$url_page_current.
"?id=".$object->id);
126 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
127 $langs->load(
"errors");
128 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
136if ($action ==
'swapstatut' && $user->hasRight(
'ticket',
'write')) {
137 if ($object->fetch($id,
'', $track_id)) {
138 $result = $object->swapContactStatus($ligne);
145if ($action ==
'deletecontact' && $user->hasRight(
'ticket',
'write')) {
146 if ($object->fetch($id,
'', $track_id)) {
147 $internal_contacts = $object->listeContact(-1,
'internal', 0,
'SUPPORTTEC');
148 foreach ($internal_contacts as $key => $contact) {
149 if ($contact[
'rowid'] == $lineid && $object->fk_user_assign==$contact[
'id']) {
150 $ret = $object->assignUser($user,
null);
157 $result = $object->delete_contact($lineid);
160 Header(
"Location: ".$url_page_current.
"?id=".$object->id);
167if ($action ==
'set_thirdparty' && $user->hasRight(
'ticket',
'write')) {
168 if ($object->fetch(
GETPOST(
'id',
'int'),
'',
GETPOST(
'track_id',
'alpha')) >= 0) {
169 $result = $object->setCustomer(
GETPOST(
'editcustomer',
'int'));
170 $url = $_SERVER[
"PHP_SELF"].
'?track_id='.
GETPOST(
'track_id',
'alpha');
171 header(
"Location: ".$url);
181$help_url =
'FR:DocumentationModuleTicket';
182llxHeader(
'', $langs->trans(
"TicketContacts"), $help_url);
184$form =
new Form($db);
186$contactstatic =
new Contact($db);
187$userstatic =
new User($db);
189if ($id > 0 || !empty($track_id) || !empty($ref)) {
190 if ($object->fetch($id, $ref, $track_id) > 0) {
192 $object->fetch_thirdparty();
195 dol_banner_tab($object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
200 $object->next_prev_filter =
"te.fk_user_assign ='".((int) $user->id);
201 } elseif ($user->socid > 0) {
202 $object->next_prev_filter =
"te.fk_soc = ".((int) $user->socid);
209 $morehtmlref =
'<div class="refidno">';
210 $morehtmlref .= $object->subject;
212 if ($object->fk_user_create > 0) {
213 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
215 $fuser =
new User($db);
216 $fuser->fetch($object->fk_user_create);
217 $morehtmlref .= $fuser->getNomUrl(-1);
218 } elseif (!empty($object->email_msgid)) {
219 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
220 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
221 $morehtmlref .=
dol_escape_htmltag($object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.$form->textwithpicto($langs->trans(
"CreatedByEmailCollector"), $langs->trans(
"EmailMsgID").
': '.$object->email_msgid).
')</small>';
222 } elseif (!empty($object->origin_email)) {
223 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
224 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
225 $morehtmlref .=
dol_escape_htmltag($object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.$langs->trans(
"CreatedByPublicPortal").
')</small>';
229 if (isModEnabled(
"societe")) {
230 $morehtmlref .=
'<br>';
231 $morehtmlref .=
img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth"');
232 if ($action !=
'editcustomer' && $permissiontoadd) {
233 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editcustomer&token='.newToken().
'&track_id='.$object->track_id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetThirdParty'), 0).
'</a> ';
235 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.$object->track_id, $object->socid, $action ==
'editcustomer' ?
'editcustomer' :
'none',
'', 1, 0, 0, array(), 1);
239 if (isModEnabled(
'project')) {
240 $langs->load(
"projects");
242 $morehtmlref .=
'<br>';
243 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
244 if ($action !=
'classify') {
245 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
247 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
249 if (!empty($object->fk_project)) {
250 $morehtmlref .=
'<br>';
252 $proj->fetch($object->fk_project);
253 $morehtmlref .= $proj->getNomUrl(1);
255 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
261 $morehtmlref .=
'</div>';
263 $linkback =
'<a href="'.dol_buildpath(
'/ticket/list.php', 1).
'"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
265 dol_banner_tab($object,
'ref', $linkback, (empty($user->socid) ? 1 : 0),
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1,
'');
271 $permission = $user->rights->ticket->write;
274 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
275 foreach ($dirtpls as $reldir) {
282 print
"ErrorRecordNotFound";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage projects.
Class to manage Dolibarr users.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
Class to generate the form for creating a new ticket.
restrictedArea(User $user, $features, $object=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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
ticket_prepare_head($object)
Build tabs for a Ticket object.