35 global $langs, $conf, $db;
38 $extrafields->fetch_name_optionals_label(
'ticket');
40 $langs->load(
"ticket");
45 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/ticket.php');
46 $head[$h][1] = $langs->trans(
"TicketSettings");
47 $head[$h][2] =
'settings';
50 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/ticket_extrafields.php');
51 $head[$h][1] = $langs->trans(
"ExtraFieldsTicket");
52 $nbExtrafields = $extrafields->attributes[
'ticket'][
'count'];
53 if ($nbExtrafields > 0) {
54 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
56 $head[$h][2] =
'attributes';
59 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/ticket_public.php');
60 $head[$h][1] = $langs->trans(
"PublicInterface");
61 $head[$h][2] =
'public';
87 global $langs, $conf, $user, $db;
91 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/ticket/card.php', [
'track_id' =>
$object->track_id]);
92 $head[$h][1] = $langs->trans(
"Ticket");
93 $head[$h][2] =
'tabTicket';
97 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
98 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/ticket/contact.php', [
'track_id' =>
$object->track_id]);
99 $head[$h][1] = $langs->trans(
'ContactsAddresses');
100 if ($nbContact > 0) {
101 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
103 $head[$h][2] =
'contact';
110 if (!empty(
$object->note_private)) {
113 if (!empty(
$object->note_public)) {
117 $head[$h][1] = $langs->trans(
'Notes');
119 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
121 $head[$h][2] =
'note';
128 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
129 $upload_dir = $conf->ticket->dir_output.
"/".
$object->ref;
143 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/ticket/document.php', [
'id' =>
$object->id]);
144 $head[$h][1] = $langs->trans(
"Documents");
146 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFiles.
'</span>';
149 $head[$h][2] =
'tabTicketDocument';
154 $ticketViewType =
"messaging";
155 if (empty($_SESSION[
'ticket-view-type'])) {
156 $_SESSION[
'ticket-view-type'] = $ticketViewType;
158 $ticketViewType = $_SESSION[
'ticket-view-type'];
161 if ($ticketViewType ==
"messaging") {
162 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/ticket/messaging.php', [
'track_id' =>
$object->track_id]);
165 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/ticket/agenda.php', [
'track_id' =>
$object->track_id]);
167 $head[$h][1] = $langs->trans(
'Events');
168 if (
isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
171 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
172 $cachekey =
'count_events_ticket_'.$object->id;
174 if (!is_null($dataretrieved)) {
175 $nbEvent = $dataretrieved;
177 $sql =
"SELECT COUNT(id) as nb";
178 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
179 $sql .=
" WHERE fk_element = ".((int)
$object->id);
180 $sql .=
" AND elementtype = 'ticket'";
181 $resql = $db->query($sql);
183 $obj = $db->fetch_object($resql);
186 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
192 $head[$h][1] .= $langs->trans(
"Agenda");
194 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
197 $head[$h][2] =
'tabTicketLogs';
216 global $conf, $langs;
218 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
227 $langs->load(
'errors');
228 $out .=
'<span class="opacitymedium">'.$langs->trans(
"ErrorPublicInterfaceNotEnabled").
'</span>';
230 $out .=
img_picto(
'',
'object_globe.png').
' <span class="opacitymedium">'.$langs->trans(
"TicketPublicAccess").
'</span>';
232 $out .=
'<br><div class="urllink">';
233 $out .=
'<input type="text" id="directpubliclink" class="quatrevingtpercentminusx" spellcheck="false" value="'.$url.
'">';
234 $out .=
'<a href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'object_globe.png',
'class="paddingleft"').
'</a>';
238 $out .=
': <span class="opacitymedium">'.$langs->trans(
"TicketNotCreatedFromPublicInterface").
'</span>';
254 $chaine =
"abcdefghijklmnopqrstuvwxyz123456789";
255 $max = strlen($chaine) - 1;
257 for ($i = 0; $i < $car; $i++) {
259 $key = random_int(0, $max);
262 $key = mt_rand(0, $max);
264 $string .= $chaine[$key];
280function llxHeaderTicket($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
282 global $conf, $langs,
$mysoc;
284 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1);
286 print
'<body id="mainbody" class="publicnewticketform">';
287 print
'<div class="publicnewticketform2 centpercent" style="min-height: 100%;">';
if(! $sortfield) if(! $sortorder) $object
static getValidAddress($address, $format, $encode=0, $maxnumberofemail=0)
Return a formatted address string for SMTP protocol.
htmlPrintOnlineHeader($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
Show the header of a company in HTML public pages.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
dol_setcache($memoryid, $data, $expire=0, $filecache=0, $replace=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid, $filecache=0)
Read a memory area shared by all users, all sessions on server.
generate_random_id($car=16)
Generate a random id.
llxHeaderTicket($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show http header, open body tag and show HTML header banner for public pages for tickets.
ticketAdminPrepareHead()
Build tabs for admin page.
showDirectPublicLink($object)
Return string with full Url.
ticket_prepare_head($object)
Build tabs for a Ticket object.