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