ticket_public.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  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. // Load Dolibarr environment
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
  26. require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
  27. require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
  28. // Load translation files required by the page
  29. $langs->loadLangs(array("admin", "ticket"));
  30. // Access control
  31. if (!$user->admin) {
  32. accessforbidden();
  33. }
  34. // Parameters
  35. $value = GETPOST('value', 'alpha');
  36. $action = GETPOST('action', 'aZ09');
  37. $label = GETPOST('label', 'alpha');
  38. $scandir = GETPOST('scandir', 'alpha');
  39. $type = 'ticket';
  40. /*
  41. * Actions
  42. */
  43. $error = 0;
  44. $errors = array();
  45. if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
  46. if (GETPOST('value')) {
  47. $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
  48. } else {
  49. $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
  50. }
  51. if (!($res > 0)) {
  52. $error++;
  53. $errors[] = $db->lasterror();
  54. }
  55. } elseif ($action == 'setvar') {
  56. include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
  57. if (GETPOSTISSET('TICKET_ENABLE_PUBLIC_INTERFACE')) { // only for no js case
  58. $param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
  59. $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
  60. if (!($res > 0)) {
  61. $error++;
  62. $errors[] = $db->lasterror();
  63. }
  64. }
  65. if (GETPOSTISSET('TICKET_DISABLE_CUSTOMER_MAILS')) { // only for no js case
  66. $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
  67. $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
  68. if (!($res > 0)) {
  69. $error++;
  70. $errors[] = $db->lasterror();
  71. }
  72. }
  73. if (GETPOSTISSET('TICKET_SHOW_COMPANY_LOGO')) { // only for no js case
  74. $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha');
  75. $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
  76. if (!($res > 0)) {
  77. $error++;
  78. $errors[] = $db->lasterror();
  79. }
  80. }
  81. $topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alphanohtml');
  82. if (!empty($topic_interface)) {
  83. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
  84. } else {
  85. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
  86. }
  87. if (!($res > 0)) {
  88. $error++;
  89. $errors[] = $db->lasterror();
  90. }
  91. $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
  92. if (GETPOSTISSET('TICKET_PUBLIC_TEXT_HOME')) {
  93. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
  94. } else {
  95. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
  96. }
  97. if (!($res > 0)) {
  98. $error++;
  99. $errors[] = $db->lasterror();
  100. }
  101. $text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'restricthtml');
  102. if (!empty($text_help)) {
  103. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
  104. } else {
  105. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
  106. }
  107. if (!($res > 0)) {
  108. $error++;
  109. $errors[] = $db->lasterror();
  110. }
  111. $mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'restricthtml');
  112. if (!empty($mail_new_ticket)) {
  113. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
  114. } else {
  115. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
  116. }
  117. if (!($res > 0)) {
  118. $error++;
  119. $errors[] = $db->lasterror();
  120. }
  121. $url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
  122. if (!empty($url_interface)) {
  123. $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
  124. } else {
  125. $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
  126. }
  127. if (!($res > 0)) {
  128. $error++;
  129. $errors[] = $db->lasterror();
  130. }
  131. $param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
  132. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
  133. if (!($res > 0)) {
  134. $error++;
  135. $errors[] = $db->lasterror();
  136. }
  137. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  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. $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
  149. if (!($res > 0)) {
  150. $error++;
  151. $errors[] = $db->lasterror();
  152. }
  153. if (!$error) {
  154. if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
  155. $res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
  156. if (!($res > 0)) {
  157. $error++;
  158. $errors[] = $db->lasterror();
  159. }
  160. } elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
  161. $res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
  162. if (!($res > 0)) {
  163. $error++;
  164. $errors[] = $db->lasterror();
  165. }
  166. // enable captcha by default
  167. // TODO Add a visible option in this setup page for this
  168. $res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA_TICKET', 1, 'chaine', 0, '', $conf->entity);
  169. if (!($res > 0)) {
  170. $error++;
  171. $errors[] = $db->lasterror();
  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. $param = '';
  209. print '<br>';
  210. $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
  211. if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
  212. // Button off, click to enable
  213. $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
  214. $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
  215. $enabledisablehtml .= '</a>';
  216. } else {
  217. // Button on, click to disable
  218. $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
  219. $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
  220. $enabledisablehtml .= '</a>';
  221. }
  222. print $enabledisablehtml;
  223. print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">';
  224. print dol_get_fiche_end();
  225. if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
  226. print '<br>';
  227. // Define $urlwithroot
  228. $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
  229. $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
  230. //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
  231. print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> :<br>';
  232. print '<div class="urllink">';
  233. print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">';
  234. print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
  235. print '</div>';
  236. print ajax_autoselect('publicurlmember');
  237. print '<br><br>';
  238. print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
  239. print '<input type="hidden" name="token" value="'.newToken().'">';
  240. print '<input type="hidden" name="action" value="setvar">';
  241. print '<div class="div-table-responsive-no-min">';
  242. print '<table class="noborder centpercent">';
  243. print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
  244. print '<td class="left">';
  245. print '</td>';
  246. print '<td class="center width75">';
  247. print '</td>';
  248. print '</tr>';
  249. // Check if email exists
  250. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
  251. print '<td class="left">';
  252. if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
  253. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
  254. } else {
  255. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
  256. }
  257. print '</td>';
  258. print '<td class="center width75">';
  259. print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
  260. print '</td>';
  261. print '</tr>';
  262. // Create third-party with contact if email not linked to a contact
  263. print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
  264. print '<td class="left">';
  265. if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
  266. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
  267. } else {
  268. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
  269. }
  270. print '</td>';
  271. print '<td class="center width75">';
  272. print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
  273. print '</td>';
  274. print '</tr>';
  275. /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
  276. {
  277. // Show logo for module
  278. print '<tr class="oddeven"><td>' . $langs->trans("TicketsShowModuleLogo") . '</td>';
  279. print '<td class="left">';
  280. if ($conf->use_javascript_ajax) {
  281. print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
  282. } else {
  283. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  284. print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
  285. }
  286. print '</td>';
  287. print '<td class="center">';
  288. print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
  289. print '</td>';
  290. print '</tr>';
  291. }*/
  292. // Show logo for company
  293. print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyLogo").'</td>';
  294. print '<td class="left">';
  295. if ($conf->use_javascript_ajax) {
  296. print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
  297. } else {
  298. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  299. print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
  300. }
  301. print '</td>';
  302. print '<td class="center width75">';
  303. print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
  304. print '</td>';
  305. print '</tr>';
  306. // Also send to main email address
  307. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  308. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
  309. print '<td class="left">';
  310. if ($conf->use_javascript_ajax) {
  311. print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
  312. } else {
  313. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  314. print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
  315. }
  316. print '</td>';
  317. print '<td class="center width75">';
  318. print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help');
  319. print '</td>';
  320. print '</tr>';
  321. }
  322. if (!$conf->use_javascript_ajax) {
  323. print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></td>';
  324. print '</tr>';
  325. }
  326. if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
  327. print '<tr>';
  328. print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
  329. print "</tr>\n";
  330. }
  331. // Interface topic
  332. $url_interface = getDolGlobalString("TICKET_PUBLIC_INTERFACE_TOPIC");
  333. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
  334. print '</td><td>';
  335. print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.'" size="40" ></td>';
  336. print '</td>';
  337. print '<td class="center width75">';
  338. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
  339. print '</td></tr>';
  340. // Text on home page
  341. $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc").'</span>');
  342. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
  343. print '</td><td>';
  344. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  345. $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
  346. $doleditor->Create();
  347. print '</td>';
  348. print '<td class="center">';
  349. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
  350. print '</td></tr>';
  351. // Text to help to enter a ticket
  352. $public_text_help_message = getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'));
  353. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
  354. print '</td><td>';
  355. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  356. $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);
  357. $doleditor->Create();
  358. print '</td>';
  359. print '<td class="center">';
  360. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
  361. print '</td></tr>';
  362. // Url public interface
  363. $url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE");
  364. print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
  365. print '</td><td>';
  366. print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.'"></td>';
  367. print '</td>';
  368. print '<td class="center">';
  369. print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
  370. print '</td></tr>';
  371. print '</table>';
  372. print '<br><br>';
  373. print load_fiche_titre($langs->trans("Emails"));
  374. print '<div class="div-table-responsive-no-min">';
  375. print '<table class="noborder centpercent">';
  376. // Activate email creation to user
  377. print '<tr class="pair"><td>';
  378. print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
  379. print '</td>';
  380. print '<td class="left">';
  381. if ($conf->use_javascript_ajax) {
  382. print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
  383. } else {
  384. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  385. print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
  386. }
  387. print '</td>';
  388. print '</tr>';
  389. // Text of email after creatio of a ticket
  390. $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody'));
  391. print '<tr><td>';
  392. print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
  393. print '</label>';
  394. print '</td><td>';
  395. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  396. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
  397. $doleditor->Create();
  398. print '</td>';
  399. print '</tr>';
  400. // Activate email notification when a new message is added
  401. print '<tr class="pair"><td>';
  402. print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
  403. print '</td>';
  404. print '<td class="left">';
  405. if ($conf->use_javascript_ajax) {
  406. print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
  407. } else {
  408. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  409. print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
  410. }
  411. print '</td>';
  412. print '</tr>';
  413. // Send notification when a new message is added to a email if a user is not assigned to the ticket
  414. print '<tr><td>';
  415. print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
  416. print '</td><td>';
  417. print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").'" size="40" ></td>';
  418. print '</td>';
  419. print '</tr>';
  420. print '</table>';
  421. print '</div>';
  422. print $form->buttonsSaveCancel("Save", '');
  423. print '</form>';
  424. }
  425. // End of page
  426. llxFooter();
  427. $db->close();