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