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";
78 if (GETPOSTISSET(
'TICKET_ENABLE_PUBLIC_INTERFACE')) {
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();
87 if (GETPOSTISSET(
'TICKET_SHOW_COMPANY_LOGO')) {
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');
108 if (GETPOSTISSET(
'TICKET_PUBLIC_TEXT_HOME')) {
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)) {
148 $errors[] = $db->lasterror();
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);
155 $errors[] = $db->lasterror();
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);
164 $errors[] = $db->lasterror();
167} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
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);
182 if ($code ==
'TICKET_EMAIL_MUST_EXISTS') {
186 $errors[] = $db->lasterror();
188 } elseif ($code ==
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
192 $errors[] = $db->lasterror();
197} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
202 $errors[] = $db->lasterror();
210 header(
"Location: " . $_SERVER[
'PHP_SELF']);
223$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
225$form =
new Form($db);
228$help_url =
"FR:Module_Ticket";
229$page_name =
"TicketSetup";
230llxHeader(
'', $langs->trans($page_name), $help_url,
'', 0, 0,
'',
'',
'',
'mod-admin page-ticket_public');
233$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
240print
dol_get_fiche_head($head,
'public', $langs->trans(
"Module56000Name"), -1,
"ticket");
246$enabledisablehtml = $langs->trans(
"TicketsActivatePublicInterface").
' ';
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>';
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>';
258print $enabledisablehtml;
259print
'<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(!
getDolGlobalInt(
'TICKET_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).
'">';
270 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
271 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
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>';
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">';
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">';
294 print
'<td class="center width75">';
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');
307 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
309 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
313 $desc = $form->textwithpicto(
'', $langs->transnoentities(
"EnableGDLibraryDesc"), 1,
'warning');
317 print
'<td class="center width75">';
318 print $form->textwithpicto(
'', $langs->trans(
"TicketUseCaptchaCodeHelp"), 1,
'help');
323 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailMustExist").
'</td>';
324 print
'<td class="left">';
326 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' .
img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
328 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' .
img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
331 print
'<td class="center width75">';
332 print $form->textwithpicto(
'', $langs->trans(
"TicketsEmailMustExistHelp"), 1,
'help');
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');
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'));
364 print
'<td class="center width75">';
365 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyLogoHelp"), 1,
'help');
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');
375 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
376 print $form->selectarray(
"TICKET_SHOW_COMPANY_FOOTER", $arrval,
$conf->global->TICKET_SHOW_COMPANY_FOOTER);
379 print
'<td class="center width75">';
380 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyFooterHelp"), 1,
'help');
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');
391 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_SHOW_PROGRESSION&token='.newToken().
'">' .
img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
393 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_SHOW_PROGRESSION&token='.newToken().
'">' .
img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
397 print
'<td class="center width75">';
398 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowProgressionHelp"), 1,
'help');
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>';
409 print
'<td colspan="3"><div class="info">'.$langs->trans(
"TicketCkEditorEmailNotActivated").
'</div></td>';
415 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTopicLabelAdmin").
'</label>';
417 print
'<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.
'" size="40" ></td>';
419 print
'<td class="center width75">';
420 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTopicHelp"), 1,
'help');
424 $public_text_home =
getDolGlobalString(
'TICKET_PUBLIC_TEXT_HOME',
'<span class="opacitymedium">'.$langs->trans(
"TicketPublicDesc").
'</span>');
425 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHomeLabelAdmin").
'</label>';
427 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
428 $doleditor =
new DolEditor(
'TICKET_PUBLIC_TEXT_HOME', $public_text_home,
'100%', 180,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_TICKET'), ROWS_2,
'70');
429 $doleditor->Create();
431 print
'<td class="center">';
432 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHomeHelpAdmin"), 1,
'help');
436 $public_text_help_message =
getDolGlobalString(
"TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe'));
437 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHelpMessageLabelAdmin").
'</label>';
439 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
440 $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');
441 $doleditor->Create();
443 print
'<td class="center">';
444 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1,
'help');
469 print
'<tr class="oddeven"><td>'.$langs->trans(
"UrlPublicInterfaceLabelAdmin").
'</label>';
471 print
'<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.
'" placeholder="https://..."></td>';
473 print
'<td class="center">';
474 print $form->textwithpicto(
'', $langs->trans(
"UrlPublicInterfaceHelpAdmin"), 1,
'help');
485 print
'<div class="div-table-responsive-no-min">';
486 print
'<table class="noborder centpercent">';
488 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Emails").
'</td>';
489 print
'<td class="left">';
494 $mail_mesg_new =
getDolGlobalString(
"TICKET_MESSAGE_MAIL_NEW", $langs->trans(
'TicketNewEmailBody'));
495 print
'<tr class="oddeven"><td>';
496 print $form->textwithpicto($langs->trans(
"TicketNewEmailBodyLabel"), $langs->trans(
"TicketNewEmailBodyHelp"), 1,
'help');
499 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
500 $doleditor =
new DolEditor(
'TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new,
'100%', 120,
'dolibarr_mailings',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_MAIL'), ROWS_2,
'70');
501 $doleditor->Create();
506 print
'<tr class="oddeven"><td>';
507 print $form->textwithpicto($langs->trans(
"TicketsPublicNotificationNewMessage"), $langs->trans(
"TicketsPublicNotificationNewMessageHelp"), 1,
'help');
509 print
'<td class="left">';
510 if (
$conf->use_javascript_ajax) {
511 print ajax_constantonoff(
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
513 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
514 print $form->selectarray(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval,
getDolGlobalString(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
520 print
'<tr class="oddeven"><td>';
521 print $form->textwithpicto($langs->trans(
"TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans(
"TicketPublicNotificationNewMessageDefaultEmailHelp"), 1,
'help');
523 print
'<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").
'" size="40" ></td>';
529 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailAlsoSendToMainAddress");
530 print $form->textwithpicto(
'', $langs->trans(
"TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv(
"TicketEmailNotificationTo").
' ('.$langs->transnoentitiesnoconv(
"Creation").
')', $langs->trans(
"Settings")), 1,
'help');
532 print
'<td class="left">';
533 if (!empty(
$conf->use_javascript_ajax)) {
534 print ajax_constantonoff(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
536 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
537 print $form->selectarray(
"TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval,
getDolGlobalInt(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'));
546 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.