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