dolibarr  17.0.4
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
26 require '../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
28 require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
29 require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
30 require_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
36 if (!$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 
56 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
57 
58 if ($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";
240 llxHeader('', $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 
245 print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
246 
247 // Configuration header
248 $head = ticketAdminPrepareHead();
249 
250 print dol_get_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
251 
252 print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries").'</span> : <a href="'.DOL_URL_ROOT.'/admin/dict.php">'.$langs->trans("ClickHereToGoTo", $langs->transnoentitiesnoconv("DictionarySetup")).'</a><br>';
253 
254 print dol_get_fiche_end();
255 
256 
257 /*
258  * Tickets numbering model
259  */
260 
261 print load_fiche_titre($langs->trans("TicketNumberingModules"), '', '');
262 
263 print '<div class="div-table-responsive-no-min">';
264 print '<table class="noborder centpercent">';
265 print '<tr class="liste_titre">';
266 print '<td width="100">'.$langs->trans("Name").'</td>';
267 print '<td>'.$langs->trans("Description").'</td>';
268 print '<td>'.$langs->trans("Example").'</td>';
269 print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
270 print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
271 print "</tr>\n";
272 
273 clearstatcache();
274 
275 foreach ($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 
355 print '</table>';
356 print '</div>';
357 print '<br>';
358 
359 
360 
361 /*
362  * Document templates generators
363  */
364 
365 print 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);
374 if ($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 
387 print '<div class="div-table-responsive-no-min">';
388 print '<table class="noborder cenpercent">'."\n";
389 print '<tr class="liste_titre">'."\n";
390 print '<td>'.$langs->trans("Name").'</td>';
391 print '<td>'.$langs->trans("Description").'</td>';
392 print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
393 print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
394 print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
395 print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
396 print "</tr>\n";
397 
398 clearstatcache();
399 
400 foreach ($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 
503 print '</table>';
504 print '</div><br>';
505 
506 
507 print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
508 print '<input type="hidden" name="token" value="'.newToken().'">';
509 print '<input type="hidden" name="action" value="setvarworkflow">';
510 print '<input type="hidden" name="page_y" value="">';
511 
512 print load_fiche_titre($langs->trans("Other"), '', '');
513 print '<div class="div-table-responsive-no-min">';
514 print '<table class="noborder centpercent">';
515 
516 print '<tr class="liste_titre">';
517 print '<td>'.$langs->trans("Parameter").'</td>';
518 print '<td></td>';
519 print '<td></td>';
520 print "</tr>\n";
521 
522 // Auto mark ticket read when created from backoffice
523 print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoReadTicket").'</td>';
524 print '<td class="left">';
525 if ($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 }
531 print '</td>';
532 print '<td class="center">';
533 print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
534 print '</td>';
535 print '</tr>';
536 
537 // Auto assign ticket at user who created it
538 print '<tr class="oddeven">';
539 print '<td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
540 print '<td class="left">';
541 if ($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 }
547 print '</td>';
548 print '<td class="center">';
549 print $formcategory->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
550 print '</td>';
551 print '</tr>';
552 
553 // Auto notify contacts when closing the ticket
554 print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoNotifyClose").'</td>';
555 print '<td class="left">';
556 if ($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 }
562 print '</td>';
563 print '<td class="center">';
564 print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, 'help');
565 print '</td>';
566 print '</tr>';
567 
568 if (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 
583 print '<tr class="oddeven">';
584 print '<td>'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</td>";
585 print '<td class="left">
586  <input type="number" value="'.getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE').'" name="delay_first_response" class="width50">
587  </td>';
588 print '<td class="center">';
589 print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
590 print '</td>';
591 print '</tr>';
592 
593 print '<tr class="oddeven">';
594 print '<td>'.$langs->trans("TicketsDelayBetweenAnswers")."</td>";
595 print '<td class="left">
596  <input type="number" value="'.getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE').'" name="delay_between_responses" class="width50">
597  </td>';
598 print '<td class="center">';
599 print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
600 print '</td>';
601 print '</tr>';
602 
603 print '</table><br>';
604 
605 print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
606 
607 print '</form>';
608 
609 
610 // Admin var of module
611 print load_fiche_titre($langs->trans("Notification"), '', '');
612 
613 print '<table class="noborder centpercent">';
614 
615 print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
616 print '<input type="hidden" name="token" value="'.newToken().'">';
617 print '<input type="hidden" name="action" value="setvar">';
618 print '<input type="hidden" name="page_y" value="">';
619 
620 print '<tr class="liste_titre">';
621 print '<td colspan="3">'.$langs->trans("Email").'</td>';
622 print "</tr>\n";
623 
624 if (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
633 print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationFrom").'</td>';
634 print '<td class="left">';
635 print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'"></td>';
636 print '<td class="center">';
637 print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
638 print '</td>';
639 print '</tr>';
640 
641 // Email for notification of TICKET_CREATE
642 print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").'</td>';
643 print '<td class="left">';
644 print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : '').'"></td>';
645 print '<td class="center">';
646 print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
647 print '</td>';
648 print '</tr>';
649 
650 // Also send to TICKET_NOTIFICATION_EMAIL_TO for responses (not only creation)
651 if ($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', '');
670 print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailIntro");
671 print '</td><td>';
672 require_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();
675 print '</td>';
676 print '<td class="center">';
677 print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
678 print '</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');
683 print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailFooter").'</label>';
684 print '</td><td>';
685 require_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();
688 print '</td>';
689 print '<td class="center">';
690 print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailFooterHelpAdmin"), 1, 'help');
691 print '</td></tr>';
692 
693 print '</table>';
694 
695 print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
696 
697 print '</form>';
698 
699 // End of page
700 llxFooter();
701 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
Definition: admin.lib.php:1888
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).
Definition: admin.lib.php:632
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:556
delDocumentModel($name, $type)
Delete document model used by doc generator.
Definition: admin.lib.php:1919
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:449
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='')
On/off button for constant.
Definition: ajax.lib.php:600
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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
Class to generate the form for creating a new ticket.
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.
Definition: ticket.lib.php:31