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