dolibarr  19.0.0-dev
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 ($conf->global->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' && $conf->global->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 (empty($conf->global->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="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">';
256 
257 print dol_get_fiche_end();
258 
259 
260 
261 if (!empty($conf->global->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 (empty($conf->global->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 (empty(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 (empty(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 ($conf->global->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, $conf->global->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 ($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, $conf->global->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 footer for company
383  print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyFooter").'</td>';
384  print '<td class="left">';
385  if ($conf->use_javascript_ajax) {
386  print ajax_constantonoff('TICKET_SHOW_COMPANY_FOOTER');
387  } else {
388  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
389  print $form->selectarray("TICKET_SHOW_COMPANY_FOOTER", $arrval, $conf->global->TICKET_SHOW_COMPANY_FOOTER);
390  }
391  print '</td>';
392  print '<td class="center width75">';
393  print $form->textwithpicto('', $langs->trans("TicketsShowCompanyFooterHelp"), 1, 'help');
394  print '</td>';
395  print '</tr>';
396 
397  // Show progression
398  print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowProgression").'</td>';
399  print '<td class="left">';
400  if (empty(getDolGlobalInt('TICKET_SHOW_PROGRESSION'))) {
401  print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_SHOW_PROGRESSION">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
402  } else {
403  print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_SHOW_PROGRESSION">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
404  }
405  print '</td>';
406  print '<td class="center width75">';
407  print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help');
408  print '</td>';
409  print '</tr>';
410 
411  // Also send to main email address
412  if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
413  print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
414  print '<td class="left">';
415  if ($conf->use_javascript_ajax) {
416  print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
417  } else {
418  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
419  print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
420  }
421  print '</td>';
422  print '<td class="center width75">';
423  print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help');
424  print '</td>';
425  print '</tr>';
426  }
427 
428  if (!$conf->use_javascript_ajax) {
429  print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></td>';
430  print '</tr>';
431  }
432 
433  if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
434  print '<tr>';
435  print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
436  print "</tr>\n";
437  }
438 
439  // Interface topic
440  $url_interface = getDolGlobalString("TICKET_PUBLIC_INTERFACE_TOPIC");
441  print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
442  print '</td><td>';
443  print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.'" size="40" ></td>';
444  print '</td>';
445  print '<td class="center width75">';
446  print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
447  print '</td></tr>';
448 
449  // Text on home page
450  $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc").'</span>');
451  print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
452  print '</td><td>';
453  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
454  $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
455  $doleditor->Create();
456  print '</td>';
457  print '<td class="center">';
458  print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
459  print '</td></tr>';
460 
461  // Text to help to enter a ticket
462  $public_text_help_message = getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'));
463  print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
464  print '</td><td>';
465  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
466  $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);
467  $doleditor->Create();
468  print '</td>';
469  print '<td class="center">';
470  print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
471  print '</td></tr>';
472 
473  // Url public interface
474  $url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE");
475  print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
476  print '</td><td>';
477  print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.'"></td>';
478  print '</td>';
479  print '<td class="center">';
480  print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
481  print '</td></tr>';
482 
483  print '</table>';
484 
485  print '<br><br>';
486 
487  print load_fiche_titre($langs->trans("Emails"));
488 
489  print '<div class="div-table-responsive-no-min">';
490  print '<table class="noborder centpercent">';
491 
492  // Activate email creation to user
493  print '<tr class="pair"><td>';
494  print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
495  print '</td>';
496  print '<td class="left">';
497  if ($conf->use_javascript_ajax) {
498  print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
499  } else {
500  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
501  print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
502  }
503  print '</td>';
504  print '</tr>';
505 
506  // Text of email after creatio of a ticket
507  $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody'));
508  print '<tr><td>';
509  print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
510  print '</label>';
511  print '</td><td>';
512  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
513  $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
514  $doleditor->Create();
515  print '</td>';
516  print '</tr>';
517 
518  // Activate email notification when a new message is added
519  print '<tr class="pair"><td>';
520  print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
521  print '</td>';
522  print '<td class="left">';
523  if ($conf->use_javascript_ajax) {
524  print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
525  } else {
526  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
527  print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
528  }
529  print '</td>';
530  print '</tr>';
531 
532  // Send notification when a new message is added to a email if a user is not assigned to the ticket
533  print '<tr><td>';
534  print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
535  print '</td><td>';
536  print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").'" size="40" ></td>';
537  print '</td>';
538  print '</tr>';
539 
540  print '</table>';
541  print '</div>';
542 
543  print $form->buttonsSaveCancel("Save", '');
544 
545  print '</form>';
546 }
547 
548 // End of page
549 llxFooter();
550 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
dolibarr_del_const
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:562
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5477
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:609
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
setEventMessage
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
Definition: functions.lib.php:8637
ajax_constantonoff
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='inline-block')
On/off button for constant.
Definition: ajax.lib.php:630
$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:118
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:4135
llxHeader
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
ticketAdminPrepareHead
ticketAdminPrepareHead()
Build tabs for admin page.
Definition: ticket.lib.php:31
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8673
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:11654
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2177
dol_get_fiche_head
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.
Definition: functions.lib.php:1979
getDolGlobalString
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:142
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:638
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:509
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1169
ajax_autoselect
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
Definition: functions.lib.php:10310
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:156
DolEditor
Class to manage a WYSIWYG editor.
Definition: doleditor.class.php:30