dolibarr 23.0.3
ticket.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
3 * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
4 * Copyright (C) 2022-2023 Udo Tamm <dev@dolibit.de>
5 * Copyright (C) 2023 Alexandre Spangaro <aspangaro@easya.solutions>
6 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2024-2025 Benjamin Falière <benjamin.faliere@altairis.fr>
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30// Load Dolibarr environment
31require '../main.inc.php';
32require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php";
33require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
34require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
35require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
36
46// Load translation files required by the page
47$langs->loadLangs(array("admin", "ticket"));
48
49// Access control
50if (!$user->admin) {
52}
53
54// Parameters
55$value = GETPOST('value', 'alpha');
56$action = GETPOST('action', 'aZ09');
57$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
58
59$label = GETPOST('label', 'alpha');
60$scandir = GETPOST('scan_dir', 'alpha');
61$type = 'ticket';
62
63$error = 0;
64$reg = array();
65
66// Initiate status list
67$statuslist = array(
68 Ticket::STATUS_IN_PROGRESS => $langs->trans("InProgress"),
69 Ticket::STATUS_NOT_READ => $langs->trans("NotRead"),
70 Ticket::STATUS_READ => $langs->trans("Read"),
71 Ticket::STATUS_ASSIGNED => $langs->trans("Assigned"),
72 Ticket::STATUS_NEED_MORE_INFO => $langs->trans("NeedMoreInformationShort"),
73 Ticket::STATUS_WAITING => $langs->trans("Waiting"),
74 Ticket::STATUS_CLOSED => $langs->trans("SolvedClosed")
75);
76
77/*
78 * Actions
79 */
80
81include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
82
83if (GETPOSTISSET('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')) { // only for no js case
84 $param_disable_email = GETPOST('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', 'alpha');
85 $res = dolibarr_set_const($db, 'TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', $param_disable_email, 'chaine', 0, '', $conf->entity);
86 if (!($res > 0)) {
87 $error++;
88 setEventMessages($db->lasterror(), null, 'errors');
89 }
90}
91
92if ($action == 'updateMask') {
93 $maskconstticket = GETPOST('maskconstticket', 'aZ09');
94 $maskticket = GETPOST('maskticket', 'alpha');
95
96 $res = 0;
97
98 if ($maskconstticket && preg_match('/_MASK$/', $maskconstticket)) {
99 $res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity);
100 }
101
102 if (!($res > 0)) {
103 $error++;
104 }
105
106 if (!$error) {
107 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
108 } else {
109 setEventMessages($langs->trans("Error"), null, 'errors');
110 }
111} elseif ($action == 'set') {
112 // Activate a model
113 $ret = addDocumentModel($value, $type, $label, $scandir);
114} elseif ($action == 'del') {
115 $ret = delDocumentModel($value, $type);
116 if ($ret > 0) {
117 if (getDolGlobalString('TICKET_ADDON_PDF') == "$value") {
118 dolibarr_del_const($db, 'TICKET_ADDON_PDF', $conf->entity);
119 }
120 }
121} elseif (preg_match('/set_(.*)/', $action, $reg)) {
122 $code = $reg[1];
123 $value = GETPOSTISSET($code) ? GETPOSTINT($code) : 1;
124 $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
125 if (!($res > 0)) {
126 $error++;
127 }
128} elseif (preg_match('/del_(.*)/', $action, $reg)) {
129 $code = $reg[1];
130 $res = dolibarr_del_const($db, $code, $conf->entity);
131 if (!($res > 0)) {
132 $error++;
133 }
134} elseif ($action == 'setdoc') {
135 // Set default model
136 if (dolibarr_set_const($db, "TICKET_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
137 // The constant that was read before the new set
138 // We therefore requires a variable to have a coherent view
139 $conf->global->TICKET_ADDON_PDF = $value;
140 }
141
142 // Activate the model
143 $ret = delDocumentModel($value, $type);
144 if ($ret > 0) {
145 $ret = addDocumentModel($value, $type, $label, $scandir);
146 }
147} elseif ($action == 'setmod') {
148 // TODO check if the chosen numbering module can be activated
149 // by calling the canBeActivated method
150
151 dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
152} elseif ($action == 'setvarworkflow') {
153 // For compatibility when javascript is not enabled
154 if (empty($conf->use_javascript_ajax)) {
155 $param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
156 $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
157 if (!($res > 0)) {
158 $error++;
159 }
160
161 $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
162 $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
163 if (!($res > 0)) {
164 $error++;
165 }
166
167 $param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
168 $res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
169 if (!($res > 0)) {
170 $error++;
171 }
172 }
173
174 $param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
175 $res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
176 if (!($res > 0)) {
177 $error++;
178 }
179
180 $param_status = GETPOST('TICKET_SET_STATUS_ON_ANSWER');
181 $res = dolibarr_set_const($db, 'TICKET_SET_STATUS_ON_ANSWER', $param_status, 'chaine', 0, '', $conf->entity);
182 if (!($res > 0)) {
183 $error++;
184 }
185
186 $param_delay_first_response = GETPOSTINT('delay_first_response');
187 $res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity);
188 if (!($res > 0)) {
189 $error++;
190 }
191
192 $param_delay_between_responses = GETPOSTINT('delay_between_responses');
193 $res = dolibarr_set_const($db, 'TICKET_DELAY_SINCE_LAST_RESPONSE', $param_delay_between_responses, 'chaine', 0, '', $conf->entity);
194 if (!($res > 0)) {
195 $error++;
196 }
197} elseif ($action == 'setvar') {
198 include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
199
200 $notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
201 $notification_email_description = "Email of user allowed to send ticket replies from Dolibarr";
202 if (!empty($notification_email)) {
203 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, $notification_email_description, $conf->entity);
204 } else { // If an empty e-mail address is providen, use the global "FROM" since an empty field will cause other issues
205 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', getDolGlobalString('MAIN_MAIL_EMAIL_FROM'), 'chaine', 0, $notification_email_description, $conf->entity);
206 }
207 if (!($res > 0)) {
208 $error++;
209 }
210
211 $notification_email_replyto = GETPOST('TICKET_NOTIFICATION_EMAIL_REPLYTO', 'alpha');
212 $notification_email_replyto_description = "Email that must appears as the sender of ticket replies sent from Dolibarr";
213 if (!empty($notification_email)) {
214 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_REPLYTO', $notification_email_replyto, 'chaine', 0, $notification_email_replyto_description, $conf->entity);
215 } else {
216 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_REPLYTO', getDolGlobalString('MAIN_MAIL_EMAIL_FROM'), 'chaine', 0, $notification_email_replyto_description, $conf->entity);
217 }
218 if (!($res > 0)) {
219 $error++;
220 }
221
222 // altairis : differentiate notification email FROM and TO
223 $notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
224 $notification_email_to_description = "Notified e-mail for ticket replies sent from Dolibarr";
225 if (!empty($notification_email_to)) {
226 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, $notification_email_to_description, $conf->entity);
227 } else {
228 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, $notification_email_to_description, $conf->entity);
229 }
230 if (!($res > 0)) {
231 $error++;
232 }
233
234 $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'restricthtml');
235 $mail_intro_description = "Introduction text of ticket replies sent from Dolibarr";
236 if (!empty($mail_intro)) {
237 $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, $mail_intro_description, $conf->entity);
238 } else {
239 $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', '', 'chaine', 0, $mail_intro_description, $conf->entity);
240 }
241 if (!($res > 0)) {
242 $error++;
243 }
244
245 $mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'restricthtml');
246 $signature_description = "Signature of ticket replies sent from Dolibarr";
247 if (!empty($mail_signature)) {
248 $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, $signature_description, $conf->entity);
249 } else {
250 $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', '', 'chaine', 0, $signature_description, $conf->entity);
251 }
252 if (!($res > 0)) {
253 $error++;
254 }
255
256 $res = dolibarr_set_const($db, "TICKET_SEND_INTERNAL_CC", GETPOST("TICKET_SEND_INTERNAL_CC"), 'chaine', 0, '', $conf->entity);
257 if (!($res > 0)) {
258 $error++;
259 }
260}
261
262
263/*
264 * View
265 */
266
267$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
268
269$formcategory = new FormCategory($db);
270$form = new Form($db);
271
272// Page Header
273$help_url = 'EN:Module_Ticket|FR:Module_Ticket_FR';
274$page_name = 'TicketSetup';
275llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-admin page-ticket');
276
277// Subheader
278$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
279
280print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
281
282// Configuration header
283$head = ticketAdminPrepareHead();
284
285print dol_get_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
286
287print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries").'</span> : <a href="'.DOL_URL_ROOT.'/admin/dict.php">'.$langs->trans("ClickHereToGoTo", $langs->transnoentitiesnoconv("DictionarySetup")).'</a><br>';
288
289print dol_get_fiche_end();
290
291
292/*
293 * Tickets numbering model
294 */
295
296print load_fiche_titre($langs->trans("TicketNumberingModules"), '', '');
297
298print '<div class="div-table-responsive-no-min">';
299print '<table class="noborder centpercent">';
300print '<tr class="liste_titre">';
301print '<td width="100">'.$langs->trans("Name").'</td>';
302print '<td>'.$langs->trans("Description").'</td>';
303print '<td>'.$langs->trans("Example").'</td>';
304print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
305print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
306print "</tr>\n";
307
308clearstatcache();
309
310foreach ($dirmodels as $reldir) {
311 $dir = dol_buildpath($reldir."core/modules/ticket");
312
313 if (is_dir($dir)) {
314 $handle = opendir($dir);
315 if (is_resource($handle)) {
316 while (($file = readdir($handle)) !== false) {
317 if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
318 $file = $reg[1];
319 $classname = substr($file, 4);
320
321 include_once $dir.'/'.$file.'.php';
322
323 $module = new $file();
324 '@phan-var-force ModeleNumRefTicket $module';
327 // Show modules according to features level
328 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
329 continue;
330 }
331
332 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
333 continue;
334 }
335
336 if ($module->isEnabled()) {
337 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
338 print $module->info($langs);
339 print '</td>';
340
341 // Show example of numbering model
342 print '<td class="nowrap">';
343 $tmp = $module->getExample();
344 if (preg_match('/^Error/', $tmp)) {
345 $langs->load("errors");
346 print '<div class="error">'.$langs->trans($tmp).'</div>';
347 } elseif ($tmp == 'NotConfigured') {
348 print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
349 } else {
350 print $tmp;
351 }
352
353 print '</td>'."\n";
354
355 print '<td class="center">';
356 if (getDolGlobalString('TICKET_ADDON') == 'mod_'.$classname) {
357 print img_picto($langs->trans("Activated"), 'switch_on');
358 } else {
359 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;token='.newToken().'&amp;value=mod_'.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
360 }
361 print '</td>';
362
363 $ticket = new Ticket($db);
364 $ticket->initAsSpecimen();
365
366 // Info
367 $htmltooltip = '';
368 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
369 $nextval = $module->getNextValue($mysoc, $ticket);
370 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
371 $htmltooltip .= ''.$langs->trans("NextValue").': ';
372 if ($nextval) {
373 $htmltooltip .= $nextval.'<br>';
374 } else {
375 $htmltooltip .= $langs->trans($module->error).'<br>';
376 }
377 }
378
379 print '<td class="center">';
380 print $formcategory->textwithpicto('', $htmltooltip, 1, '0');
381 print '</td>';
382
383 print '</tr>';
384 }
385 }
386 }
387 closedir($handle);
388 }
389 }
390}
391
392print '</table>';
393print '</div>';
394print '<br>';
395
396
397
398/*
399 * Document templates generators
400 */
401
402print load_fiche_titre($langs->trans("TicketsModelModule"), '', '');
403
404// Load array def with activated templates
405$def = array();
406$sql = "SELECT nom";
407$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
408$sql .= " WHERE type = '".$db->escape($type)."'";
409$sql .= " AND entity = ".((int) $conf->entity);
410$resql = $db->query($sql);
411if ($resql) {
412 $i = 0;
413 $num_rows = $db->num_rows($resql);
414 while ($i < $num_rows) {
415 $array = $db->fetch_array($resql);
416 if (is_array($array)) {
417 array_push($def, $array[0]);
418 }
419 $i++;
420 }
421} else {
422 dol_print_error($db);
423}
424
425
426print '<div class="div-table-responsive-no-min">';
427print '<table class="noborder cenpercent">'."\n";
428print '<tr class="liste_titre">'."\n";
429print '<td>'.$langs->trans("Name").'</td>';
430print '<td>'.$langs->trans("Description").'</td>';
431print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
432print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
433print '<td class="center" width="50">'.$langs->trans("Preview").'</td>';
434print '<td class="center" width="40">'.$langs->trans("ShortInfo").'</td>';
435print "</tr>\n";
436
437clearstatcache();
438
439foreach ($dirmodels as $reldir) {
440 foreach (array('', '/doc') as $valdir) {
441 $realpath = $reldir."core/modules/ticket".$valdir;
442 $dir = dol_buildpath($realpath);
443
444 if (is_dir($dir)) {
445 $handle = opendir($dir);
446 if (is_resource($handle)) {
447 $filelist = array();
448 while (($file = readdir($handle)) !== false) {
449 $filelist[] = $file;
450 }
451 closedir($handle);
452 arsort($filelist);
453
454 foreach ($filelist as $file) {
455 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
456 if (file_exists($dir.'/'.$file)) {
457 $name = substr($file, 4, dol_strlen($file) - 16);
458 $classname = substr($file, 0, dol_strlen($file) - 12);
459
460 require_once $dir.'/'.$file;
461 $module = new $classname($db);
462 '@phan-var-force ModelePDFTicket $module';
463
464 $modulequalified = 1;
465 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
466 $modulequalified = 0;
467 }
468 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
469 $modulequalified = 0;
470 }
471
472 if ($modulequalified) {
473 print '<tr class="oddeven"><td width="100">';
474 print(empty($module->name) ? $name : $module->name);
475 print "</td><td>\n";
476 if (method_exists($module, 'info')) {
477 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
478 } else {
479 print $module->description;
480 }
481 print '</td>';
482
483 // Active / Status
484 if (in_array($name, $def)) {
485 print '<td class="center">'."\n";
486 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
487 print img_picto($langs->trans("Enabled"), 'switch_on');
488 print '</a>';
489 print '</td>';
490 } else {
491 print '<td class="center">'."\n";
492 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
493 print "</td>";
494 }
495
496 // Default Template
497 print '<td class="center">';
498 if (getDolGlobalString("TICKET_ADDON_PDF") == $name) {
499 print img_picto($langs->trans("Default"), 'on');
500 } else {
501 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
502 }
503 print '</td>';
504
505 // Preview
506 print '<td class="center">';
507 if ($module->type == 'pdf') {
508 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
509 } else {
510 print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
511 }
512 print '</td>';
513
514 // Info
515 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
516 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
517 if ($module->type == 'pdf') {
518 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
519 }
520 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
521
522 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
523 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
524 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
525 //$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
526 //$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
527 //$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
528
529
530 print '<td class="center">';
531 print $formcategory->textwithpicto('', $htmltooltip, 1, '0');
532 print '</td>';
533
534 print "</tr>\n";
535 }
536 }
537 }
538 }
539 }
540 }
541 }
542}
543
544print '</table>';
545print '</div><br>';
546
547
548print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
549print '<input type="hidden" name="token" value="'.newToken().'">';
550print '<input type="hidden" name="action" value="setvarworkflow">';
551print '<input type="hidden" name="page_y" value="">';
552
553/*
554 * Other Parameters
555 */
556
557print load_fiche_titre($langs->trans("Other"), '', '');
558print '<div class="div-table-responsive-no-min">';
559print '<table class="noborder centpercent">';
560
561print '<tr class="liste_titre">';
562print '<td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td>';
563print '<td></td>'."\n";
564print '<td class="center" width="40"></td>';
565print "</tr>\n";
566
567// Auto mark ticket as read when created from backoffice
568print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoReadTicket").'</td>';
569print '<td class="left">';
570if ($conf->use_javascript_ajax) {
571 print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND');
572} else {
573 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
574 print $formcategory->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, getDolGlobalString('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND'));
575}
576print '</td>';
577print '<td class="center">';
578print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
579print '</td>';
580print '</tr>';
581
582// Auto assign ticket to user who created it
583print '<tr class="oddeven">';
584print '<td><label for="TICKET_AUTO_ASSIGN_USER_CREATE" class="block">'.$langs->trans("TicketsAutoAssignTicket").'</label></td>';
585print '<td class="left">';
586print '<input class="maxwidth50" type="text" id="TICKET_AUTO_ASSIGN_USER_CREATE" name="TICKET_AUTO_ASSIGN_USER_CREATE" value="'.getDolGlobalInt('TICKET_AUTO_ASSIGN_USER_CREATE').'">';
587print '</td>';
588print '<td class="center">';
589print $formcategory->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
590print '</td>';
591print '</tr>';
592
593// Automatically define status on answering a ticket
594print '<tr class="oddeven"><td>'.$langs->trans("TicketAutoChangeStatusOnAnswer").'</td>';
595print '<td class="left">';
596print $formcategory->selectarray("TICKET_SET_STATUS_ON_ANSWER", $statuslist, getDolGlobalString('TICKET_SET_STATUS_ON_ANSWER'), 1);
597print '</td>';
598print '<td class="center">';
599print $formcategory->textwithpicto('', $langs->trans("TicketAutoChangeStatusOnAnswerHelp"), 1, 'help');
600print '</td>';
601print '</tr>';
602
603print '<tr class="oddeven">';
604print '<td><label for="delay_first_response" class="block">'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</label></td>";
605print '<td class="left">
606 <input type="number" value="'.getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE').'" id="delay_first_response" name="delay_first_response" class="width50">
607 </td>';
608print '<td class="center">';
609print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
610print '</td>';
611print '</tr>';
612
613print '<tr class="oddeven">';
614print '<td><label for="delay_between_responses" class="block">'.$langs->trans("TicketsDelayBetweenAnswers")."</label></td>";
615print '<td class="left">
616 <input type="number" value="'.getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE').'" id="delay_between_responses" name="delay_between_responses" class="width50">
617 </td>';
618print '<td class="center">';
619print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
620print '</td>';
621print '</tr>';
622
623print '</table>';
624
625print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
626
627print '</form>';
628
629print '<br>';
630
631
632// TODO Use the notification module
633
634/*
635 * Notifications
636 */
637
638print load_fiche_titre($langs->trans("Notifications"), '', '');
639
640print '<table class="noborder centpercent">';
641
642print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
643print '<input type="hidden" name="token" value="'.newToken().'">';
644print '<input type="hidden" name="action" value="setvar">';
645print '<input type="hidden" name="page_y" value="">';
646
647print '<tr class="liste_titre">';
648print '<td>'.$langs->trans("Parameter").'</td>';
649print '<td></td>';
650print '<td class="center" width="40"></td>';
651print "</tr>\n";
652
653if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) {
654 print '<tr>';
655 print '<td colspan="2"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
656 print '<td class="center" width="40"></td>';
657 print "</tr>\n";
658}
659
660// Email of sender allowed to send technical notifications
661print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_FROM" class="block">'.$langs->trans("TicketEmailNotificationFrom").'</label></td>';
662print '<td class="left">';
663print img_picto('', 'email', 'class="pictofixedwidth"');
664print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_FROM" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'"></td>';
665print '<td class="center">';
666print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
667print '</td>';
668print '</tr>';
669
670// Email that must appears as the sender of email notifications
671print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_REPLYTO" class="block">'.$langs->trans("TicketEmailNotificationReplyTo").'</label></td>';
672print '<td class="left">';
673print img_picto('', 'email', 'class="pictofixedwidth"');
674print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_REPLYTO" name="TICKET_NOTIFICATION_EMAIL_REPLYTO" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_REPLYTO').'"></td>';
675print '<td class="center">';
676print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationReplyToHelp"), 1, 'help');
677print '</td>';
678print '</tr>';
679
680print '<tr class="oddeven"><td class="titlefieldmiddle"><label for="TICKET_SEND_INTERNAL_CC" class="block">';
681print $form->textwithpicto($langs->trans("TicketSendToInternalCC"), $langs->trans("TicketSendToInternalCCHelp")).'</label></td>';
682print '<td>';
683print img_picto('', 'email', 'class="pictofixedwidth"');
684print '<input class="minwidth200" name="TICKET_SEND_INTERNAL_CC" value="'.getDolGlobalString('TICKET_SEND_INTERNAL_CC').'">';
685print '</td>';
686print '<td></td>';
687print '</tr>';
688
689
690// TODO Use module notification instead...
691
692// Email for notification of TICKET_CREATE
693print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_TO" class="block">'.$langs->trans("TicketEmailNotificationTo").'</label></td>';
694print '<td class="left">';
695print img_picto('', 'email', 'class="pictofixedwidth"');
696print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_TO" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').'"></td>';
697print '<td class="center">';
698print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
699print '</td>';
700print '</tr>';
701
702// Check "Notify thirdparty" by default on ticket creation
703print '<tr class="oddeven"><td>'.$langs->trans("TicketAutoCheckNotifyThirdParty").'</td>';
704print '<td class="left">';
705if ($conf->use_javascript_ajax) {
706 print ajax_constantonoff('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION');
707} else {
708 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
709 print $formcategory->selectarray("TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION", $arrval, getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION'));
710}
711print '</td>';
712print '<td class="center">';
713print $formcategory->textwithpicto('', $langs->trans("TicketAutoCheckNotifyThirdPartyHelp"), 1, 'help');
714print '</td>';
715print '</tr>';
716
717// Auto notify contacts when closing the ticket
718print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoNotifyClose").'</td>';
719print '<td class="left">';
720if ($conf->use_javascript_ajax) {
721 print ajax_constantonoff('TICKET_NOTIFY_AT_CLOSING');
722} else {
723 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
724 print $formcategory->selectarray("TICKET_NOTIFY_AT_CLOSING", $arrval, getDolGlobalString('TICKET_NOTIFY_AT_CLOSING'));
725}
726print '</td>';
727print '<td class="center">';
728print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, 'help');
729print '</td>';
730print '</tr>';
731
732// Message header
733$mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', '');
734print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailIntro");
735print '</td><td>';
736require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
737$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 90, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, '70');
738$doleditor->Create();
739print '</td>';
740print '<td class="center">';
741print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
742print '</td></tr>';
743
744// Message footer
745$mail_signature = getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE');
746print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailFooter").'</label>';
747print '</td><td>';
748require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
749$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 90, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, '70');
750$doleditor->Create();
751print '</td>';
752print '<td class="center">';
753print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailFooterHelpAdmin"), 1, 'help');
754print '</td></tr>';
755
756print '</table>';
757
758print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
759
760print '</form>';
761
762// End of page
763llxFooter();
764$db->close();
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
Class to manage a WYSIWYG editor.
Class to manage forms for categories.
Class to manage generation of HTML components Only common components must be here.
global $mysoc
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, $allowothertags=array())
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
Class to generate the form for creating a new ticket.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:128
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
ticketAdminPrepareHead()
Build tabs for admin page.