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";
44$langs->loadLangs(array(
"admin",
"ticket"));
52$value =
GETPOST(
'value',
'alpha');
53$action =
GETPOST(
'action',
'aZ09');
54$label =
GETPOST(
'label',
'alpha');
55$scandir =
GETPOST(
'scandir',
'alpha');
65if ($action ==
'setTICKET_ENABLE_PUBLIC_INTERFACE') {
73 $errors[] = $db->lasterror();
75} elseif ($action ==
'setvar') {
76 include_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
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);
83 $errors[] = $db->lasterror();
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);
92 $errors[] = $db->lasterror();
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);
104 $errors[] = $db->lasterror();
107 $text_home =
GETPOST(
'TICKET_PUBLIC_TEXT_HOME',
'restricthtml');
111 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HOME', $langs->trans(
'TicketPublicInterfaceTextHome'),
'chaine', 0,
'',
$conf->entity);
115 $errors[] = $db->lasterror();
118 $text_help =
GETPOST(
'TICKET_PUBLIC_TEXT_HELP_MESSAGE',
'restricthtml');
119 if (!empty($text_help)) {
122 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe'),
'chaine', 0,
'',
$conf->entity);
126 $errors[] = $db->lasterror();
129 $mail_new_ticket =
GETPOST(
'TICKET_MESSAGE_MAIL_NEW',
'restricthtml');
130 if (!empty($mail_new_ticket)) {
133 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_NEW', $langs->trans(
'TicketMessageMailNewText'),
'chaine', 0,
'',
$conf->entity);
137 $errors[] = $db->lasterror();
140 $url_interface =
GETPOST(
'TICKET_URL_PUBLIC_INTERFACE',
'alpha');
141 if (!empty($url_interface)) {
147 $url_interface = rtrim($url_interface,
'/').
'/';
154 $errors[] = $db->lasterror();
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);
161 $errors[] = $db->lasterror();
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);
170 $errors[] = $db->lasterror();
173} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
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);
188 if ($code ==
'TICKET_EMAIL_MUST_EXISTS') {
192 $errors[] = $db->lasterror();
194 } elseif ($code ==
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
198 $errors[] = $db->lasterror();
203} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
208 $errors[] = $db->lasterror();
215 setEventMessage($langs->trans(
'SetupSaved'));
216 header(
"Location: " . $_SERVER[
'PHP_SELF']);
220 setEventMessages(
'', $errors,
'errors');
229$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
231$form =
new Form($db);
234$help_url =
"FR:Module_Ticket";
235$page_name =
"TicketSetup";
236llxHeader(
'', $langs->trans($page_name), $help_url,
'', 0, 0,
'',
'',
'',
'mod-admin page-ticket_public');
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>';
246print
dol_get_fiche_head($head,
'public', $langs->trans(
"Module56000Name"), -1,
"ticket");
252$enabledisablehtml = $langs->trans(
"TicketsActivatePublicInterface").
' ';
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>';
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>';
264print $enabledisablehtml;
265print
'<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(!
getDolGlobalInt(
'TICKET_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).
'">';
277 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
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>';
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">';
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">';
300 print
'<td class="center width75">';
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');
313 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
315 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
319 $desc = $form->textwithpicto(
'', $langs->transnoentities(
"EnableGDLibraryDesc"), 1,
'warning');
323 print
'<td class="center width75">';
324 print $form->textwithpicto(
'', $langs->trans(
"TicketUseCaptchaCodeHelp"), 1,
'help');
329 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailMustExist").
'</td>';
330 print
'<td class="left">';
332 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' . img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
334 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' . img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
337 print
'<td class="center width75">';
338 print $form->textwithpicto(
'', $langs->trans(
"TicketsEmailMustExistHelp"), 1,
'help');
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');
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'));
370 print
'<td class="center width75">';
371 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyLogoHelp"), 1,
'help');
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');
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'));
385 print
'<td class="center width75">';
386 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyFooterHelp"), 1,
'help');
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');
397 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_SHOW_PROGRESSION&token='.newToken().
'">' . img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
399 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_SHOW_PROGRESSION&token='.newToken().
'">' . img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
403 print
'<td class="center width75">';
404 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowProgressionHelp"), 1,
'help');
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>';
415 print
'<td colspan="3"><div class="info">'.$langs->trans(
"TicketCkEditorEmailNotActivated").
'</div></td>';
421 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTopicLabelAdmin").
'</label>';
423 print
'<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.
'" size="40" ></td>';
425 print
'<td class="center width75">';
426 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTopicHelp"), 1,
'help');
430 $public_text_home =
getDolGlobalString(
'TICKET_PUBLIC_TEXT_HOME',
'<span class="opacitymedium">'.$langs->trans(
"TicketPublicDesc").
'</span>');
431 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHomeLabelAdmin").
'</label>';
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();
439 print
'<td class="center">';
440 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHomeHelpAdmin"), 1,
'help');
444 $public_text_help_message =
getDolGlobalString(
"TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe'));
445 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHelpMessageLabelAdmin").
'</label>';
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();
453 print
'<td class="center">';
454 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1,
'help');
479 print
'<tr class="oddeven"><td>'.$langs->trans(
"UrlPublicInterfaceLabelAdmin").
'</label>';
481 print
'<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.
'" placeholder="https://..."></td>';
483 print
'<td class="center">';
484 print $form->textwithpicto(
'', $langs->trans(
"UrlPublicInterfaceHelpAdmin"), 1,
'help');
495 print
'<div class="div-table-responsive-no-min">';
496 print
'<table class="noborder centpercent">';
498 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Emails").
'</td>';
499 print
'<td class="left">';
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');
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();
518 print
'<tr class="oddeven"><td>';
519 print $form->textwithpicto($langs->trans(
"TicketsPublicNotificationNewMessage"), $langs->trans(
"TicketsPublicNotificationNewMessageHelp"), 1,
'help');
521 print
'<td class="left">';
522 if (
$conf->use_javascript_ajax) {
523 print ajax_constantonoff(
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
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"));
532 print
'<tr class="oddeven"><td>';
533 print $form->textwithpicto($langs->trans(
"TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans(
"TicketPublicNotificationNewMessageDefaultEmailHelp"), 1,
'help');
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>';
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');
544 print
'<td class="left">';
545 if (!empty(
$conf->use_javascript_ajax)) {
546 print ajax_constantonoff(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
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'));
558 print $form->buttonsSaveCancel(
"Save",
'');
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.
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.
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.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.