ticket_public.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  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', 'nohtml');
  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 (!empty($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. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  137. $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
  138. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
  139. if (!($res > 0)) {
  140. $error++;
  141. $errors[] = $db->lasterror();
  142. }
  143. }
  144. } elseif (preg_match('/set_(.*)/', $action, $reg)) {
  145. $code = $reg[1];
  146. $value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
  147. $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
  148. if (!($res > 0)) {
  149. $error++;
  150. $errors[] = $db->lasterror();
  151. }
  152. if (!$error) {
  153. if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
  154. $res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
  155. if (!($res > 0)) {
  156. $error++;
  157. $errors[] = $db->lasterror();
  158. }
  159. } elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
  160. $res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
  161. if (!($res > 0)) {
  162. $error++;
  163. $errors[] = $db->lasterror();
  164. }
  165. // enable captcha by default
  166. $res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA', 1, 'chaine', 0, '', $conf->entity);
  167. if (!($res > 0)) {
  168. $error++;
  169. $errors[] = $db->lasterror();
  170. }
  171. }
  172. }
  173. } elseif (preg_match('/del_(.*)/', $action, $reg)) {
  174. $code = $reg[1];
  175. $res = dolibarr_del_const($db, $code, $conf->entity);
  176. if (!($res > 0)) {
  177. $error++;
  178. $errors[] = $db->lasterror();
  179. }
  180. }
  181. if ($action != '') {
  182. if (!$error) {
  183. $db->commit();
  184. setEventMessage($langs->trans('SetupSaved'));
  185. header("Location: " . $_SERVER['PHP_SELF']);
  186. exit;
  187. } else {
  188. $db->rollback();
  189. setEventMessages('', $errors, 'errors');
  190. }
  191. }
  192. /*
  193. * View
  194. */
  195. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  196. $form = new Form($db);
  197. $help_url = "FR:Module_Ticket";
  198. $page_name = "TicketSetup";
  199. llxHeader('', $langs->trans($page_name), $help_url);
  200. // Subheader
  201. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  202. print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
  203. // Configuration header
  204. $head = ticketAdminPrepareHead();
  205. print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
  206. 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>';
  207. print dol_get_fiche_end();
  208. $param = '';
  209. $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
  210. if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
  211. // Button off, click to enable
  212. $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
  213. $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
  214. $enabledisablehtml .= '</a>';
  215. } else {
  216. // Button on, click to disable
  217. $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
  218. $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
  219. $enabledisablehtml .= '</a>';
  220. }
  221. print $enabledisablehtml;
  222. print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">';
  223. print '<br><br>';
  224. if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
  225. print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
  226. print '<input type="hidden" name="token" value="'.newToken().'">';
  227. print '<input type="hidden" name="action" value="setvar">';
  228. print '<div class="div-table-responsive-no-min">';
  229. print '<table class="noborder centpercent">';
  230. print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
  231. print '<td class="left">';
  232. print '</td>';
  233. print '<td class="center width75">';
  234. print '</td>';
  235. print '</tr>';
  236. // Check if email exists
  237. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
  238. print '<td class="left">';
  239. if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
  240. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
  241. } else {
  242. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
  243. }
  244. print '</td>';
  245. print '<td class="center width75">';
  246. print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
  247. print '</td>';
  248. print '</tr>';
  249. // Create third-party with contact if email not linked to a contact
  250. print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
  251. print '<td class="left">';
  252. if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
  253. 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>';
  254. } else {
  255. 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>';
  256. }
  257. print '</td>';
  258. print '<td class="center width75">';
  259. print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
  260. print '</td>';
  261. print '</tr>';
  262. /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
  263. {
  264. // Show logo for module
  265. print '<tr class="oddeven"><td>' . $langs->trans("TicketsShowModuleLogo") . '</td>';
  266. print '<td class="left">';
  267. if ($conf->use_javascript_ajax) {
  268. print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
  269. } else {
  270. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  271. print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
  272. }
  273. print '</td>';
  274. print '<td class="center">';
  275. print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
  276. print '</td>';
  277. print '</tr>';
  278. }*/
  279. // Show logo for company
  280. print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyLogo").'</td>';
  281. print '<td class="left">';
  282. if ($conf->use_javascript_ajax) {
  283. print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
  284. } else {
  285. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  286. print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
  287. }
  288. print '</td>';
  289. print '<td class="center width75">';
  290. print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
  291. print '</td>';
  292. print '</tr>';
  293. // Also send to main email address
  294. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  295. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
  296. print '<td class="left">';
  297. if ($conf->use_javascript_ajax) {
  298. print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
  299. } else {
  300. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  301. print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
  302. }
  303. print '</td>';
  304. print '<td class="center width75">';
  305. print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help');
  306. print '</td>';
  307. print '</tr>';
  308. }
  309. if (!$conf->use_javascript_ajax) {
  310. print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></td>';
  311. print '</tr>';
  312. }
  313. if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
  314. print '<tr>';
  315. print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
  316. print "</tr>\n";
  317. }
  318. // Interface topic
  319. $url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
  320. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
  321. print '</td><td>';
  322. print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$conf->global->TICKET_PUBLIC_INTERFACE_TOPIC.'" size="40" ></td>';
  323. print '</td>';
  324. print '<td class="center width75">';
  325. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
  326. print '</td></tr>';
  327. // Texte d'accueil homepage
  328. $public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
  329. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
  330. print '</td><td>';
  331. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  332. $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
  333. $doleditor->Create();
  334. print '</td>';
  335. print '<td class="center">';
  336. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
  337. print '</td></tr>';
  338. // Texte d'aide à la saisie du message
  339. $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
  340. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
  341. print '</td><td>';
  342. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  343. $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
  344. $doleditor->Create();
  345. print '</td>';
  346. print '<td class="center">';
  347. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
  348. print '</td></tr>';
  349. // Url public interface
  350. $url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
  351. print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
  352. print '</td><td>';
  353. print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'"></td>';
  354. print '</td>';
  355. print '<td class="center">';
  356. print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
  357. print '</td></tr>';
  358. print '</table>';
  359. print '<br><br>';
  360. print load_fiche_titre($langs->trans("Emails"));
  361. print '<div class="div-table-responsive-no-min">';
  362. print '<table class="noborder centpercent">';
  363. // Activate email creation to user
  364. print '<tr class="pair"><td>';
  365. print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
  366. print '</td>';
  367. print '<td class="left">';
  368. if ($conf->use_javascript_ajax) {
  369. print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
  370. } else {
  371. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  372. print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
  373. }
  374. print '</td>';
  375. print '</tr>';
  376. // Text of email after creatio of a ticket
  377. $mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
  378. print '<tr><td>';
  379. print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
  380. print '</label>';
  381. print '</td><td>';
  382. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  383. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
  384. $doleditor->Create();
  385. print '</td>';
  386. print '</tr>';
  387. // Activate email notification when a new message is added
  388. print '<tr class="pair"><td>';
  389. print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
  390. print '</td>';
  391. print '<td class="left">';
  392. if ($conf->use_javascript_ajax) {
  393. print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
  394. } else {
  395. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  396. print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED);
  397. }
  398. print '</td>';
  399. print '</tr>';
  400. // Send notification when a new message is added to a email if a user is not assigned to the ticket
  401. print '<tr><td>';
  402. print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
  403. print '</td><td>';
  404. 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>';
  405. print '</td>';
  406. print '</tr>';
  407. print '</table>';
  408. print '</div>';
  409. print $form->buttonsSaveCancel("Save", '');
  410. print '</form>';
  411. }
  412. // End of page
  413. llxFooter();
  414. $db->close();