30require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
36require_once DOL_DOCUMENT_ROOT.
"/core/lib/company.lib.php";
37require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
39if (isModEnabled(
'project')) {
40 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
42 include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
54$langs->loadLangs(array(
'companies',
'ticket'));
58$action =
GETPOST(
"action",
'alpha');
59$track_id =
GETPOST(
"track_id",
'alpha');
63$type =
GETPOST(
'type',
'alpha');
64$source =
GETPOST(
'source',
'alpha');
71$url_page_current = DOL_URL_ROOT.
'/ticket/contact.php';
73$hookmanager->initHooks(array(
'contactticketcard',
'globalcard'));
75if ($id > 0 || $ref || $track_id) {
76 $result =
$object->fetch($id, $ref, $track_id);
81if ($user->socid > 0) {
82 $socid = $user->socid;
87if ($user->socid > 0 && (
$object->fk_soc != $user->socid)) {
91if (!$user->socid && (
getDolGlobalString(
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY') &&
$object->fk_user_assign != $user->id) && !$user->hasRight(
'ticket',
'manage')) {
95$permissiontoadd = $user->hasRight(
'ticket',
'write');
102$parameters = array();
103$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
108if ($action ==
'addcontact' && $user->hasRight(
'ticket',
'write')) {
109 $result =
$object->fetch($id,
'', $track_id);
111 if ($result > 0 && ($id > 0 || (!empty($track_id)))) {
115 $codecontact =
dol_getIdFromCode($db, $typeid,
'c_type_contact',
'rowid',
'code');
116 if ($codecontact ==
'SUPPORTTEC') {
117 $internal_contacts =
$object->listeContact(-1,
'internal', 0,
'SUPPORTTEC');
118 foreach ($internal_contacts as $key => $contact) {
119 if ($contact[
'id'] !== $contactid) {
121 $result =
$object->delete_contact($contact[
'rowid']);
128 $ret =
$object->assignUser($user, $contactid);
136 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
141 header(
"Location: ".$url_page_current.
"?id=".
$object->id);
144 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
145 $langs->load(
"errors");
146 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
154if ($action ==
'swapstatut' && $user->hasRight(
'ticket',
'write')) {
155 if (
$object->fetch($id,
'', $track_id)) {
156 $result =
$object->swapContactStatus($ligne);
163if ($action ==
'deletecontact' && $user->hasRight(
'ticket',
'write')) {
164 if (
$object->fetch($id,
'', $track_id)) {
165 $internal_contacts =
$object->listeContact(-1,
'internal', 0,
'SUPPORTTEC');
166 foreach ($internal_contacts as $key => $contact) {
167 if ($contact[
'rowid'] == $lineid &&
$object->fk_user_assign == $contact[
'id']) {
168 $ret =
$object->assignUser($user, 0);
175 $result =
$object->delete_contact($lineid);
178 header(
"Location: ".$url_page_current.
"?id=".
$object->id);
185if ($action ==
'set_thirdparty' && $user->hasRight(
'ticket',
'write')) {
188 $url = $_SERVER[
"PHP_SELF"].
'?track_id='.
GETPOST(
'track_id',
'alpha');
189 header(
"Location: ".$url);
199$help_url =
'FR:DocumentationModuleTicket';
200llxHeader(
'', $langs->trans(
"TicketContacts"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-ticket page-card_contacts');
202$form =
new Form($db);
204$contactstatic =
new Contact($db);
205$userstatic =
new User($db);
207if ($id > 0 || !empty($track_id) || !empty($ref)) {
208 if (
$object->fetch($id, $ref, $track_id) > 0) {
213 dol_banner_tab(
$object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
218 $object->next_prev_filter =
"te.fk_user_assign:=:'".((int) $user->id);
219 } elseif ($user->socid > 0) {
220 $object->next_prev_filter =
"te.fk_soc:=:".((int) $user->socid);
227 $morehtmlref =
'<div class="refidno">';
228 $morehtmlref .=
$object->subject;
230 if (
$object->fk_user_create > 0) {
231 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
233 $fuser =
new User($db);
234 $fuser->fetch(
$object->fk_user_create);
235 $morehtmlref .= $fuser->getNomUrl(-1);
236 } elseif (!empty(
$object->email_msgid)) {
237 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
238 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
239 $morehtmlref .=
dol_escape_htmltag(
$object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.$form->textwithpicto($langs->trans(
"CreatedByEmailCollector"), $langs->trans(
"EmailMsgID").
': '.
$object->email_msgid).
')</small>';
240 } elseif (!empty(
$object->origin_email)) {
241 $morehtmlref .=
'<br>'.$langs->trans(
"CreatedBy").
' : ';
242 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
243 $morehtmlref .=
dol_escape_htmltag(
$object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.$langs->trans(
"CreatedByPublicPortal").
')</small>';
247 if (isModEnabled(
"societe")) {
248 $morehtmlref .=
'<br>';
249 $morehtmlref .=
img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth"');
250 if ($action !=
'editcustomer' && $permissiontoadd) {
251 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editcustomer&token='.
newToken().
'&track_id='.
$object->track_id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetThirdParty'), 0).
'</a> ';
253 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.
$object->track_id,
$object->socid, $action ==
'editcustomer' ?
'editcustomer' :
'none',
'', 1, 0, 0, array(), 1);
257 if (isModEnabled(
'project')) {
258 $langs->load(
"projects");
260 $morehtmlref .=
'<br>';
261 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
262 if ($action !=
'classify') {
263 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
265 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
267 if (!empty(
$object->fk_project)) {
268 $morehtmlref .=
'<br>';
270 $proj->fetch(
$object->fk_project);
271 $morehtmlref .= $proj->getNomUrl(1);
273 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
279 $morehtmlref .=
'</div>';
281 $linkback =
'<a href="'.dol_buildpath(
'/ticket/list.php', 1).
'"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
283 dol_banner_tab($object,
'ref', $linkback, (empty($user->socid) ? 1 : 0),
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1,
'');
289 $permission = $user->hasRight(
'ticket',
'write');
292 $dirtpls = array_merge(
$conf->modules_parts[
'tpl'], array(
'/core/tpl'));
293 foreach ($dirtpls as $reldir) {
300 print
"ErrorRecordNotFound";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_get_fiche_end($notab=0)
Return tab footer of a card.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.