26require
'../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
28require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
29require_once DOL_DOCUMENT_ROOT.
"/core/lib/ticket.lib.php";
32$langs->loadLangs(array(
"admin",
"ticket"));
40$value =
GETPOST(
'value',
'alpha');
41$action =
GETPOST(
'action',
'aZ09');
42$label =
GETPOST(
'label',
'alpha');
43$scandir =
GETPOST(
'scandir',
'alpha');
53if ($action ==
'setTICKET_ENABLE_PUBLIC_INTERFACE') {
55 $res =
dolibarr_set_const($db,
'TICKET_ENABLE_PUBLIC_INTERFACE', 1,
'chaine', 0,
'', $conf->entity);
57 $res =
dolibarr_set_const($db,
'TICKET_ENABLE_PUBLIC_INTERFACE', 0,
'chaine', 0,
'', $conf->entity);
61 $errors[] = $db->lasterror();
63} elseif ($action ==
'setvar') {
64 include_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
66 if (GETPOSTISSET(
'TICKET_ENABLE_PUBLIC_INTERFACE')) {
67 $param_enable_public_interface =
GETPOST(
'TICKET_ENABLE_PUBLIC_INTERFACE',
'alpha');
68 $res =
dolibarr_set_const($db,
'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface,
'chaine', 0,
'', $conf->entity);
71 $errors[] = $db->lasterror();
75 if (GETPOSTISSET(
'TICKET_SHOW_COMPANY_LOGO')) {
76 $param_show_module_logo =
GETPOST(
'TICKET_SHOW_COMPANY_LOGO',
'alpha');
77 $res =
dolibarr_set_const($db,
'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo,
'chaine', 0,
'', $conf->entity);
80 $errors[] = $db->lasterror();
84 $topic_interface =
GETPOST(
'TICKET_PUBLIC_INTERFACE_TOPIC',
'alphanohtml');
85 if (!empty($topic_interface)) {
86 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface,
'chaine', 0,
'', $conf->entity);
88 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_INTERFACE_TOPIC',
'',
'chaine', 0,
'', $conf->entity);
92 $errors[] = $db->lasterror();
95 $text_home =
GETPOST(
'TICKET_PUBLIC_TEXT_HOME',
'restricthtml');
96 if (GETPOSTISSET(
'TICKET_PUBLIC_TEXT_HOME')) {
97 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HOME', $text_home,
'chaine', 0,
'', $conf->entity);
99 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HOME', $langs->trans(
'TicketPublicInterfaceTextHome'),
'chaine', 0,
'', $conf->entity);
103 $errors[] = $db->lasterror();
106 $text_help =
GETPOST(
'TICKET_PUBLIC_TEXT_HELP_MESSAGE',
'restricthtml');
107 if (!empty($text_help)) {
108 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help,
'chaine', 0,
'', $conf->entity);
110 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe'),
'chaine', 0,
'', $conf->entity);
114 $errors[] = $db->lasterror();
117 $mail_new_ticket =
GETPOST(
'TICKET_MESSAGE_MAIL_NEW',
'restricthtml');
118 if (!empty($mail_new_ticket)) {
119 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket,
'chaine', 0,
'', $conf->entity);
121 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_NEW', $langs->trans(
'TicketMessageMailNewText'),
'chaine', 0,
'', $conf->entity);
125 $errors[] = $db->lasterror();
128 $url_interface =
GETPOST(
'TICKET_URL_PUBLIC_INTERFACE',
'alpha');
129 if (!empty($url_interface)) {
130 $res =
dolibarr_set_const($db,
'TICKET_URL_PUBLIC_INTERFACE', $url_interface,
'chaine', 0,
'', $conf->entity);
132 $res =
dolibarr_set_const($db,
'TICKET_URL_PUBLIC_INTERFACE',
'',
'chaine', 0,
'', $conf->entity);
136 $errors[] = $db->lasterror();
139 $param_public_notification_new_message_default_email =
GETPOST(
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL',
'alpha');
140 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email,
'chaine', 0,
'', $conf->entity);
143 $errors[] = $db->lasterror();
147 if (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) {
148 $param_notification_also_main_addressemail =
GETPOST(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS',
'alpha');
149 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail,
'chaine', 0,
'', $conf->entity);
152 $errors[] = $db->lasterror();
155} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
157 $value = GETPOSTISSET($code) ?
GETPOSTINT($code) : 1;
158 if ($code ==
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') >= 2) {
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);
170 if ($code ==
'TICKET_EMAIL_MUST_EXISTS') {
171 $res =
dolibarr_del_const($db,
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
174 $errors[] = $db->lasterror();
176 } elseif ($code ==
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
180 $errors[] = $db->lasterror();
185} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
190 $errors[] = $db->lasterror();
198 header(
"Location: " . $_SERVER[
'PHP_SELF']);
211$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
213$form =
new Form($db);
215$help_url =
"FR:Module_Ticket";
216$page_name =
"TicketSetup";
217llxHeader(
'', $langs->trans($page_name), $help_url,
'', 0, 0,
'',
'',
'',
'mod-admin page-ticket_public');
220$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
227print
dol_get_fiche_head($head,
'public', $langs->trans(
"Module56000Name"), -1,
"ticket");
233$enabledisablehtml = $langs->trans(
"TicketsActivatePublicInterface").
' ';
236 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.
newToken().
'&value=1'.$param.
'">';
237 $enabledisablehtml .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
238 $enabledisablehtml .=
'</a>';
241 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.
newToken().
'&value=0'.$param.
'">';
242 $enabledisablehtml .=
img_picto($langs->trans(
"Activated"),
'switch_on');
243 $enabledisablehtml .=
'</a>';
245print $enabledisablehtml;
246print
'<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(!
getDolGlobalInt(
'TICKET_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).
'">';
257 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
258 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
261 print
'<span class="opacitymedium">'.$langs->trans(
"TicketPublicAccess").
'</span> :<br>';
262 print
'<div class="urllink">';
263 print
'<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.
'/public/ticket/index.php?entity='.$conf->entity.
'">';
264 print
'<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.
'/public/ticket/index.php?entity='.$conf->entity.
'">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
272 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'" enctype="multipart/form-data" >';
273 print
'<input type="hidden" name="token" value="'.newToken().
'">';
274 print
'<input type="hidden" name="action" value="setvar">';
276 print
'<div class="div-table-responsive-no-min">';
277 print
'<table class="noborder centpercent">';
278 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Parameters").
'</td>';
279 print
'<td class="left">';
281 print
'<td class="center width75">';
286 print
'<tr class="oddeven">';
287 print
'<td>'.$langs->trans(
"TicketUseCaptchaCode").
'</td>';
288 print
'<td class="left">';
289 if (function_exists(
"imagecreatefrompng")) {
290 if (!empty($conf->use_javascript_ajax)) {
291 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_TICKET');
294 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
296 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
300 $desc = $form->textwithpicto(
'', $langs->transnoentities(
"EnableGDLibraryDesc"), 1,
'warning');
304 print
'<td class="center width75">';
305 print $form->textwithpicto(
'', $langs->trans(
"TicketUseCaptchaCodeHelp"), 1,
'help');
310 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailMustExist").
'</td>';
311 print
'<td class="left">';
313 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' .
img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
315 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' .
img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
318 print
'<td class="center width75">';
319 print $form->textwithpicto(
'', $langs->trans(
"TicketsEmailMustExistHelp"), 1,
'help');
359 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsShowCompanyLogo").
'</td>';
360 print
'<td class="left">';
361 if (!empty($conf->use_javascript_ajax)) {
362 print ajax_constantonoff(
'TICKET_SHOW_COMPANY_LOGO');
364 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
365 print $form->selectarray(
"TICKET_SHOW_COMPANY_LOGO", $arrval,
getDolGlobalInt(
'TICKET_SHOW_COMPANY_LOGO'));
368 print
'<td class="center width75">';
369 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyLogoHelp"), 1,
'help');
374 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsShowCompanyFooter").
'</td>';
375 print
'<td class="left">';
376 if ($conf->use_javascript_ajax) {
377 print ajax_constantonoff(
'TICKET_SHOW_COMPANY_FOOTER');
379 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
380 print $form->selectarray(
"TICKET_SHOW_COMPANY_FOOTER", $arrval, $conf->global->TICKET_SHOW_COMPANY_FOOTER);
383 print
'<td class="center width75">';
384 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyFooterHelp"), 1,
'help');
389 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsShowProgression").
'</td>';
390 print
'<td class="left">';
391 if (!empty($conf->use_javascript_ajax)) {
392 print ajax_constantonoff(
'TICKET_SHOW_PROGRESSION');
395 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_SHOW_PROGRESSION&token='.newToken().
'">' .
img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
397 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_SHOW_PROGRESSION&token='.newToken().
'">' .
img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
401 print
'<td class="center width75">';
402 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowProgressionHelp"), 1,
'help');
406 if (empty($conf->use_javascript_ajax)) {
407 print
'<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></td>';
413 print
'<td colspan="3"><div class="info">'.$langs->trans(
"TicketCkEditorEmailNotActivated").
'</div></td>';
419 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTopicLabelAdmin").
'</label>';
421 print
'<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.
'" size="40" ></td>';
423 print
'<td class="center width75">';
424 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTopicHelp"), 1,
'help');
428 $public_text_home =
getDolGlobalString(
'TICKET_PUBLIC_TEXT_HOME',
'<span class="opacitymedium">'.$langs->trans(
"TicketPublicDesc").
'</span>');
429 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHomeLabelAdmin").
'</label>';
431 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
432 $doleditor =
new DolEditor(
'TICKET_PUBLIC_TEXT_HOME', $public_text_home,
'100%', 180,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
433 $doleditor->Create();
435 print
'<td class="center">';
436 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHomeHelpAdmin"), 1,
'help');
440 $public_text_help_message =
getDolGlobalString(
"TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe'));
441 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHelpMessageLabelAdmin").
'</label>';
443 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
444 $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);
445 $doleditor->Create();
447 print
'<td class="center">';
448 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1,
'help');
453 print
'<tr><td>'.$langs->trans(
"UrlPublicInterfaceLabelAdmin").
'</label>';
455 print
'<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.
'" placeholder="https://..."></td>';
457 print
'<td class="center">';
458 print $form->textwithpicto(
'', $langs->trans(
"UrlPublicInterfaceHelpAdmin"), 1,
'help');
467 print
'<div class="div-table-responsive-no-min">';
468 print
'<table class="noborder centpercent">';
471 $mail_mesg_new =
getDolGlobalString(
"TICKET_MESSAGE_MAIL_NEW", $langs->trans(
'TicketNewEmailBody'));
473 print $form->textwithpicto($langs->trans(
"TicketNewEmailBodyLabel"), $langs->trans(
"TicketNewEmailBodyHelp"), 1,
'help');
476 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
477 $doleditor =
new DolEditor(
'TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new,
'100%', 120,
'dolibarr_mailings',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
478 $doleditor->Create();
483 print
'<tr class="pair"><td>';
484 print $form->textwithpicto($langs->trans(
"TicketsPublicNotificationNewMessage"), $langs->trans(
"TicketsPublicNotificationNewMessageHelp"), 1,
'help');
486 print
'<td class="left">';
487 if ($conf->use_javascript_ajax) {
488 print ajax_constantonoff(
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
490 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
491 print $form->selectarray(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval,
getDolGlobalString(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
498 print $form->textwithpicto($langs->trans(
"TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans(
"TicketPublicNotificationNewMessageDefaultEmailHelp"), 1,
'help');
500 print
'<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").
'" size="40" ></td>';
506 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailAlsoSendToMainAddress");
507 print $form->textwithpicto(
'', $langs->trans(
"TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv(
"TicketEmailNotificationTo").
' ('.$langs->transnoentitiesnoconv(
"Creation").
')', $langs->trans(
"Settings")), 1,
'help');
509 print
'<td class="left">';
510 if (!empty($conf->use_javascript_ajax)) {
511 print ajax_constantonoff(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
513 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
514 print $form->selectarray(
"TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval,
getDolGlobalInt(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'));
523 print $form->buttonsSaveCancel(
"Save",
'');
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()
Empty header.
Class to manage a WYSIWYG editor.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return 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.