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