dolibarr  18.0.6
ticket_public.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 
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 $label = GETPOST('label', 'alpha');
43 $scandir = GETPOST('scandir', 'alpha');
44 $type = 'ticket';
45 
46 
47 /*
48  * Actions
49  */
50 $error = 0;
51 $errors = array();
52 
53 if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
54  if (GETPOST('value')) {
55  $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
56  } else {
57  $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
58  }
59  if (!($res > 0)) {
60  $error++;
61  $errors[] = $db->lasterror();
62  }
63 } elseif ($action == 'setvar') {
64  include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
65 
66  if (GETPOSTISSET('TICKET_ENABLE_PUBLIC_INTERFACE')) { // only for no js case
67  $param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
68  $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
69  if (!($res > 0)) {
70  $error++;
71  $errors[] = $db->lasterror();
72  }
73  }
74 
75  if (GETPOSTISSET('TICKET_DISABLE_CUSTOMER_MAILS')) { // only for no js case
76  $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
77  $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
78  if (!($res > 0)) {
79  $error++;
80  $errors[] = $db->lasterror();
81  }
82  }
83 
84  if (GETPOSTISSET('TICKET_SHOW_COMPANY_LOGO')) { // only for no js case
85  $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha');
86  $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
87  if (!($res > 0)) {
88  $error++;
89  $errors[] = $db->lasterror();
90  }
91  }
92 
93  $topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alphanohtml');
94  if (!empty($topic_interface)) {
95  $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
96  } else {
97  $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
98  }
99  if (!($res > 0)) {
100  $error++;
101  $errors[] = $db->lasterror();
102  }
103 
104  $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
105  if (GETPOSTISSET('TICKET_PUBLIC_TEXT_HOME')) {
106  $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
107  } else {
108  $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
109  }
110  if (!($res > 0)) {
111  $error++;
112  $errors[] = $db->lasterror();
113  }
114 
115  $text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'restricthtml');
116  if (!empty($text_help)) {
117  $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
118  } else {
119  $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
120  }
121  if (!($res > 0)) {
122  $error++;
123  $errors[] = $db->lasterror();
124  }
125 
126  $mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'restricthtml');
127  if (!empty($mail_new_ticket)) {
128  $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
129  } else {
130  $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
131  }
132  if (!($res > 0)) {
133  $error++;
134  $errors[] = $db->lasterror();
135  }
136 
137  $url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
138  if (!empty($url_interface)) {
139  $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
140  } else {
141  $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
142  }
143  if (!($res > 0)) {
144  $error++;
145  $errors[] = $db->lasterror();
146  }
147 
148  $param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
149  $res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
150  if (!($res > 0)) {
151  $error++;
152  $errors[] = $db->lasterror();
153  }
154 
155  // For compatibility when javascript is not enabled
156  if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) {
157  $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
158  $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
159  if (!($res > 0)) {
160  $error++;
161  $errors[] = $db->lasterror();
162  }
163  }
164 } elseif (preg_match('/set_(.*)/', $action, $reg)) {
165  $code = $reg[1];
166  $value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
167  if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
168  $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
169  $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
170  if (!($res > 0)) {
171  $error++;
172  }
173  } else {
174  $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
175  if (!($res > 0)) {
176  $error++;
177  }
178  if (!$error) {
179  if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
180  $res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
181  if (!($res > 0)) {
182  $error++;
183  $errors[] = $db->lasterror();
184  }
185  } elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
186  $res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
187  if (!($res > 0)) {
188  $error++;
189  $errors[] = $db->lasterror();
190  }
191  }
192  }
193  }
194 } elseif (preg_match('/del_(.*)/', $action, $reg)) {
195  $code = $reg[1];
196  $res = dolibarr_del_const($db, $code, $conf->entity);
197  if (!($res > 0)) {
198  $error++;
199  $errors[] = $db->lasterror();
200  }
201 }
202 
203 if ($action != '') {
204  if (!$error) {
205  $db->commit();
206  setEventMessage($langs->trans('SetupSaved'));
207  header("Location: " . $_SERVER['PHP_SELF']);
208  exit;
209  } else {
210  $db->rollback();
211  setEventMessages('', $errors, 'errors');
212  }
213 }
214 
215 
216 /*
217  * View
218  */
219 
220 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
221 
222 $form = new Form($db);
223 
224 $help_url = "FR:Module_Ticket";
225 $page_name = "TicketSetup";
226 llxHeader('', $langs->trans($page_name), $help_url);
227 
228 // Subheader
229 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
230 
231 print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
232 
233 // Configuration header
234 $head = ticketAdminPrepareHead();
235 
236 print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
237 
238 $param = '';
239 
240 print '<br>';
241 
242 $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
243 if (!getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
244  // Button off, click to enable
245  $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
246  $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
247  $enabledisablehtml .= '</a>';
248 } else {
249  // Button on, click to disable
250  $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
251  $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
252  $enabledisablehtml .= '</a>';
253 }
254 print $enabledisablehtml;
255 print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(!getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).'">';
256 
257 print dol_get_fiche_end();
258 
259 
260 
261 if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
262  print '<br>';
263 
264 
265  // Define $urlwithroot
266  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
267  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
268  //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
269 
270  print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> :<br>';
271  print '<div class="urllink">';
272  print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">';
273  print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
274  print '</div>';
275  print ajax_autoselect('publicurlmember');
276 
277 
278  print '<br><br>';
279 
280 
281  print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
282  print '<input type="hidden" name="token" value="'.newToken().'">';
283  print '<input type="hidden" name="action" value="setvar">';
284 
285  print '<div class="div-table-responsive-no-min">';
286  print '<table class="noborder centpercent">';
287  print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
288  print '<td class="left">';
289  print '</td>';
290  print '<td class="center width75">';
291  print '</td>';
292  print '</tr>';
293 
294  // Enable Captcha code
295  print '<tr class="oddeven">';
296  print '<td>'.$langs->trans("TicketUseCaptchaCode").'</td>';
297  print '<td class="left">';
298  if (function_exists("imagecreatefrompng")) {
299  if (!empty($conf->use_javascript_ajax)) {
300  print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA_TICKET');
301  } else {
302  if (!getDolGlobalInt('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) {
303  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
304  } else {
305  print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
306  }
307  }
308  } else {
309  $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning');
310  print $desc;
311  }
312  print '</td>';
313  print '<td class="center width75">';
314  print $form->textwithpicto('', $langs->trans("TicketUseCaptchaCodeHelp"), 1, 'help');
315  print '</td>';
316  print '</tr>';
317 
318  // Check if email exists
319  print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
320  print '<td class="left">';
321  if (!getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS')) {
322  print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
323  } else {
324  print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
325  }
326  print '</td>';
327  print '<td class="center width75">';
328  print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
329  print '</td>';
330  print '</tr>';
331 
332  // Auto fill the contact found from email
333  // This option is a serious security hole. it allows to any non logged perso, to get the database of contacts or to check if an email is a customer or not. We must keep it as hidden option only.
334  /*
335  print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
336  print '<td class="left">';
337  if (!getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST')) {
338  print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
339  } else {
340  print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
341  }
342  print '</td>';
343  print '<td class="center width75">';
344  print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
345  print '</td>';
346  print '</tr>';
347  */
348 
349  /*if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2)
350  {
351  // Show logo for module
352  print '<tr class="oddeven"><td>' . $langs->trans("TicketsShowModuleLogo") . '</td>';
353  print '<td class="left">';
354  if ($conf->use_javascript_ajax) {
355  print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
356  } else {
357  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
358  print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, getDolGlobalInt('TICKET_SHOW_MODULE_LOGO'));
359  }
360  print '</td>';
361  print '<td class="center">';
362  print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
363  print '</td>';
364  print '</tr>';
365  }*/
366 
367  // Show logo for company
368  print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyLogo").'</td>';
369  print '<td class="left">';
370  if (!empty($conf->use_javascript_ajax)) {
371  print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
372  } else {
373  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
374  print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO'));
375  }
376  print '</td>';
377  print '<td class="center width75">';
378  print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
379  print '</td>';
380  print '</tr>';
381 
382  // Show progression
383  print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowProgression").'</td>';
384  print '<td class="left">';
385  if (!empty($conf->use_javascript_ajax)) {
386  print ajax_constantonoff('TICKET_SHOW_PROGRESSION');
387  } else {
388  if (!getDolGlobalInt('TICKET_SHOW_PROGRESSION')) {
389  print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_SHOW_PROGRESSION&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
390  } else {
391  print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_SHOW_PROGRESSION&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
392  }
393  }
394  print '</td>';
395  print '<td class="center width75">';
396  print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help');
397  print '</td>';
398  print '</tr>';
399 
400  // Also send to main email address
401  if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
402  print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
403  print '<td class="left">';
404  if (!empty($conf->use_javascript_ajax)) {
405  print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
406  } else {
407  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
408  print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'));
409  }
410  print '</td>';
411  print '<td class="center width75">';
412  print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help');
413  print '</td>';
414  print '</tr>';
415  }
416 
417  if (empty($conf->use_javascript_ajax)) {
418  print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></td>';
419  print '</tr>';
420  }
421 
422  if (!getDolGlobalInt('FCKEDITOR_ENABLE_MAIL')) {
423  print '<tr>';
424  print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
425  print "</tr>\n";
426  }
427 
428  // Interface topic
429  $url_interface = getDolGlobalString("TICKET_PUBLIC_INTERFACE_TOPIC");
430  print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
431  print '</td><td>';
432  print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.'" size="40" ></td>';
433  print '</td>';
434  print '<td class="center width75">';
435  print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
436  print '</td></tr>';
437 
438  // Text on home page
439  $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc").'</span>');
440  print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
441  print '</td><td>';
442  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
443  $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
444  $doleditor->Create();
445  print '</td>';
446  print '<td class="center">';
447  print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
448  print '</td></tr>';
449 
450  // Text to help to enter a ticket
451  $public_text_help_message = getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'));
452  print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
453  print '</td><td>';
454  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
455  $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
456  $doleditor->Create();
457  print '</td>';
458  print '<td class="center">';
459  print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
460  print '</td></tr>';
461 
462  // Url public interface
463  $url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE");
464  print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
465  print '</td><td>';
466  print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.'"></td>';
467  print '</td>';
468  print '<td class="center">';
469  print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
470  print '</td></tr>';
471 
472  print '</table>';
473 
474  print '<br><br>';
475 
476  print load_fiche_titre($langs->trans("Emails"));
477 
478  print '<div class="div-table-responsive-no-min">';
479  print '<table class="noborder centpercent">';
480 
481  // Activate email creation to user
482  print '<tr class="pair"><td>';
483  print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
484  print '</td>';
485  print '<td class="left">';
486  if ($conf->use_javascript_ajax) {
487  print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
488  } else {
489  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
490  print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS'));
491  }
492  print '</td>';
493  print '</tr>';
494 
495  // Text of email after creatio of a ticket
496  $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody'));
497  print '<tr><td>';
498  print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
499  print '</label>';
500  print '</td><td>';
501  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
502  $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
503  $doleditor->Create();
504  print '</td>';
505  print '</tr>';
506 
507  // Activate email notification when a new message is added
508  print '<tr class="pair"><td>';
509  print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
510  print '</td>';
511  print '<td class="left">';
512  if ($conf->use_javascript_ajax) {
513  print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
514  } else {
515  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
516  print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
517  }
518  print '</td>';
519  print '</tr>';
520 
521  // Send notification when a new message is added to a email if a user is not assigned to the ticket
522  print '<tr><td>';
523  print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
524  print '</td><td>';
525  print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").'" size="40" ></td>';
526  print '</td>';
527  print '</tr>';
528 
529  print '</table>';
530  print '</div>';
531 
532  print $form->buttonsSaveCancel("Save", '');
533 
534  print '</form>';
535 }
536 
537 // End of page
538 llxFooter();
539 $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
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:638
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:562
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='')
On/off button for constant.
Definition: ajax.lib.php:630
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 generation of HTML components Only common components must be here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
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='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
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)
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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