25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
27 require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
28 require_once DOL_DOCUMENT_ROOT.
"/core/lib/ticket.lib.php";
31 $langs->loadLangs(array(
"admin",
"ticket"));
39 $value =
GETPOST(
'value',
'alpha');
40 $action =
GETPOST(
'action',
'aZ09');
41 $label =
GETPOST(
'label',
'alpha');
42 $scandir =
GETPOST(
'scandir',
'alpha');
52 if ($action ==
'setTICKET_ENABLE_PUBLIC_INTERFACE') {
54 $res =
dolibarr_set_const($db,
'TICKET_ENABLE_PUBLIC_INTERFACE', 1,
'chaine', 0,
'', $conf->entity);
56 $res =
dolibarr_set_const($db,
'TICKET_ENABLE_PUBLIC_INTERFACE', 0,
'chaine', 0,
'', $conf->entity);
60 $errors[] = $db->lasterror();
62 } elseif ($action ==
'setvar') {
63 include_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
66 $param_enable_public_interface =
GETPOST(
'TICKET_ENABLE_PUBLIC_INTERFACE',
'alpha');
67 $res =
dolibarr_set_const($db,
'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface,
'chaine', 0,
'', $conf->entity);
70 $errors[] = $db->lasterror();
75 $param_disable_email =
GETPOST(
'TICKET_DISABLE_CUSTOMER_MAILS',
'alpha');
76 $res =
dolibarr_set_const($db,
'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email,
'chaine', 0,
'', $conf->entity);
79 $errors[] = $db->lasterror();
84 $param_show_module_logo =
GETPOST(
'TICKET_SHOW_COMPANY_LOGO',
'alpha');
85 $res =
dolibarr_set_const($db,
'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo,
'chaine', 0,
'', $conf->entity);
88 $errors[] = $db->lasterror();
92 $topic_interface =
GETPOST(
'TICKET_PUBLIC_INTERFACE_TOPIC',
'alphanohtml');
93 if (!empty($topic_interface)) {
94 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface,
'chaine', 0,
'', $conf->entity);
96 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_INTERFACE_TOPIC',
'',
'chaine', 0,
'', $conf->entity);
100 $errors[] = $db->lasterror();
103 $text_home =
GETPOST(
'TICKET_PUBLIC_TEXT_HOME',
'restricthtml');
105 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HOME', $text_home,
'chaine', 0,
'', $conf->entity);
107 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HOME', $langs->trans(
'TicketPublicInterfaceTextHome'),
'chaine', 0,
'', $conf->entity);
111 $errors[] = $db->lasterror();
114 $text_help =
GETPOST(
'TICKET_PUBLIC_TEXT_HELP_MESSAGE',
'restricthtml');
115 if (!empty($text_help)) {
116 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help,
'chaine', 0,
'', $conf->entity);
118 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe'),
'chaine', 0,
'', $conf->entity);
122 $errors[] = $db->lasterror();
125 $mail_new_ticket =
GETPOST(
'TICKET_MESSAGE_MAIL_NEW',
'restricthtml');
126 if (!empty($mail_new_ticket)) {
127 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket,
'chaine', 0,
'', $conf->entity);
129 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_NEW', $langs->trans(
'TicketMessageMailNewText'),
'chaine', 0,
'', $conf->entity);
133 $errors[] = $db->lasterror();
136 $url_interface =
GETPOST(
'TICKET_URL_PUBLIC_INTERFACE',
'alpha');
137 if (!empty($url_interface)) {
138 $res =
dolibarr_set_const($db,
'TICKET_URL_PUBLIC_INTERFACE', $url_interface,
'chaine', 0,
'', $conf->entity);
140 $res =
dolibarr_set_const($db,
'TICKET_URL_PUBLIC_INTERFACE',
'',
'chaine', 0,
'', $conf->entity);
144 $errors[] = $db->lasterror();
147 $param_public_notification_new_message_default_email =
GETPOST(
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL',
'alpha');
148 $res =
dolibarr_set_const($db,
'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email,
'chaine', 0,
'', $conf->entity);
151 $errors[] = $db->lasterror();
155 if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($conf->use_javascript_ajax)) {
156 $param_notification_also_main_addressemail =
GETPOST(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS',
'alpha');
157 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail,
'chaine', 0,
'', $conf->entity);
160 $errors[] = $db->lasterror();
163 } elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
166 if ($code ==
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
167 $param_notification_also_main_addressemail =
GETPOST(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS',
'alpha');
168 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail,
'chaine', 0,
'', $conf->entity);
178 if ($code ==
'TICKET_EMAIL_MUST_EXISTS') {
179 $res =
dolibarr_del_const($db,
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
182 $errors[] = $db->lasterror();
184 } elseif ($code ==
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
188 $errors[] = $db->lasterror();
193 } elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
198 $errors[] = $db->lasterror();
206 header(
"Location: " . $_SERVER[
'PHP_SELF']);
219 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
224 $page_name =
"TicketSetup";
228 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
230 print
load_fiche_titre($langs->trans($page_name), $linkback,
'title_setup');
235 print
dol_get_fiche_head($head,
'public', $langs->trans(
"Module56000Name"), -1,
"ticket");
237 print
'<span class="opacitymedium">'.$langs->trans(
"TicketPublicAccess").
'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.
'/public/ticket/index.php?entity='.$conf->entity.
'" target="_blank" rel="noopener noreferrer">'.
dol_buildpath(
'/public/ticket/index.php?entity='.$conf->entity, 2).
'</a>';
243 $enabledisablehtml = $langs->trans(
"TicketsActivatePublicInterface").
' ';
244 if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
246 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.
newToken().
'&value=1'.$param.
'">';
247 $enabledisablehtml .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
248 $enabledisablehtml .=
'</a>';
251 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.
newToken().
'&value=0'.$param.
'">';
252 $enabledisablehtml .=
img_picto($langs->trans(
"Activated"),
'switch_on');
253 $enabledisablehtml .=
'</a>';
255 print $enabledisablehtml;
256 print
'<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).
'">';
260 if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
261 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'" enctype="multipart/form-data" >';
262 print
'<input type="hidden" name="token" value="'.newToken().
'">';
263 print
'<input type="hidden" name="action" value="setvar">';
265 print
'<div class="div-table-responsive-no-min">';
266 print
'<table class="noborder centpercent">';
267 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Parameters").
'</td>';
268 print
'<td class="left">';
270 print
'<td class="center width75">';
275 print
'<tr class="oddeven">';
276 print
'<td>'.$langs->trans(
"TicketUseCaptchaCode").
'</td>';
277 print
'<td class="left">';
278 if (function_exists(
"imagecreatefrompng")) {
279 if (!empty($conf->use_javascript_ajax)) {
282 if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) {
283 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
285 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
289 $desc =
$form->textwithpicto(
'', $langs->transnoentities(
"EnableGDLibraryDesc"), 1,
'warning');
293 print
'<td class="center width75">';
294 print
$form->textwithpicto(
'', $langs->trans(
"TicketUseCaptchaCodeHelp"), 1,
'help');
299 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailMustExist").
'</td>';
300 print
'<td class="left">';
302 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' .
img_picto($langs->trans(
'Disabled'),
'switch_off') .
'</a>';
304 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().
'">' .
img_picto($langs->trans(
'Enabled'),
'switch_on') .
'</a>';
307 print
'<td class="center width75">';
308 print
$form->textwithpicto(
'', $langs->trans(
"TicketsEmailMustExistHelp"), 1,
'help');
313 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketCreateThirdPartyWithContactIfNotExist").
'</td>';
314 print
'<td class="left">';
315 if (empty(
getDolGlobalInt(
'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
316 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>';
318 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>';
321 print
'<td class="center width75">';
322 print
$form->textwithpicto(
'', $langs->trans(
"TicketCreateThirdPartyWithContactIfNotExistHelp"), 1,
'help');
345 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsShowCompanyLogo").
'</td>';
346 print
'<td class="left">';
347 if ($conf->use_javascript_ajax) {
350 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
351 print
$form->selectarray(
"TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
354 print
'<td class="center width75">';
355 print
$form->textwithpicto(
'', $langs->trans(
"TicketsShowCompanyLogoHelp"), 1,
'help');
360 if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
361 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailAlsoSendToMainAddress").
'</td>';
362 print
'<td class="left">';
363 if ($conf->use_javascript_ajax) {
366 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
367 print
$form->selectarray(
"TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
370 print
'<td class="center width75">';
371 print
$form->textwithpicto(
'', $langs->trans(
"TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv(
"TicketEmailNotificationTo").
' ('.$langs->transnoentitiesnoconv(
"Creation").
')', $langs->trans(
"Settings")), 1,
'help');
376 if (!$conf->use_javascript_ajax) {
377 print
'<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></td>';
381 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
383 print
'<td colspan="3"><div class="info">'.$langs->trans(
"TicketCkEditorEmailNotActivated").
'</div></td>';
388 $url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
389 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTopicLabelAdmin").
'</label>';
391 print
'<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$conf->global->TICKET_PUBLIC_INTERFACE_TOPIC.
'" size="40" ></td>';
393 print
'<td class="center width75">';
394 print
$form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTopicHelp"), 1,
'help');
398 $public_text_home =
getDolGlobalString(
'TICKET_PUBLIC_TEXT_HOME',
'<span class="opacitymedium">'.$langs->trans(
"TicketPublicDesc").
'</span>');
399 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHomeLabelAdmin").
'</label>';
401 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
402 $doleditor =
new DolEditor(
'TICKET_PUBLIC_TEXT_HOME', $public_text_home,
'100%', 180,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
403 $doleditor->Create();
405 print
'<td class="center">';
406 print
$form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHomeHelpAdmin"), 1,
'help');
410 $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans(
'TicketPublicPleaseBeAccuratelyDescribe');
411 print
'<tr><td>'.$langs->trans(
"TicketPublicInterfaceTextHelpMessageLabelAdmin").
'</label>';
413 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
414 $doleditor =
new DolEditor(
'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message,
'100%', 180,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
415 $doleditor->Create();
417 print
'<td class="center">';
418 print
$form->textwithpicto(
'', $langs->trans(
"TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1,
'help');
422 $url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
423 print
'<tr><td>'.$langs->trans(
"TicketUrlPublicInterfaceLabelAdmin").
'</label>';
425 print
'<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.
'"></td>';
427 print
'<td class="center">';
428 print
$form->textwithpicto(
'', $langs->trans(
"TicketUrlPublicInterfaceHelpAdmin"), 1,
'help');
437 print
'<div class="div-table-responsive-no-min">';
438 print
'<table class="noborder centpercent">';
441 print
'<tr class="pair"><td>';
442 print
$form->textwithpicto($langs->trans(
"TicketsDisableCustomerEmail"), $langs->trans(
"TicketsDisableEmailHelp"), 1,
'help');
444 print
'<td class="left">';
445 if ($conf->use_javascript_ajax) {
448 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
449 print
$form->selectarray(
"TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
455 $mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans(
'TicketNewEmailBody');
457 print
$form->textwithpicto($langs->trans(
"TicketNewEmailBodyLabel"), $langs->trans(
"TicketNewEmailBodyHelp"), 1,
'help');
460 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
461 $doleditor =
new DolEditor(
'TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new,
'100%', 120,
'dolibarr_mailings',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
462 $doleditor->Create();
467 print
'<tr class="pair"><td>';
468 print
$form->textwithpicto($langs->trans(
"TicketsPublicNotificationNewMessage"), $langs->trans(
"TicketsPublicNotificationNewMessageHelp"), 1,
'help');
470 print
'<td class="left">';
471 if ($conf->use_javascript_ajax) {
474 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
475 print
$form->selectarray(
"TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED);
482 print
$form->textwithpicto($langs->trans(
"TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans(
"TicketPublicNotificationNewMessageDefaultEmailHelp"), 1,
'help');
484 print
'<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL.
'" size="40" ></td>';
491 print
$form->buttonsSaveCancel(
"Save",
'');
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
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).
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default= '')
Return dolibarr global constant string value.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
ticketAdminPrepareHead()
Build tabs for admin page.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix= '', $mode= '')
On/off button for constant.