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