dolibarr 21.0.0-alpha
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../main.inc.php';
28require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
29require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
30require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
31require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php";
32
33// Load translation files required by the page
34$langs->loadLangs(array("admin", "ticket"));
35
36// Access control
37if (!$user->admin) {
39}
40
41// Parameters
42$value = GETPOST('value', 'alpha');
43$action = GETPOST('action', 'aZ09');
44$label = GETPOST('label', 'alpha');
45$scandir = GETPOST('scandir', 'alpha');
46$type = 'ticket';
47
48
49/*
50 * Actions
51 */
52$error = 0;
53$errors = array();
54
55if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
56 if (GETPOST('value')) {
57 $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
58 } else {
59 $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
60 }
61 if (!($res > 0)) {
62 $error++;
63 $errors[] = $db->lasterror();
64 }
65} elseif ($action == 'setvar') {
66 include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
67
68 if (GETPOSTISSET('TICKET_ENABLE_PUBLIC_INTERFACE')) { // only for no js case
69 $param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
70 $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
71 if (!($res > 0)) {
72 $error++;
73 $errors[] = $db->lasterror();
74 }
75 }
76
77 if (GETPOSTISSET('TICKET_DISABLE_CUSTOMER_MAILS')) { // only for no js case
78 $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
79 $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
80 if (!($res > 0)) {
81 $error++;
82 $errors[] = $db->lasterror();
83 }
84 }
85
86 if (GETPOSTISSET('TICKET_SHOW_COMPANY_LOGO')) { // only for no js case
87 $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha');
88 $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
89 if (!($res > 0)) {
90 $error++;
91 $errors[] = $db->lasterror();
92 }
93 }
94
95 $topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alphanohtml');
96 if (!empty($topic_interface)) {
97 $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
98 } else {
99 $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
100 }
101 if (!($res > 0)) {
102 $error++;
103 $errors[] = $db->lasterror();
104 }
105
106 $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
107 if (GETPOSTISSET('TICKET_PUBLIC_TEXT_HOME')) {
108 $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
109 } else {
110 $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
111 }
112 if (!($res > 0)) {
113 $error++;
114 $errors[] = $db->lasterror();
115 }
116
117 $text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'restricthtml');
118 if (!empty($text_help)) {
119 $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
120 } else {
121 $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
122 }
123 if (!($res > 0)) {
124 $error++;
125 $errors[] = $db->lasterror();
126 }
127
128 $mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'restricthtml');
129 if (!empty($mail_new_ticket)) {
130 $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
131 } else {
132 $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
133 }
134 if (!($res > 0)) {
135 $error++;
136 $errors[] = $db->lasterror();
137 }
138
139 $url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
140 if (!empty($url_interface)) {
141 $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
142 } else {
143 $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
144 }
145 if (!($res > 0)) {
146 $error++;
147 $errors[] = $db->lasterror();
148 }
149
150 $param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
151 $res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
152 if (!($res > 0)) {
153 $error++;
154 $errors[] = $db->lasterror();
155 }
156
157 // For compatibility when javascript is not enabled
158 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) {
159 $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
160 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
161 if (!($res > 0)) {
162 $error++;
163 $errors[] = $db->lasterror();
164 }
165 }
166} elseif (preg_match('/set_(.*)/', $action, $reg)) {
167 $code = $reg[1];
168 $value = GETPOSTISSET($code) ? GETPOSTINT($code) : 1;
169 if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
170 $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
171 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
172 if (!($res > 0)) {
173 $error++;
174 }
175 } else {
176 $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
177 if (!($res > 0)) {
178 $error++;
179 }
180 if (!$error) {
181 if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
182 $res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
183 if (!($res > 0)) {
184 $error++;
185 $errors[] = $db->lasterror();
186 }
187 } elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
188 $res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
189 if (!($res > 0)) {
190 $error++;
191 $errors[] = $db->lasterror();
192 }
193 }
194 }
195 }
196} elseif (preg_match('/del_(.*)/', $action, $reg)) {
197 $code = $reg[1];
198 $res = dolibarr_del_const($db, $code, $conf->entity);
199 if (!($res > 0)) {
200 $error++;
201 $errors[] = $db->lasterror();
202 }
203}
204
205if ($action != '') {
206 if (!$error) {
207 $db->commit();
208 setEventMessage($langs->trans('SetupSaved'));
209 header("Location: " . $_SERVER['PHP_SELF']);
210 exit;
211 } else {
212 $db->rollback();
213 setEventMessages('', $errors, 'errors');
214 }
215}
216
217
218/*
219 * View
220 */
221
222$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
223
224$form = new Form($db);
225$formcategory = new FormCategory($db);
226
227$help_url = "FR:Module_Ticket";
228$page_name = "TicketSetup";
229llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-admin page-ticket_public');
230
231// Subheader
232$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
233
234print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
235
236// Configuration header
237$head = ticketAdminPrepareHead();
238
239print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
240
241$param = '';
242
243print '<br>';
244
245$enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
246if (!getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
247 // Button off, click to enable
248 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
249 $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
250 $enabledisablehtml .= '</a>';
251} else {
252 // Button on, click to disable
253 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
254 $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
255 $enabledisablehtml .= '</a>';
256}
257print $enabledisablehtml;
258print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(!getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).'">';
259
260print dol_get_fiche_end();
261
262
263
264if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
265 print '<br>';
266
267
268 // Define $urlwithroot
269 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
270 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
271 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
272
273 print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> :<br>';
274 print '<div class="urllink">';
275 print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">';
276 print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
277 print '</div>';
278 print ajax_autoselect('publicurlmember');
279
280
281 print '<br><br>';
282
283
284 print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
285 print '<input type="hidden" name="token" value="'.newToken().'">';
286 print '<input type="hidden" name="action" value="setvar">';
287
288 print '<div class="div-table-responsive-no-min">';
289 print '<table class="noborder centpercent">';
290 print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
291 print '<td class="left">';
292 print '</td>';
293 print '<td class="center width75">';
294 print '</td>';
295 print '</tr>';
296
297 // Enable Captcha code
298 print '<tr class="oddeven">';
299 print '<td>'.$langs->trans("TicketUseCaptchaCode").'</td>';
300 print '<td class="left">';
301 if (function_exists("imagecreatefrompng")) {
302 if (!empty($conf->use_javascript_ajax)) {
303 print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA_TICKET');
304 } else {
305 if (!getDolGlobalInt('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) {
306 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
307 } else {
308 print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
309 }
310 }
311 } else {
312 $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning');
313 print $desc;
314 }
315 print '</td>';
316 print '<td class="center width75">';
317 print $form->textwithpicto('', $langs->trans("TicketUseCaptchaCodeHelp"), 1, 'help');
318 print '</td>';
319 print '</tr>';
320
321 // Check if email exists
322 print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
323 print '<td class="left">';
324 if (!getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS')) {
325 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
326 } else {
327 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
328 }
329 print '</td>';
330 print '<td class="center width75">';
331 print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
332 print '</td>';
333 print '</tr>';
334
335 // Auto fill the contact found from email
336 // 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.
337 /*
338 print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
339 print '<td class="left">';
340 if (!getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST')) {
341 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>';
342 } else {
343 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>';
344 }
345 print '</td>';
346 print '<td class="center width75">';
347 print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
348 print '</td>';
349 print '</tr>';
350 */
351
352
353 // Show logo for company
354 print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyLogo").'</td>';
355 print '<td class="left">';
356 if (!empty($conf->use_javascript_ajax)) {
357 print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
358 } else {
359 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
360 print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO'));
361 }
362 print '</td>';
363 print '<td class="center width75">';
364 print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
365 print '</td>';
366 print '</tr>';
367
368 // show footer for company
369 print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyFooter").'</td>';
370 print '<td class="left">';
371 if ($conf->use_javascript_ajax) {
372 print ajax_constantonoff('TICKET_SHOW_COMPANY_FOOTER');
373 } else {
374 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
375 print $form->selectarray("TICKET_SHOW_COMPANY_FOOTER", $arrval, $conf->global->TICKET_SHOW_COMPANY_FOOTER);
376 }
377 print '</td>';
378 print '<td class="center width75">';
379 print $form->textwithpicto('', $langs->trans("TicketsShowCompanyFooterHelp"), 1, 'help');
380 print '</td>';
381 print '</tr>';
382
383 // Show progression
384 print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowProgression").'</td>';
385 print '<td class="left">';
386 if (!empty($conf->use_javascript_ajax)) {
387 print ajax_constantonoff('TICKET_SHOW_PROGRESSION');
388 } else {
389 if (!getDolGlobalInt('TICKET_SHOW_PROGRESSION')) {
390 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_SHOW_PROGRESSION&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
391 } else {
392 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_SHOW_PROGRESSION&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
393 }
394 }
395 print '</td>';
396 print '<td class="center width75">';
397 print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help');
398 print '</td>';
399 print '</tr>';
400
401 // Also send to main email address
402 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
403 print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
404 print '<td class="left">';
405 if (!empty($conf->use_javascript_ajax)) {
406 print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
407 } else {
408 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
409 print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'));
410 }
411 print '</td>';
412 print '<td class="center width75">';
413 print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help');
414 print '</td>';
415 print '</tr>';
416 }
417
418 if (empty($conf->use_javascript_ajax)) {
419 print '<tr><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></td>';
420 print '</tr>';
421 }
422
423 if (!getDolGlobalInt('FCKEDITOR_ENABLE_MAIL')) {
424 print '<tr>';
425 print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
426 print "</tr>\n";
427 }
428
429 // Interface topic
430 $url_interface = getDolGlobalString("TICKET_PUBLIC_INTERFACE_TOPIC");
431 print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
432 print '</td><td>';
433 print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.'" size="40" ></td>';
434 print '</td>';
435 print '<td class="center width75">';
436 print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
437 print '</td></tr>';
438
439 // Text on home page
440 $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc").'</span>');
441 print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
442 print '</td><td>';
443 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
444 $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, '70');
445 $doleditor->Create();
446 print '</td>';
447 print '<td class="center">';
448 print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
449 print '</td></tr>';
450
451 // Text to help to enter a ticket
452 $public_text_help_message = getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'));
453 print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
454 print '</td><td>';
455 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
456 $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');
457 $doleditor->Create();
458 print '</td>';
459 print '<td class="center">';
460 print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
461 print '</td></tr>';
462
463 // Add first contact id found in database from submitter email entered into public interface
464 // Feature disabled: This has a security trouble. The public interface is a no login interface, so being able to show the contact info from an
465 // email decided by the submiter allows anybody to get information on any contact (customer or supplier) in Dolibarr database.
466 // He can even check if contact exists by trying any email if this feature is enabled.
467 /*
468 print '<tr class="oddeven"><td>'.$langs->trans("TicketAssignContactToMessage").'</td>';
469 print '<td class="left">';
470 if ($conf->use_javascript_ajax) {
471 print ajax_constantonoff('TICKET_ASSIGN_CONTACT_TO_MESSAGE');
472 } else {
473 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
474 print $formcategory->selectarray("TICKET_ASSIGN_CONTACT_TO_MESSAGE", $arrval, getDolGlobalString('TICKET_ASSIGN_CONTACT_TO_MESSAGE'));
475 }
476 print '</td>';
477 print '<td class="center">';
478 print $formcategory->textwithpicto('', $langs->trans("TicketAssignContactToMessageHelp"), 1, 'help');
479 print '</td>';
480 print '</tr>';
481 */
482
483 // Url public interface
484 $url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE");
485 print '<tr class="oddeven"><td>'.$langs->trans("UrlPublicInterfaceLabelAdmin").'</label>';
486 print '</td><td>';
487 print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.'" placeholder="https://..."></td>';
488 print '</td>';
489 print '<td class="center">';
490 print $form->textwithpicto('', $langs->trans("UrlPublicInterfaceHelpAdmin"), 1, 'help');
491 print '</td></tr>';
492
493 print '</table>';
494
495
496 print '<br><br>';
497
498
499 print load_fiche_titre($langs->trans("Emails"));
500
501 print '<div class="div-table-responsive-no-min">';
502 print '<table class="noborder centpercent">';
503
504 // Activate email creation to user
505 print '<tr class="oddeven"><td>';
506 print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
507 print '</td>';
508 print '<td class="left">';
509 if ($conf->use_javascript_ajax) {
510 print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
511 } else {
512 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
513 print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS'));
514 }
515 print '</td>';
516 print '</tr>';
517
518 // Text of email after creatio of a ticket
519 $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody'));
520 print '<tr class="oddeven"><td>';
521 print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
522 print '</label>';
523 print '</td><td>';
524 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
525 $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, '70');
526 $doleditor->Create();
527 print '</td>';
528 print '</tr>';
529
530 // Activate email notification when a new message is added
531 print '<tr class="oddeven"><td>';
532 print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
533 print '</td>';
534 print '<td class="left">';
535 if ($conf->use_javascript_ajax) {
536 print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
537 } else {
538 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
539 print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
540 }
541 print '</td>';
542 print '</tr>';
543
544 // Send notification when a new message is added to a email if a user is not assigned to the ticket
545 print '<tr class="oddeven"><td>';
546 print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
547 print '</td><td>';
548 print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").'" size="40" ></td>';
549 print '</td>';
550 print '</tr>';
551
552 print '</table>';
553 print '</div>';
554
555 print $form->buttonsSaveCancel("Save", '');
556
557 print '</form>';
558}
559
560// End of page
561llxFooter();
562$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to manage a WYSIWYG editor.
Class to manage forms for categories.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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, $attop=0)
Set event message in dol_events session object.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
getDolGlobalString($key, $default='')
Return a 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.