ticket_public.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <?php
  2. /* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
  3. * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file admin/ticket_public.php
  20. * \ingroup ticket
  21. * \brief Page to public interface of module Ticket
  22. */
  23. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
  25. require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
  26. require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
  27. // Load translation files required by the page
  28. $langs->loadLangs(array("admin", "ticket"));
  29. // Access control
  30. if (!$user->admin) {
  31. accessforbidden();
  32. }
  33. // Parameters
  34. $value = GETPOST('value', 'alpha');
  35. $action = GETPOST('action', 'aZ09');
  36. $label = GETPOST('label', 'alpha');
  37. $scandir = GETPOST('scandir', 'alpha');
  38. $type = 'ticket';
  39. /*
  40. * Actions
  41. */
  42. $error = 0;
  43. $errors = array();
  44. if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
  45. if (GETPOST('value')) {
  46. $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
  47. } else {
  48. $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
  49. }
  50. if (!($res > 0)) {
  51. $error++;
  52. $errors[] = $db->lasterror();
  53. }
  54. } elseif ($action == 'setvar') {
  55. include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
  56. if (GETPOSTISSET('TICKET_ENABLE_PUBLIC_INTERFACE')) { // only for no js case
  57. $param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
  58. $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
  59. if (!($res > 0)) {
  60. $error++;
  61. $errors[] = $db->lasterror();
  62. }
  63. }
  64. if (GETPOSTISSET('TICKET_DISABLE_CUSTOMER_MAILS')) { // only for no js case
  65. $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
  66. $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
  67. if (!($res > 0)) {
  68. $error++;
  69. $errors[] = $db->lasterror();
  70. }
  71. }
  72. if (GETPOSTISSET('TICKET_SHOW_COMPANY_LOGO')) { // only for no js case
  73. $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha');
  74. $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
  75. if (!($res > 0)) {
  76. $error++;
  77. $errors[] = $db->lasterror();
  78. }
  79. }
  80. $topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alphanohtml');
  81. if (!empty($topic_interface)) {
  82. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
  83. } else {
  84. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
  85. }
  86. if (!($res > 0)) {
  87. $error++;
  88. $errors[] = $db->lasterror();
  89. }
  90. $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
  91. if (GETPOSTISSET('TICKET_PUBLIC_TEXT_HOME')) {
  92. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
  93. } else {
  94. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
  95. }
  96. if (!($res > 0)) {
  97. $error++;
  98. $errors[] = $db->lasterror();
  99. }
  100. $text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'restricthtml');
  101. if (!empty($text_help)) {
  102. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
  103. } else {
  104. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
  105. }
  106. if (!($res > 0)) {
  107. $error++;
  108. $errors[] = $db->lasterror();
  109. }
  110. $mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'restricthtml');
  111. if (!empty($mail_new_ticket)) {
  112. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
  113. } else {
  114. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
  115. }
  116. if (!($res > 0)) {
  117. $error++;
  118. $errors[] = $db->lasterror();
  119. }
  120. $url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
  121. if (!empty($url_interface)) {
  122. $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
  123. } else {
  124. $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
  125. }
  126. if (!($res > 0)) {
  127. $error++;
  128. $errors[] = $db->lasterror();
  129. }
  130. $param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
  131. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
  132. if (!($res > 0)) {
  133. $error++;
  134. $errors[] = $db->lasterror();
  135. }
  136. // For compatibility when javascript is not enabled
  137. if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($conf->use_javascript_ajax)) {
  138. $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
  139. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
  140. if (!($res > 0)) {
  141. $error++;
  142. $errors[] = $db->lasterror();
  143. }
  144. }
  145. } elseif (preg_match('/set_(.*)/', $action, $reg)) {
  146. $code = $reg[1];
  147. $value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
  148. if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
  149. $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
  150. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
  151. if (!($res > 0)) {
  152. $error++;
  153. }
  154. } else {
  155. $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
  156. if (!($res > 0)) {
  157. $error++;
  158. }
  159. if (!$error) {
  160. if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
  161. $res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
  162. if (!($res > 0)) {
  163. $error++;
  164. $errors[] = $db->lasterror();
  165. }
  166. } elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
  167. $res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
  168. if (!($res > 0)) {
  169. $error++;
  170. $errors[] = $db->lasterror();
  171. }
  172. }
  173. }
  174. }
  175. } elseif (preg_match('/del_(.*)/', $action, $reg)) {
  176. $code = $reg[1];
  177. $res = dolibarr_del_const($db, $code, $conf->entity);
  178. if (!($res > 0)) {
  179. $error++;
  180. $errors[] = $db->lasterror();
  181. }
  182. }
  183. if ($action != '') {
  184. if (!$error) {
  185. $db->commit();
  186. setEventMessage($langs->trans('SetupSaved'));
  187. header("Location: " . $_SERVER['PHP_SELF']);
  188. exit;
  189. } else {
  190. $db->rollback();
  191. setEventMessages('', $errors, 'errors');
  192. }
  193. }
  194. /*
  195. * View
  196. */
  197. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  198. $form = new Form($db);
  199. $help_url = "FR:Module_Ticket";
  200. $page_name = "TicketSetup";
  201. llxHeader('', $langs->trans($page_name), $help_url);
  202. // Subheader
  203. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  204. print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
  205. // Configuration header
  206. $head = ticketAdminPrepareHead();
  207. print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
  208. 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>';
  209. print dol_get_fiche_end();
  210. $param = '';
  211. $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
  212. if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
  213. // Button off, click to enable
  214. $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
  215. $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
  216. $enabledisablehtml .= '</a>';
  217. } else {
  218. // Button on, click to disable
  219. $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
  220. $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
  221. $enabledisablehtml .= '</a>';
  222. }
  223. print $enabledisablehtml;
  224. print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">';
  225. print '<br><br>';
  226. if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
  227. print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
  228. print '<input type="hidden" name="token" value="'.newToken().'">';
  229. print '<input type="hidden" name="action" value="setvar">';
  230. print '<div class="div-table-responsive-no-min">';
  231. print '<table class="noborder centpercent">';
  232. print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
  233. print '<td class="left">';
  234. print '</td>';
  235. print '<td class="center width75">';
  236. print '</td>';
  237. print '</tr>';
  238. // Enable Captcha code
  239. print '<tr class="oddeven">';
  240. print '<td>'.$langs->trans("TicketUseCaptchaCode").'</td>';
  241. print '<td class="left">';
  242. if (function_exists("imagecreatefrompng")) {
  243. if (!empty($conf->use_javascript_ajax)) {
  244. print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA_TICKET');
  245. } else {
  246. if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) {
  247. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  248. } else {
  249. print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
  250. }
  251. }
  252. } else {
  253. $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning');
  254. print $desc;
  255. }
  256. print '</td>';
  257. print '<td class="center width75">';
  258. print $form->textwithpicto('', $langs->trans("TicketUseCaptchaCodeHelp"), 1, 'help');
  259. print '</td>';
  260. print '</tr>';
  261. // Check if email exists
  262. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
  263. print '<td class="left">';
  264. if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
  265. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
  266. } else {
  267. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
  268. }
  269. print '</td>';
  270. print '<td class="center width75">';
  271. print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
  272. print '</td>';
  273. print '</tr>';
  274. // Create third-party with contact if email not linked to a contact
  275. print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
  276. print '<td class="left">';
  277. if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
  278. 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>';
  279. } else {
  280. 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>';
  281. }
  282. print '</td>';
  283. print '<td class="center width75">';
  284. print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
  285. print '</td>';
  286. print '</tr>';
  287. /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
  288. {
  289. // Show logo for module
  290. print '<tr class="oddeven"><td>' . $langs->trans("TicketsShowModuleLogo") . '</td>';
  291. print '<td class="left">';
  292. if ($conf->use_javascript_ajax) {
  293. print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
  294. } else {
  295. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  296. print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
  297. }
  298. print '</td>';
  299. print '<td class="center">';
  300. print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
  301. print '</td>';
  302. print '</tr>';
  303. }*/
  304. // Show logo for company
  305. print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyLogo").'</td>';
  306. print '<td class="left">';
  307. if ($conf->use_javascript_ajax) {
  308. print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
  309. } else {
  310. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  311. print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
  312. }
  313. print '</td>';
  314. print '<td class="center width75">';
  315. print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
  316. print '</td>';
  317. print '</tr>';
  318. // Also send to main email address
  319. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  320. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
  321. print '<td class="left">';
  322. if ($conf->use_javascript_ajax) {
  323. print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
  324. } else {
  325. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  326. print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
  327. }
  328. print '</td>';
  329. print '<td class="center width75">';
  330. print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help');
  331. print '</td>';
  332. print '</tr>';
  333. }
  334. if (!$conf->use_javascript_ajax) {
  335. print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></td>';
  336. print '</tr>';
  337. }
  338. if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
  339. print '<tr>';
  340. print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
  341. print "</tr>\n";
  342. }
  343. // Interface topic
  344. $url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
  345. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
  346. print '</td><td>';
  347. print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$conf->global->TICKET_PUBLIC_INTERFACE_TOPIC.'" size="40" ></td>';
  348. print '</td>';
  349. print '<td class="center width75">';
  350. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
  351. print '</td></tr>';
  352. // Text on home page
  353. $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc").'</span>');
  354. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
  355. print '</td><td>';
  356. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  357. $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
  358. $doleditor->Create();
  359. print '</td>';
  360. print '<td class="center">';
  361. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
  362. print '</td></tr>';
  363. // Text to help to enter a ticket
  364. $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
  365. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
  366. print '</td><td>';
  367. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  368. $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);
  369. $doleditor->Create();
  370. print '</td>';
  371. print '<td class="center">';
  372. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
  373. print '</td></tr>';
  374. // Url public interface
  375. $url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
  376. print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
  377. print '</td><td>';
  378. print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'"></td>';
  379. print '</td>';
  380. print '<td class="center">';
  381. print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
  382. print '</td></tr>';
  383. print '</table>';
  384. print '<br><br>';
  385. print load_fiche_titre($langs->trans("Emails"));
  386. print '<div class="div-table-responsive-no-min">';
  387. print '<table class="noborder centpercent">';
  388. // Activate email creation to user
  389. print '<tr class="pair"><td>';
  390. print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
  391. print '</td>';
  392. print '<td class="left">';
  393. if ($conf->use_javascript_ajax) {
  394. print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
  395. } else {
  396. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  397. print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
  398. }
  399. print '</td>';
  400. print '</tr>';
  401. // Text of email after creatio of a ticket
  402. $mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
  403. print '<tr><td>';
  404. print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
  405. print '</label>';
  406. print '</td><td>';
  407. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  408. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
  409. $doleditor->Create();
  410. print '</td>';
  411. print '</tr>';
  412. // Activate email notification when a new message is added
  413. print '<tr class="pair"><td>';
  414. print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
  415. print '</td>';
  416. print '<td class="left">';
  417. if ($conf->use_javascript_ajax) {
  418. print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
  419. } else {
  420. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  421. print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED);
  422. }
  423. print '</td>';
  424. print '</tr>';
  425. // Send notification when a new message is added to a email if a user is not assigned to the ticket
  426. print '<tr><td>';
  427. print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
  428. print '</td><td>';
  429. 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>';
  430. print '</td>';
  431. print '</tr>';
  432. print '</table>';
  433. print '</div>';
  434. print $form->buttonsSaveCancel("Save", '');
  435. print '</form>';
  436. }
  437. // End of page
  438. llxFooter();
  439. $db->close();