ticket_public.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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. // For compatibility when javascript is not enabled
  138. if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) {
  139. $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
  140. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
  141. if (!($res > 0)) {
  142. $error++;
  143. $errors[] = $db->lasterror();
  144. }
  145. }
  146. } elseif (preg_match('/set_(.*)/', $action, $reg)) {
  147. $code = $reg[1];
  148. $value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
  149. if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
  150. $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
  151. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
  152. if (!($res > 0)) {
  153. $error++;
  154. }
  155. } else {
  156. $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
  157. if (!($res > 0)) {
  158. $error++;
  159. }
  160. if (!$error) {
  161. if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
  162. $res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
  163. if (!($res > 0)) {
  164. $error++;
  165. $errors[] = $db->lasterror();
  166. }
  167. } elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
  168. $res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
  169. if (!($res > 0)) {
  170. $error++;
  171. $errors[] = $db->lasterror();
  172. }
  173. }
  174. }
  175. }
  176. } elseif (preg_match('/del_(.*)/', $action, $reg)) {
  177. $code = $reg[1];
  178. $res = dolibarr_del_const($db, $code, $conf->entity);
  179. if (!($res > 0)) {
  180. $error++;
  181. $errors[] = $db->lasterror();
  182. }
  183. }
  184. if ($action != '') {
  185. if (!$error) {
  186. $db->commit();
  187. setEventMessage($langs->trans('SetupSaved'));
  188. header("Location: " . $_SERVER['PHP_SELF']);
  189. exit;
  190. } else {
  191. $db->rollback();
  192. setEventMessages('', $errors, 'errors');
  193. }
  194. }
  195. /*
  196. * View
  197. */
  198. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  199. $form = new Form($db);
  200. $help_url = "FR:Module_Ticket";
  201. $page_name = "TicketSetup";
  202. llxHeader('', $langs->trans($page_name), $help_url);
  203. // Subheader
  204. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  205. print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
  206. // Configuration header
  207. $head = ticketAdminPrepareHead();
  208. print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
  209. $param = '';
  210. print '<br>';
  211. $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
  212. if (!getDolGlobalInt('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="'.(!getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).'">';
  225. print dol_get_fiche_end();
  226. if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
  227. print '<br>';
  228. // Define $urlwithroot
  229. $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
  230. $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
  231. //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
  232. print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> :<br>';
  233. print '<div class="urllink">';
  234. print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">';
  235. print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
  236. print '</div>';
  237. print ajax_autoselect('publicurlmember');
  238. print '<br><br>';
  239. print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
  240. print '<input type="hidden" name="token" value="'.newToken().'">';
  241. print '<input type="hidden" name="action" value="setvar">';
  242. print '<div class="div-table-responsive-no-min">';
  243. print '<table class="noborder centpercent">';
  244. print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
  245. print '<td class="left">';
  246. print '</td>';
  247. print '<td class="center width75">';
  248. print '</td>';
  249. print '</tr>';
  250. // Enable Captcha code
  251. print '<tr class="oddeven">';
  252. print '<td>'.$langs->trans("TicketUseCaptchaCode").'</td>';
  253. print '<td class="left">';
  254. if (function_exists("imagecreatefrompng")) {
  255. if (!empty($conf->use_javascript_ajax)) {
  256. print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA_TICKET');
  257. } else {
  258. if (!getDolGlobalInt('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) {
  259. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  260. } else {
  261. print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
  262. }
  263. }
  264. } else {
  265. $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning');
  266. print $desc;
  267. }
  268. print '</td>';
  269. print '<td class="center width75">';
  270. print $form->textwithpicto('', $langs->trans("TicketUseCaptchaCodeHelp"), 1, 'help');
  271. print '</td>';
  272. print '</tr>';
  273. // Check if email exists
  274. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
  275. print '<td class="left">';
  276. if (!getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS')) {
  277. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
  278. } else {
  279. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
  280. }
  281. print '</td>';
  282. print '<td class="center width75">';
  283. print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
  284. print '</td>';
  285. print '</tr>';
  286. // Auto fill the contact found from email
  287. // This option is a serious security hole. it allows to any non logged perso, to get the database of contacts or to check if an email is a customer or not. We must keep it as hidden option only.
  288. /*
  289. print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
  290. print '<td class="left">';
  291. if (!getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST')) {
  292. 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>';
  293. } else {
  294. 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>';
  295. }
  296. print '</td>';
  297. print '<td class="center width75">';
  298. print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
  299. print '</td>';
  300. print '</tr>';
  301. */
  302. /*if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2)
  303. {
  304. // Show logo for module
  305. print '<tr class="oddeven"><td>' . $langs->trans("TicketsShowModuleLogo") . '</td>';
  306. print '<td class="left">';
  307. if ($conf->use_javascript_ajax) {
  308. print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
  309. } else {
  310. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  311. print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, getDolGlobalInt('TICKET_SHOW_MODULE_LOGO'));
  312. }
  313. print '</td>';
  314. print '<td class="center">';
  315. print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
  316. print '</td>';
  317. print '</tr>';
  318. }*/
  319. // Show logo for company
  320. print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyLogo").'</td>';
  321. print '<td class="left">';
  322. if (!empty($conf->use_javascript_ajax)) {
  323. print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
  324. } else {
  325. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  326. print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO'));
  327. }
  328. print '</td>';
  329. print '<td class="center width75">';
  330. print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
  331. print '</td>';
  332. print '</tr>';
  333. // show footer for company
  334. print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowCompanyFooter").'</td>';
  335. print '<td class="left">';
  336. if ($conf->use_javascript_ajax) {
  337. print ajax_constantonoff('TICKET_SHOW_COMPANY_FOOTER');
  338. } else {
  339. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  340. print $form->selectarray("TICKET_SHOW_COMPANY_FOOTER", $arrval, $conf->global->TICKET_SHOW_COMPANY_FOOTER);
  341. }
  342. print '</td>';
  343. print '<td class="center width75">';
  344. print $form->textwithpicto('', $langs->trans("TicketsShowCompanyFooterHelp"), 1, 'help');
  345. print '</td>';
  346. print '</tr>';
  347. // Show progression
  348. print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowProgression").'</td>';
  349. print '<td class="left">';
  350. if (!empty($conf->use_javascript_ajax)) {
  351. print ajax_constantonoff('TICKET_SHOW_PROGRESSION');
  352. } else {
  353. if (!getDolGlobalInt('TICKET_SHOW_PROGRESSION')) {
  354. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_SHOW_PROGRESSION&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
  355. } else {
  356. print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_SHOW_PROGRESSION&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
  357. }
  358. }
  359. print '</td>';
  360. print '<td class="center width75">';
  361. print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help');
  362. print '</td>';
  363. print '</tr>';
  364. // Also send to main email address
  365. if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
  366. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
  367. print '<td class="left">';
  368. if (!empty($conf->use_javascript_ajax)) {
  369. print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
  370. } else {
  371. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  372. print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'));
  373. }
  374. print '</td>';
  375. print '<td class="center width75">';
  376. print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help');
  377. print '</td>';
  378. print '</tr>';
  379. }
  380. if (empty($conf->use_javascript_ajax)) {
  381. print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></td>';
  382. print '</tr>';
  383. }
  384. if (!getDolGlobalInt('FCKEDITOR_ENABLE_MAIL')) {
  385. print '<tr>';
  386. print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
  387. print "</tr>\n";
  388. }
  389. // Interface topic
  390. $url_interface = getDolGlobalString("TICKET_PUBLIC_INTERFACE_TOPIC");
  391. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
  392. print '</td><td>';
  393. print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.'" size="40" ></td>';
  394. print '</td>';
  395. print '<td class="center width75">';
  396. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
  397. print '</td></tr>';
  398. // Text on home page
  399. $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc").'</span>');
  400. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
  401. print '</td><td>';
  402. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  403. $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
  404. $doleditor->Create();
  405. print '</td>';
  406. print '<td class="center">';
  407. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
  408. print '</td></tr>';
  409. // Text to help to enter a ticket
  410. $public_text_help_message = getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'));
  411. print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
  412. print '</td><td>';
  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_TICKET'), ROWS_2, 70);
  415. $doleditor->Create();
  416. print '</td>';
  417. print '<td class="center">';
  418. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
  419. print '</td></tr>';
  420. // Url public interface
  421. $url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE");
  422. print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
  423. print '</td><td>';
  424. print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.'"></td>';
  425. print '</td>';
  426. print '<td class="center">';
  427. print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
  428. print '</td></tr>';
  429. print '</table>';
  430. print '<br><br>';
  431. print load_fiche_titre($langs->trans("Emails"));
  432. print '<div class="div-table-responsive-no-min">';
  433. print '<table class="noborder centpercent">';
  434. // Activate email creation to user
  435. print '<tr class="pair"><td>';
  436. print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
  437. print '</td>';
  438. print '<td class="left">';
  439. if ($conf->use_javascript_ajax) {
  440. print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
  441. } else {
  442. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  443. print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS'));
  444. }
  445. print '</td>';
  446. print '</tr>';
  447. // Text of email after creatio of a ticket
  448. $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody'));
  449. print '<tr><td>';
  450. print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
  451. print '</label>';
  452. print '</td><td>';
  453. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  454. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
  455. $doleditor->Create();
  456. print '</td>';
  457. print '</tr>';
  458. // Activate email notification when a new message is added
  459. print '<tr class="pair"><td>';
  460. print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
  461. print '</td>';
  462. print '<td class="left">';
  463. if ($conf->use_javascript_ajax) {
  464. print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
  465. } else {
  466. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  467. print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
  468. }
  469. print '</td>';
  470. print '</tr>';
  471. // Send notification when a new message is added to a email if a user is not assigned to the ticket
  472. print '<tr><td>';
  473. print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
  474. print '</td><td>';
  475. print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").'" size="40" ></td>';
  476. print '</td>';
  477. print '</tr>';
  478. print '</table>';
  479. print '</div>';
  480. print $form->buttonsSaveCancel("Save", '');
  481. print '</form>';
  482. }
  483. // End of page
  484. llxFooter();
  485. $db->close();