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