ticket.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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 <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file admin/ticket.php
  20. * \ingroup ticket
  21. * \brief This file is a module setup page
  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->load("ticket");
  29. // Access control
  30. if (!$user->admin) {
  31. accessforbidden();
  32. }
  33. // Parameters
  34. $value = GETPOST('value', 'alpha');
  35. $action = GETPOST('action', 'alpha');
  36. $label = GETPOST('label', 'alpha');
  37. $scandir = GETPOST('scandir', 'alpha');
  38. $type = 'ticket';
  39. if ($action == 'updateMask') {
  40. $maskconstticket = GETPOST('maskconstticket', 'alpha');
  41. $maskticket = GETPOST('maskticket', 'alpha');
  42. if ($maskconstticket) {
  43. $res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity);
  44. }
  45. if (!$res > 0) {
  46. $error++;
  47. }
  48. if (!$error)
  49. {
  50. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  51. }
  52. else
  53. {
  54. setEventMessages($langs->trans("Error"), null, 'errors');
  55. }
  56. } elseif ($action == 'setmod') {
  57. // TODO Verifier si module numerotation choisi peut etre active
  58. // par appel methode canBeActivated
  59. dolibarr_set_const($db, "TICKETSUP_ADDON", $value, 'chaine', 0, '', $conf->entity);
  60. } elseif ($action == 'setvar') {
  61. include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
  62. $notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
  63. if (!empty($notification_email)) {
  64. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
  65. } else {
  66. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
  67. }
  68. if (!$res > 0) {
  69. $error++;
  70. }
  71. // altairis : differentiate notification email FROM and TO
  72. $notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
  73. if (!empty($notification_email_to)) {
  74. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
  75. } else {
  76. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
  77. }
  78. if (!$res > 0) {
  79. $error++;
  80. }
  81. $mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
  82. if (!empty($mail_new_ticket)) {
  83. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
  84. } else {
  85. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
  86. }
  87. if (!$res > 0) {
  88. $error++;
  89. }
  90. $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
  91. if (!empty($mail_intro)) {
  92. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
  93. } else {
  94. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
  95. }
  96. if (!$res > 0) {
  97. $error++;
  98. }
  99. $mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'alpha');
  100. if (!empty($mail_signature)) {
  101. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
  102. } else {
  103. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
  104. }
  105. if (!$res > 0) {
  106. $error++;
  107. }
  108. $url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
  109. if (!empty($mail_signature)) {
  110. $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
  111. } else {
  112. $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
  113. }
  114. if (!$res > 0) {
  115. $error++;
  116. }
  117. $topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
  118. if (!empty($mail_signature)) {
  119. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
  120. } else {
  121. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
  122. }
  123. if (!$res > 0) {
  124. $error++;
  125. }
  126. $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
  127. if (!empty($mail_signature)) {
  128. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
  129. } else {
  130. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
  131. }
  132. if (!$res > 0) {
  133. $error++;
  134. }
  135. $text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
  136. if (!empty($text_help)) {
  137. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
  138. } else {
  139. $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
  140. }
  141. if (!$res > 0) {
  142. $error++;
  143. }
  144. }
  145. if ($action == 'setvarother') {
  146. $param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
  147. $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
  148. if (!$res > 0) {
  149. $error++;
  150. }
  151. $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
  152. $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
  153. if (!$res > 0) {
  154. $error++;
  155. }
  156. $param_disable_email = GETPOST('TICKET_DISABLE_ALL_MAILS', 'alpha');
  157. $res = dolibarr_set_const($db, 'TICKET_DISABLE_ALL_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
  158. if (!$res > 0) {
  159. $error++;
  160. }
  161. $param_activate_log_by_email = GETPOST('TICKET_ACTIVATE_LOG_BY_EMAIL', 'alpha');
  162. $res = dolibarr_set_const($db, 'TICKET_ACTIVATE_LOG_BY_EMAIL', $param_activate_log_by_email, 'chaine', 0, '', $conf->entity);
  163. if (!$res > 0) {
  164. $error++;
  165. }
  166. if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
  167. {
  168. $param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
  169. $res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
  170. if (!$res > 0) {
  171. $error++;
  172. }
  173. }
  174. if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
  175. {
  176. $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
  177. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
  178. if (!$res > 0) {
  179. $error++;
  180. }
  181. }
  182. $param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
  183. $res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
  184. if (!$res > 0) {
  185. $error++;
  186. }
  187. $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
  188. $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
  189. if (!$res > 0) {
  190. $error++;
  191. }
  192. }
  193. /*
  194. * View
  195. */
  196. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  197. $form = new Form($db);
  198. $help_url = "FR:Module_Ticket";
  199. $page_name = "TicketSetup";
  200. llxHeader('', $langs->trans($page_name), $help_url);
  201. // Subheader
  202. $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
  203. print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
  204. // Configuration header
  205. $head = ticketAdminPrepareHead();
  206. dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
  207. print $langs->trans("TicketSetupDictionaries") . ' : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>';
  208. print $langs->trans("TicketPublicAccess") . ' : <a href="' . dol_buildpath('/public/ticket/index.php', 1) . '" target="_blank" >' . dol_buildpath('/public/ticket/index.php', 2) . '</a>';
  209. dol_fiche_end();
  210. /*
  211. * Projects Numbering model
  212. */
  213. print_titre($langs->trans("TicketNumberingModules"));
  214. print '<table class="noborder" width="100%">';
  215. print '<tr class="liste_titre">';
  216. print '<td width="100">' . $langs->trans("Name") . '</td>';
  217. print '<td>' . $langs->trans("Description") . '</td>';
  218. print '<td>' . $langs->trans("Example") . '</td>';
  219. print '<td align="center" width="60">' . $langs->trans("Activated") . '</td>';
  220. print '<td align="center" width="80">' . $langs->trans("ShortInfo") . '</td>';
  221. print "</tr>\n";
  222. clearstatcache();
  223. foreach ($dirmodels as $reldir) {
  224. $dir = dol_buildpath($reldir . "core/modules/ticket/");
  225. if (is_dir($dir)) {
  226. $handle = opendir($dir);
  227. if (is_resource($handle)) {
  228. while (($file = readdir($handle)) !== false) {
  229. if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
  230. $file = $reg[1];
  231. $classname = substr($file, 4);
  232. include_once $dir . $file . '.php';
  233. $module = new $file;
  234. // Show modules according to features level
  235. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  236. continue;
  237. }
  238. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  239. continue;
  240. }
  241. if ($module->isEnabled()) {
  242. print '<tr class="oddeven"><td>' . $module->name . "</td><td>\n";
  243. print $module->info();
  244. print '</td>';
  245. // Show example of numbering model
  246. print '<td class="nowrap">';
  247. $tmp = $module->getExample();
  248. if (preg_match('/^Error/', $tmp)) {
  249. print '<div class="error">' . $langs->trans($tmp) . '</div>';
  250. } elseif ($tmp == 'NotConfigured') {
  251. print $langs->trans($tmp);
  252. } else {
  253. print $tmp;
  254. }
  255. print '</td>' . "\n";
  256. print '<td align="center">';
  257. if ($conf->global->TICKETSUP_ADDON == 'mod_' . $classname) {
  258. print img_picto($langs->trans("Activated"), 'switch_on');
  259. } else {
  260. print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=mod_' . $classname . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
  261. }
  262. print '</td>';
  263. $ticket = new Ticket($db);
  264. $ticket->initAsSpecimen();
  265. // Info
  266. $htmltooltip = '';
  267. $htmltooltip .= '' . $langs->trans("Version") . ': <b>' . $module->getVersion() . '</b><br>';
  268. $nextval = $module->getNextValue($mysoc, $ticket);
  269. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  270. $htmltooltip .= '' . $langs->trans("NextValue") . ': ';
  271. if ($nextval) {
  272. $htmltooltip .= $nextval . '<br>';
  273. } else {
  274. $htmltooltip .= $langs->trans($module->error) . '<br>';
  275. }
  276. }
  277. print '<td align="center">';
  278. print $form->textwithpicto('', $htmltooltip, 1, 0);
  279. print '</td>';
  280. print '</tr>';
  281. }
  282. }
  283. }
  284. closedir($handle);
  285. }
  286. }
  287. }
  288. print '</table><br>';
  289. if (!$conf->use_javascript_ajax) {
  290. print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
  291. print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
  292. print '<input type="hidden" name="action" value="setvarother">';
  293. }
  294. print_titre($langs->trans("TicketParamPublicInterface"));
  295. print '<table class="noborder" width="100%">';
  296. // Activate public interface
  297. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsActivatePublicInterface") . '</td>';
  298. print '<td align="left">';
  299. if ($conf->use_javascript_ajax) {
  300. print ajax_constantonoff('TICKET_ENABLE_PUBLIC_INTERFACE');
  301. } else {
  302. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  303. print $form->selectarray("TICKET_ENABLE_PUBLIC_INTERFACE", $arrval, $conf->global->TICKET_ENABLE_PUBLIC_INTERFACE);
  304. }
  305. print '</td>';
  306. print '<td align="center">';
  307. print $form->textwithpicto('', $langs->trans("TicketsActivatePublicInterfaceHelp"), 1, 'help');
  308. print '</td>';
  309. print '</tr>';
  310. // Check if email exists
  311. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailMustExist") . '</td>';
  312. print '<td align="left">';
  313. if ($conf->use_javascript_ajax) {
  314. print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
  315. } else {
  316. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  317. print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
  318. }
  319. print '</td>';
  320. print '<td align="center">';
  321. print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
  322. print '</td>';
  323. print '</tr>';
  324. /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
  325. {
  326. // Show logo for module
  327. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowModuleLogo") . '</td>';
  328. print '<td align="left">';
  329. if ($conf->use_javascript_ajax) {
  330. print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
  331. } else {
  332. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  333. print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
  334. }
  335. print '</td>';
  336. print '<td align="center">';
  337. print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
  338. print '</td>';
  339. print '</tr>';
  340. }*/
  341. // Show logo for company
  342. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowCompanyLogo") . '</td>';
  343. print '<td align="left">';
  344. if ($conf->use_javascript_ajax) {
  345. print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
  346. } else {
  347. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  348. print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
  349. }
  350. print '</td>';
  351. print '<td align="center">';
  352. print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
  353. print '</td>';
  354. print '</tr>';
  355. print '</table><br>';
  356. print_titre($langs->trans("TicketParams"));
  357. print '<table class="noborder" width="100%">';
  358. // Activate email notifications
  359. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsDisableEmail") . '</td>';
  360. print '<td align="left">';
  361. if ($conf->use_javascript_ajax) {
  362. print ajax_constantonoff('TICKET_DISABLE_ALL_MAILS');
  363. } else {
  364. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  365. print $form->selectarray("TICKET_DISABLE_ALL_MAILS", $arrval, $conf->global->TICKET_DISABLE_ALL_MAILS);
  366. }
  367. print '</td>';
  368. print '<td align="center">';
  369. print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
  370. print '</td>';
  371. print '</tr>';
  372. // Activate log by email
  373. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLogEnableEmail") . '</td>';
  374. print '<td align="left">';
  375. if ($conf->use_javascript_ajax) {
  376. print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
  377. } else {
  378. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  379. print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL);
  380. }
  381. print '</td>';
  382. print '<td align="center">';
  383. print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
  384. print '</td>';
  385. print '</tr>';
  386. // Also send to main email address
  387. if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
  388. {
  389. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
  390. print '<td align="left">';
  391. if ($conf->use_javascript_ajax) {
  392. print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
  393. } else {
  394. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  395. print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
  396. }
  397. print '</td>';
  398. print '<td align="center">';
  399. print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
  400. print '</td>';
  401. print '</tr>';
  402. }
  403. // Limiter la vue des tickets à ceux assignés à l'utilisateur
  404. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>';
  405. print '<td align="left">';
  406. if ($conf->use_javascript_ajax) {
  407. print ajax_constantonoff('TICKET_LIMIT_VIEW_ASSIGNED_ONLY');
  408. } else {
  409. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  410. print $form->selectarray("TICKET_LIMIT_VIEW_ASSIGNED_ONLY", $arrval, $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY);
  411. }
  412. print '</td>';
  413. print '<td align="center">';
  414. print $form->textwithpicto('', $langs->trans("TicketsLimitViewAssignedOnlyHelp"), 1, 'help');
  415. print '</td>';
  416. print '</tr>';
  417. if (!$conf->use_javascript_ajax) {
  418. print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
  419. print '</tr>';
  420. }
  421. // Auto assign ticket at user who created it
  422. print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
  423. print '<td align="left">';
  424. if ($conf->use_javascript_ajax) {
  425. print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
  426. } else {
  427. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  428. print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
  429. }
  430. print '</td>';
  431. print '<td align="center">';
  432. print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
  433. print '</td>';
  434. print '</tr>';
  435. print '</table><br>';
  436. if (!$conf->use_javascript_ajax) {
  437. print '</form>';
  438. }
  439. // Admin var of module
  440. print_titre($langs->trans("TicketParamMail"));
  441. print '<table class="noborder" width="100%">';
  442. print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
  443. print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
  444. print '<input type="hidden" name="action" value="setvar">';
  445. print '<tr class="liste_titre">';
  446. print '<td colspan="3">' . $langs->trans("Email") . '</td>';
  447. print "</tr>\n";
  448. if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
  449. print '<tr>';
  450. print '<td colspan="3"><div class="info">' . $langs->trans("TicketCkEditorEmailNotActivated") . '</div></td>';
  451. print "</tr>\n";
  452. }
  453. // Email d'envoi des notifications
  454. print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationFrom") . '</td>';
  455. print '<td align="left">';
  456. print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>';
  457. print '<td align="center">';
  458. print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
  459. print '</td>';
  460. print '</tr>';
  461. // Email de réception des notifications
  462. print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationTo") . '</td>';
  463. print '<td align="left">';
  464. print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="' . (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : $conf->global->TICKET_NOTIFICATION_EMAIL_FROM) . '" size="20" ></td>';
  465. print '<td align="center">';
  466. print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
  467. print '</td>';
  468. print '</tr>';
  469. // Texte de création d'un ticket
  470. $mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
  471. print '<tr><td>' . $langs->trans("TicketNewEmailBodyLabel") . '</label>';
  472. print '</td><td>';
  473. require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
  474. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
  475. $doleditor->Create();
  476. print '</td>';
  477. print '<td align="center">';
  478. print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
  479. print '</td></tr>';
  480. // Texte d'introduction
  481. $mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
  482. print '<tr><td>' . $langs->trans("TicketMessageMailIntroLabelAdmin") . '</label>';
  483. print '</td><td>';
  484. require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
  485. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
  486. $doleditor->Create();
  487. print '</td>';
  488. print '<td align="center">';
  489. print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
  490. print '</td></tr>';
  491. // Texte de signature
  492. $mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText');
  493. print '<tr><td>' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . '</label>';
  494. print '</td><td>';
  495. require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
  496. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
  497. $doleditor->Create();
  498. print '</td>';
  499. print '<td align="center">';
  500. print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
  501. print '</td></tr>';
  502. print '<tr class="liste_titre">';
  503. print '<td colspan="3">' . $langs->trans("PublicInterface") . '</td>';
  504. print "</tr>\n";
  505. // Url public interface
  506. $url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
  507. print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
  508. print '</td><td>';
  509. print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
  510. print '</td>';
  511. print '<td align="center">';
  512. print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
  513. print '</td></tr>';
  514. // Interface topic
  515. $url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
  516. print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
  517. print '</td><td>';
  518. print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
  519. print '</td>';
  520. print '<td align="center">';
  521. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
  522. print '</td></tr>';
  523. // Texte d'accueil homepage
  524. $public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
  525. print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . '</label>';
  526. print '</td><td>';
  527. require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
  528. $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
  529. $doleditor->Create();
  530. print '</td>';
  531. print '<td align="center">';
  532. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
  533. print '</td></tr>';
  534. // Texte d'aide à la saisie du message
  535. $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
  536. print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . '</label>';
  537. print '</td><td>';
  538. require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
  539. $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);
  540. $doleditor->Create();
  541. print '</td>';
  542. print '<td align="center">';
  543. print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
  544. print '</td></tr>';
  545. print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
  546. print '</tr>';
  547. print '</table><br>';
  548. print '</form>';
  549. // End of page
  550. llxFooter();
  551. $db->close();