dolibarr 25.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-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 // Most of the code concatenates the file name directly to this value (for example
143 // .'view.php' or .'css/styles.css.php'), so the stored value must end with a single
144 // slash. Without this, a value typed without the trailing slash builds ".../tldview.php"
145 // and a value typed with several builds ".../tld//view.php", which some reverse proxies
146 // and web application firewalls reject.
147 $url_interface = rtrim($url_interface, '/').'/';
148 $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
149 } else {
150 $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
151 }
152 if (!($res > 0)) {
153 $error++;
154 $errors[] = $db->lasterror();
155 }
156
157 $param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
158 $res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
159 if (!($res > 0)) {
160 $error++;
161 $errors[] = $db->lasterror();
162 }
163
164 // For compatibility when javascript is not enabled
165 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) {
166 $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
167 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
168 if (!($res > 0)) {
169 $error++;
170 $errors[] = $db->lasterror();
171 }
172 }
173} elseif (preg_match('/set_(.*)/', $action, $reg)) {
174 $code = $reg[1];
175 $value = GETPOSTISSET($code) ? GETPOSTINT($code) : 1;
176 if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
177 $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
178 $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
179 if (!($res > 0)) {
180 $error++;
181 }
182 } else {
183 $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
184 if (!($res > 0)) {
185 $error++;
186 }
187 if (!$error) {
188 if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
189 $res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
190 if (!($res > 0)) {
191 $error++;
192 $errors[] = $db->lasterror();
193 }
194 } elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
195 $res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
196 if (!($res > 0)) {
197 $error++;
198 $errors[] = $db->lasterror();
199 }
200 }
201 }
202 }
203} elseif (preg_match('/del_(.*)/', $action, $reg)) {
204 $code = $reg[1];
205 $res = dolibarr_del_const($db, $code, $conf->entity);
206 if (!($res > 0)) {
207 $error++;
208 $errors[] = $db->lasterror();
209 }
210}
211
212if ($action != '') {
213 if (!$error) {
214 $db->commit();
215 setEventMessage($langs->trans('SetupSaved'));
216 header("Location: " . $_SERVER['PHP_SELF']);
217 exit;
218 } else {
219 $db->rollback();
220 setEventMessages('', $errors, 'errors');
221 }
222}
223
224
225/*
226 * View
227 */
228
229$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
230
231$form = new Form($db);
232$formcategory = new FormCategory($db);
233
234$help_url = "FR:Module_Ticket";
235$page_name = "TicketSetup";
236llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-admin page-ticket_public');
237
238// Subheader
239$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>';
240
241print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
242
243// Configuration header
244$head = ticketAdminPrepareHead();
245
246print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
247
248$param = '';
249
250print '<br>';
251
252$enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
253if (!getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
254 // Button off, click to enable
255 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
256 $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
257 $enabledisablehtml .= '</a>';
258} else {
259 // Button on, click to disable
260 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
261 $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
262 $enabledisablehtml .= '</a>';
263}
264print $enabledisablehtml;
265print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(!getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).'">';
266
267print dol_get_fiche_end();
268
269
270
271if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
272 print '<br>';
273
274
275 // Define $urlwithroot
276 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
277 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
278 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
279
280 print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> :<br>';
281 print '<div class="urllink">';
282 print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">';
283 print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
284 print '</div>';
285 print ajax_autoselect('publicurlmember');
286
287
288 print '<br><br>';
289
290
291 print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" spellcheck="false">';
292 print '<input type="hidden" name="token" value="'.newToken().'">';
293 print '<input type="hidden" name="action" value="setvar">';
294
295 print '<div class="div-table-responsive-no-min">';
296 print '<table class="noborder centpercent">';
297 print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
298 print '<td class="left">';
299 print '</td>';
300 print '<td class="center width75">';
301 print '</td>';
302 print '</tr>';
303
304 // Enable Captcha code
305 print '<tr class="oddeven">';
306 print '<td>'.$langs->trans("TicketUseCaptchaCode").'</td>';
307 print '<td class="left">';
308 if (function_exists("imagecreatefrompng")) {
309 if (!empty($conf->use_javascript_ajax)) {
310 print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA_TICKET');
311 } else {
312 if (!getDolGlobalInt('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) {
313 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
314 } else {
315 print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
316 }
317 }
318 } else {
319 $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning');
320 print $desc;
321 }
322 print '</td>';
323 print '<td class="center width75">';
324 print $form->textwithpicto('', $langs->trans("TicketUseCaptchaCodeHelp"), 1, 'help');
325 print '</td>';
326 print '</tr>';
327
328 // Check if email exists
329 print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
330 print '<td class="left">';
331 if (!getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS')) {
332 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
333 } else {
334 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
335 }
336 print '</td>';
337 print '<td class="center width75">';
338 print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
339 print '</td>';
340 print '</tr>';
341
342 // Auto fill the contact found from email
343 // 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.
344 /*
345 print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
346 print '<td class="left">';
347 if (!getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST')) {
348 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>';
349 } else {
350 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>';
351 }
352 print '</td>';
353 print '<td class="center width75">';
354 print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
355 print '</td>';
356 print '</tr>';
357 */
358
359
360 // Show logo for company
361 print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyLogo").'</td>';
362 print '<td class="left">';
363 if (!empty($conf->use_javascript_ajax)) {
364 print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
365 } else {
366 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
367 print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO'));
368 }
369 print '</td>';
370 print '<td class="center width75">';
371 print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
372 print '</td>';
373 print '</tr>';
374
375 // show footer for company
376 print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyFooter").'</td>';
377 print '<td class="left">';
378 if ($conf->use_javascript_ajax) {
379 print ajax_constantonoff('TICKET_SHOW_COMPANY_FOOTER');
380 } else {
381 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
382 print $form->selectarray("TICKET_SHOW_COMPANY_FOOTER", $arrval, getDolGlobalString('TICKET_SHOW_COMPANY_FOOTER'));
383 }
384 print '</td>';
385 print '<td class="center width75">';
386 print $form->textwithpicto('', $langs->trans("TicketsShowCompanyFooterHelp"), 1, 'help');
387 print '</td>';
388 print '</tr>';
389
390 // Show progression
391 print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowProgression").'</td>';
392 print '<td class="left">';
393 if (!empty($conf->use_javascript_ajax)) {
394 print ajax_constantonoff('TICKET_SHOW_PROGRESSION');
395 } else {
396 if (!getDolGlobalInt('TICKET_SHOW_PROGRESSION')) {
397 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_SHOW_PROGRESSION&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
398 } else {
399 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_SHOW_PROGRESSION&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
400 }
401 }
402 print '</td>';
403 print '<td class="center width75">';
404 print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help');
405 print '</td>';
406 print '</tr>';
407
408 if (empty($conf->use_javascript_ajax)) {
409 print '<tr><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></td>';
410 print '</tr>';
411 }
412
413 if (!getDolGlobalInt('FCKEDITOR_ENABLE_MAIL')) {
414 print '<tr>';
415 print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
416 print "</tr>\n";
417 }
418
419 // Interface topic
420 $url_interface = getDolGlobalString("TICKET_PUBLIC_INTERFACE_TOPIC");
421 print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
422 print '</td><td>';
423 print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.'" size="40" ></td>';
424 print '</td>';
425 print '<td class="center width75">';
426 print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
427 print '</td></tr>';
428
429 // Text on home page
430 $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc").'</span>');
431 print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
432 print '</td><td>';
433 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
434 $uselocalbrowser = false;
435 $ckeditorenabledforticket = true;
436 $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, $uselocalbrowser, $ckeditorenabledforticket, ROWS_2, '70');
437 $doleditor->Create();
438 print '</td>';
439 print '<td class="center">';
440 print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
441 print '</td></tr>';
442
443 // Text to help to enter a ticket
444 $public_text_help_message = getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'));
445 print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
446 print '</td><td>';
447 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
448 $uselocalbrowser = false;
449 $ckeditorenabledforticket = true;
450 $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, $uselocalbrowser, $ckeditorenabledforticket, ROWS_2, '70');
451 $doleditor->Create();
452 print '</td>';
453 print '<td class="center">';
454 print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
455 print '</td></tr>';
456
457 // Add first contact id found in database from submitter email entered into public interface
458 // 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
459 // email decided by the submiter allows anybody to get information on any contact (customer or supplier) in Dolibarr database.
460 // He can even check if contact exists by trying any email if this feature is enabled.
461 /*
462 print '<tr class="oddeven"><td>'.$langs->trans("TicketAssignContactToMessage").'</td>';
463 print '<td class="left">';
464 if ($conf->use_javascript_ajax) {
465 print ajax_constantonoff('TICKET_ASSIGN_CONTACT_TO_MESSAGE');
466 } else {
467 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
468 print $formcategory->selectarray("TICKET_ASSIGN_CONTACT_TO_MESSAGE", $arrval, getDolGlobalString('TICKET_ASSIGN_CONTACT_TO_MESSAGE'));
469 }
470 print '</td>';
471 print '<td class="center">';
472 print $formcategory->textwithpicto('', $langs->trans("TicketAssignContactToMessageHelp"), 1, 'help');
473 print '</td>';
474 print '</tr>';
475 */
476
477 // Url public interface
478 $url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE");
479 print '<tr class="oddeven"><td>'.$langs->trans("UrlPublicInterfaceLabelAdmin").'</label>';
480 print '</td><td>';
481 print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.'" placeholder="https://..."></td>';
482 print '</td>';
483 print '<td class="center">';
484 print $form->textwithpicto('', $langs->trans("UrlPublicInterfaceHelpAdmin"), 1, 'help');
485 print '</td></tr>';
486
487 print '</table>';
488
489
490 print '<br><br>';
491
492
493 //print load_fiche_titre($langs->trans("Emails"));
494
495 print '<div class="div-table-responsive-no-min">';
496 print '<table class="noborder centpercent">';
497
498 print '<tr class="liste_titre"><td>'.$langs->trans("Emails").'</td>';
499 print '<td class="left">';
500 print '</td>';
501 print '</tr>';
502
503 // Text of email after creatio of a ticket
504 $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody'));
505 print '<tr class="oddeven"><td>';
506 print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
507 print '</label>';
508 print '</td><td>';
509 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
510 $uselocalbrowser = false;
511 $ckeditorenabledforticket = getDolGlobalInt('FCKEDITOR_ENABLE_MAIL') ? true : false;
512 $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, $uselocalbrowser, $ckeditorenabledforticket, ROWS_2, '70');
513 $doleditor->Create();
514 print '</td>';
515 print '</tr>';
516
517 // Activate email notification when a new message is added
518 print '<tr class="oddeven"><td>';
519 print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
520 print '</td>';
521 print '<td class="left">';
522 if ($conf->use_javascript_ajax) {
523 print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
524 } else {
525 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
526 print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
527 }
528 print '</td>';
529 print '</tr>';
530
531 // Send notification when a new message is added to a email if a user is not assigned to the ticket
532 print '<tr class="oddeven"><td>';
533 print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
534 print '</td><td>';
535 print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").'" size="40" ></td>';
536 print '</td>';
537 print '</tr>';
538
539 // Also send to main email address
540 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
541 print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress");
542 print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help');
543 print '</td>';
544 print '<td class="left">';
545 if (!empty($conf->use_javascript_ajax)) {
546 print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
547 } else {
548 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
549 print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'));
550 }
551 print '</td>';
552 print '</tr>';
553 }
554
555 print '</table>';
556 print '</div>';
557
558 print $form->buttonsSaveCancel("Save", '');
559
560 print '</form>';
561}
562
563// End of page
564llxFooter();
565$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
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 a Dolibarr global constant string value.
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.
Definition html.lib.php:542
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:740
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.