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_DISABLE_CUSTOMER_MAILS')) {
76 $param_disable_email =
GETPOST(
'TICKET_DISABLE_CUSTOMER_MAILS',
'alpha');
77 $res =
dolibarr_set_const($db,
'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email,
'chaine', 0,
'', $conf->entity);
80 $errors[] = $db->lasterror();
84 if (GETPOSTISSET(
'TICKET_SHOW_COMPANY_LOGO')) {
85 $param_show_module_logo =
GETPOST(
'TICKET_SHOW_COMPANY_LOGO',
'alpha');
86 $res =
dolibarr_set_const($db,
'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo,
'chaine', 0,
'', $conf->entity);
89 $errors[] = $db->lasterror();
93 $topic_interface =
GETPOST(
'TICKET_PUBLIC_INTERFACE_TOPIC',
'alphanohtml');
94 if (!empty($topic_interface)) {
95 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface,
'chaine', 0,
'', $conf->entity);
97 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_INTERFACE_TOPIC',
'',
'chaine', 0,
'', $conf->entity);
101 $errors[] = $db->lasterror();
104 $text_home =
GETPOST(
'TICKET_PUBLIC_TEXT_HOME',
'restricthtml');
105 if (GETPOSTISSET(
'TICKET_PUBLIC_TEXT_HOME')) {
106 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HOME', $text_home,
'chaine', 0,
'', $conf->entity);
108 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HOME', $langs->trans(
'TicketPublicInterfaceTextHome'),
'chaine', 0,
'', $conf->entity);
112 $errors[] = $db->lasterror();
115 $text_help =
GETPOST(
'TICKET_PUBLIC_TEXT_HELP_MESSAGE',
'restricthtml');
116 if (!empty($text_help)) {
117 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help,
'chaine', 0,
'', $conf->entity);
119 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe'),
'chaine', 0,
'', $conf->entity);
123 $errors[] = $db->lasterror();
126 $mail_new_ticket =
GETPOST(
'TICKET_MESSAGE_MAIL_NEW',
'restricthtml');
127 if (!empty($mail_new_ticket)) {
128 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket,
'chaine', 0,
'', $conf->entity);
130 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_NEW', $langs->trans(
'TicketMessageMailNewText'),
'chaine', 0,
'', $conf->entity);
134 $errors[] = $db->lasterror();
137 $url_interface =
GETPOST(
'TICKET_URL_PUBLIC_INTERFACE',
'alpha');
138 if (!empty($url_interface)) {
139 $res =
dolibarr_set_const($db,
'TICKET_URL_PUBLIC_INTERFACE', $url_interface,
'chaine', 0,
'', $conf->entity);
141 $res =
dolibarr_set_const($db,
'TICKET_URL_PUBLIC_INTERFACE',
'',
'chaine', 0,
'', $conf->entity);
145 $errors[] = $db->lasterror();
148 $param_public_notification_new_message_default_email =
GETPOST(
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL',
'alpha');
149 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email,
'chaine', 0,
'', $conf->entity);
152 $errors[] = $db->lasterror();
156 if (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) {
157 $param_notification_also_main_addressemail =
GETPOST(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS',
'alpha');
158 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail,
'chaine', 0,
'', $conf->entity);
161 $errors[] = $db->lasterror();
164} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
166 $value = GETPOSTISSET($code) ?
GETPOST($code,
'int') : 1;
167 if ($code ==
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') >= 2) {
168 $param_notification_also_main_addressemail =
GETPOST(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS',
'alpha');
169 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail,
'chaine', 0,
'', $conf->entity);
179 if ($code ==
'TICKET_EMAIL_MUST_EXISTS') {
180 $res =
dolibarr_del_const($db,
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
183 $errors[] = $db->lasterror();
185 } elseif ($code ==
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
189 $errors[] = $db->lasterror();
194} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
199 $errors[] = $db->lasterror();
207 header(
"Location: " . $_SERVER[
'PHP_SELF']);
220$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
222$form =
new Form($db);
224$help_url =
"FR:Module_Ticket";
225$page_name =
"TicketSetup";
226llxHeader(
'', $langs->trans($page_name), $help_url);
229$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
236print
dol_get_fiche_head($head,
'public', $langs->trans(
"Module56000Name"), -1,
"ticket");
242$enabledisablehtml = $langs->trans(
"TicketsActivatePublicInterface").
' ';
245 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().
'&value=1'.$param.
'">';
246 $enabledisablehtml .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
247 $enabledisablehtml .=
'</a>';
250 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().
'&value=0'.$param.
'">';
251 $enabledisablehtml .=
img_picto($langs->trans(
"Activated"),
'switch_on');
252 $enabledisablehtml .=
'</a>';
254print $enabledisablehtml;
255print
'<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(!
getDolGlobalInt(
'TICKET_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).
'">';
266 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
267 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
270 print
'<span class="opacitymedium">'.$langs->trans(
"TicketPublicAccess").
'</span> :<br>';
271 print
'<div class="urllink">';
272 print
'<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.
'/public/ticket/index.php?entity='.$conf->entity.
'">';
273 print
'<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.
'/public/ticket/index.php?entity='.$conf->entity.
'">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
281 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'" enctype="multipart/form-data" >';
282 print
'<input type="hidden" name="token" value="'.newToken().
'">';
283 print
'<input type="hidden" name="action" value="setvar">';
285 print
'<div class="div-table-responsive-no-min">';
286 print
'<table class="noborder centpercent">';
287 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Parameters").
'</td>';
288 print
'<td class="left">';
290 print
'<td class="center width75">';
295 print
'<tr class="oddeven">';
296 print
'<td>'.$langs->trans(
"TicketUseCaptchaCode").
'</td>';
297 print
'<td class="left">';
298 if (function_exists(
"imagecreatefrompng")) {
299 if (!empty($conf->use_javascript_ajax)) {
300 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_TICKET');
303 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
305 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
309 $desc = $form->textwithpicto(
'', $langs->transnoentities(
"EnableGDLibraryDesc"), 1,
'warning');
313 print
'<td class="center width75">';
314 print $form->textwithpicto(
'', $langs->trans(
"TicketUseCaptchaCodeHelp"), 1,
'help');
319 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailMustExist").
'</td>';
320 print
'<td class="left">';
322 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' .
img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
324 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' .
img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
327 print
'<td class="center width75">';
328 print $form->textwithpicto(
'', $langs->trans(
"TicketsEmailMustExistHelp"), 1,
'help');
368 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsShowCompanyLogo").
'</td>';
369 print
'<td class="left">';
370 if (!empty($conf->use_javascript_ajax)) {
371 print ajax_constantonoff(
'TICKET_SHOW_COMPANY_LOGO');
373 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
374 print $form->selectarray(
"TICKET_SHOW_COMPANY_LOGO", $arrval,
getDolGlobalInt(
'TICKET_SHOW_COMPANY_LOGO'));
377 print
'<td class="center width75">';
378 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyLogoHelp"), 1,
'help');
383 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsShowCompanyFooter").
'</td>';
384 print
'<td class="left">';
385 if ($conf->use_javascript_ajax) {
386 print ajax_constantonoff(
'TICKET_SHOW_COMPANY_FOOTER');
388 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
389 print $form->selectarray(
"TICKET_SHOW_COMPANY_FOOTER", $arrval, $conf->global->TICKET_SHOW_COMPANY_FOOTER);
392 print
'<td class="center width75">';
393 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyFooterHelp"), 1,
'help');
398 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsShowProgression").
'</td>';
399 print
'<td class="left">';
400 if (!empty($conf->use_javascript_ajax)) {
401 print ajax_constantonoff(
'TICKET_SHOW_PROGRESSION');
404 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_SHOW_PROGRESSION&token='.newToken().
'">' .
img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
406 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_SHOW_PROGRESSION&token='.newToken().
'">' .
img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
410 print
'<td class="center width75">';
411 print $form->textwithpicto(
'', $langs->trans(
"TicketsShowProgressionHelp"), 1,
'help');
417 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailAlsoSendToMainAddress").
'</td>';
418 print
'<td class="left">';
419 if (!empty($conf->use_javascript_ajax)) {
420 print ajax_constantonoff(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
422 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
423 print $form->selectarray(
"TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval,
getDolGlobalInt(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'));
426 print
'<td class="center width75">';
427 print $form->textwithpicto(
'', $langs->trans(
"TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv(
"TicketEmailNotificationTo").
' ('.$langs->transnoentitiesnoconv(
"Creation").
')', $langs->trans(
"Settings")), 1,
'help');
432 if (empty($conf->use_javascript_ajax)) {
433 print
'<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></td>';
439 print
'<td colspan="3"><div class="info">'.$langs->trans(
"TicketCkEditorEmailNotActivated").
'</div></td>';
445 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTopicLabelAdmin").
'</label>';
447 print
'<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.
'" size="40" ></td>';
449 print
'<td class="center width75">';
450 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTopicHelp"), 1,
'help');
454 $public_text_home =
getDolGlobalString(
'TICKET_PUBLIC_TEXT_HOME',
'<span class="opacitymedium">'.$langs->trans(
"TicketPublicDesc").
'</span>');
455 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHomeLabelAdmin").
'</label>';
457 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
458 $doleditor =
new DolEditor(
'TICKET_PUBLIC_TEXT_HOME', $public_text_home,
'100%', 180,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
459 $doleditor->Create();
461 print
'<td class="center">';
462 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHomeHelpAdmin"), 1,
'help');
466 $public_text_help_message =
getDolGlobalString(
"TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe'));
467 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHelpMessageLabelAdmin").
'</label>';
469 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
470 $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);
471 $doleditor->Create();
473 print
'<td class="center">';
474 print $form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1,
'help');
479 print
'<tr><td>'.$langs->trans(
"TicketUrlPublicInterfaceLabelAdmin").
'</label>';
481 print
'<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.
'"></td>';
483 print
'<td class="center">';
484 print $form->textwithpicto(
'', $langs->trans(
"TicketUrlPublicInterfaceHelpAdmin"), 1,
'help');
493 print
'<div class="div-table-responsive-no-min">';
494 print
'<table class="noborder centpercent">';
497 print
'<tr class="pair"><td>';
498 print $form->textwithpicto($langs->trans(
"TicketsDisableCustomerEmail"), $langs->trans(
"TicketsDisableEmailHelp"), 1,
'help');
500 print
'<td class="left">';
501 if ($conf->use_javascript_ajax) {
502 print ajax_constantonoff(
'TICKET_DISABLE_CUSTOMER_MAILS');
504 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
505 print $form->selectarray(
"TICKET_DISABLE_CUSTOMER_MAILS", $arrval,
getDolGlobalInt(
'TICKET_DISABLE_CUSTOMER_MAILS'));
511 $mail_mesg_new =
getDolGlobalString(
"TICKET_MESSAGE_MAIL_NEW", $langs->trans(
'TicketNewEmailBody'));
513 print $form->textwithpicto($langs->trans(
"TicketNewEmailBodyLabel"), $langs->trans(
"TicketNewEmailBodyHelp"), 1,
'help');
516 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
517 $doleditor =
new DolEditor(
'TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new,
'100%', 120,
'dolibarr_mailings',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
518 $doleditor->Create();
523 print
'<tr class="pair"><td>';
524 print $form->textwithpicto($langs->trans(
"TicketsPublicNotificationNewMessage"), $langs->trans(
"TicketsPublicNotificationNewMessageHelp"), 1,
'help');
526 print
'<td class="left">';
527 if ($conf->use_javascript_ajax) {
528 print ajax_constantonoff(
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
530 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
531 print $form->selectarray(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval,
getDolGlobalString(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
538 print $form->textwithpicto($langs->trans(
"TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans(
"TicketPublicNotificationNewMessageDefaultEmailHelp"), 1,
'help');
540 print
'<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").
'" size="40" ></td>';
547 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($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
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.