ticket.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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.php
  20. * \ingroup ticket
  21. * \brief Page to setup 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. $error = 0;
  40. /*
  41. * Actions
  42. */
  43. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  44. if ($action == 'updateMask') {
  45. $maskconstticket = GETPOST('maskconstticket', 'alpha');
  46. $maskticket = GETPOST('maskticket', 'alpha');
  47. if ($maskconstticket) {
  48. $res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity);
  49. }
  50. if (!($res > 0)) {
  51. $error++;
  52. }
  53. if (!$error) {
  54. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  55. } else {
  56. setEventMessages($langs->trans("Error"), null, 'errors');
  57. }
  58. } elseif ($action == 'set') {
  59. // Activate a model
  60. $ret = addDocumentModel($value, $type, $label, $scandir);
  61. } elseif ($action == 'del') {
  62. $ret = delDocumentModel($value, $type);
  63. if ($ret > 0) {
  64. if ($conf->global->TICKET_ADDON_PDF == "$value") {
  65. dolibarr_del_const($db, 'TICKET_ADDON_PDF', $conf->entity);
  66. }
  67. }
  68. } elseif ($action == 'setdoc') {
  69. // Set default model
  70. if (dolibarr_set_const($db, "TICKET_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
  71. // The constant that was read before the new set
  72. // We therefore requires a variable to have a coherent view
  73. $conf->global->TICKET_ADDON_PDF = $value;
  74. }
  75. // On active le modele
  76. $ret = delDocumentModel($value, $type);
  77. if ($ret > 0) {
  78. $ret = addDocumentModel($value, $type, $label, $scandir);
  79. }
  80. } elseif ($action == 'setmod') {
  81. // TODO Verifier si module numerotation choisi peut etre active
  82. // par appel methode canBeActivated
  83. dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
  84. } elseif ($action == 'setvar') {
  85. include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
  86. $notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
  87. if (!empty($notification_email)) {
  88. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
  89. } else {
  90. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
  91. }
  92. if (!($res > 0)) {
  93. $error++;
  94. }
  95. // altairis : differentiate notification email FROM and TO
  96. $notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
  97. if (!empty($notification_email_to)) {
  98. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
  99. } else {
  100. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
  101. }
  102. if (!($res > 0)) {
  103. $error++;
  104. }
  105. $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'restricthtml');
  106. if (!empty($mail_intro)) {
  107. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
  108. } else {
  109. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
  110. }
  111. if (!($res > 0)) {
  112. $error++;
  113. }
  114. $mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'restricthtml');
  115. if (!empty($mail_signature)) {
  116. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
  117. } else {
  118. $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
  119. }
  120. if (!($res > 0)) {
  121. $error++;
  122. }
  123. }
  124. if ($action == 'setvarother') {
  125. $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
  126. $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
  127. if (!($res > 0)) {
  128. $error++;
  129. }
  130. $param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
  131. $res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
  132. if (!($res > 0)) {
  133. $error++;
  134. }
  135. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  136. $param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
  137. $res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
  138. if (!($res > 0)) {
  139. $error++;
  140. }
  141. }
  142. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  143. $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
  144. $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
  145. if (!($res > 0)) {
  146. $error++;
  147. }
  148. }
  149. $param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
  150. $res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
  151. if (!($res > 0)) {
  152. $error++;
  153. }
  154. $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
  155. $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
  156. if (!($res > 0)) {
  157. $error++;
  158. }
  159. }
  160. /*
  161. * View
  162. */
  163. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  164. $form = new Form($db);
  165. $help_url = "FR:Module_Ticket";
  166. $page_name = "TicketSetup";
  167. llxHeader('', $langs->trans($page_name), $help_url);
  168. // Subheader
  169. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  170. print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
  171. // Configuration header
  172. $head = ticketAdminPrepareHead();
  173. print dol_get_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
  174. print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries").'</span> : <a href="'.DOL_URL_ROOT.'/admin/dict.php">'.$langs->trans("ClickHereToGoTo", $langs->transnoentitiesnoconv("DictionarySetup")).'</a><br>';
  175. print dol_get_fiche_end();
  176. /*
  177. * Tickets numbering model
  178. */
  179. print load_fiche_titre($langs->trans("TicketNumberingModules"), '', '');
  180. print '<div class="div-table-responsive-no-min">';
  181. print '<table class="noborder centpercent">';
  182. print '<tr class="liste_titre">';
  183. print '<td width="100">'.$langs->trans("Name").'</td>';
  184. print '<td>'.$langs->trans("Description").'</td>';
  185. print '<td>'.$langs->trans("Example").'</td>';
  186. print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
  187. print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
  188. print "</tr>\n";
  189. clearstatcache();
  190. foreach ($dirmodels as $reldir) {
  191. $dir = dol_buildpath($reldir."core/modules/ticket");
  192. if (is_dir($dir)) {
  193. $handle = opendir($dir);
  194. if (is_resource($handle)) {
  195. while (($file = readdir($handle)) !== false) {
  196. if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
  197. $file = $reg[1];
  198. $classname = substr($file, 4);
  199. include_once $dir.'/'.$file.'.php';
  200. $module = new $file;
  201. // Show modules according to features level
  202. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  203. continue;
  204. }
  205. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  206. continue;
  207. }
  208. if ($module->isEnabled()) {
  209. print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
  210. print $module->info();
  211. print '</td>';
  212. // Show example of numbering model
  213. print '<td class="nowrap">';
  214. $tmp = $module->getExample();
  215. if (preg_match('/^Error/', $tmp)) {
  216. $langs->load("errors");
  217. print '<div class="error">'.$langs->trans($tmp).'</div>';
  218. } elseif ($tmp == 'NotConfigured') {
  219. print $langs->trans($tmp);
  220. } else {
  221. print $tmp;
  222. }
  223. print '</td>'."\n";
  224. print '<td class="center">';
  225. if ($conf->global->TICKET_ADDON == 'mod_'.$classname) {
  226. print img_picto($langs->trans("Activated"), 'switch_on');
  227. } else {
  228. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;token='.newToken().'&amp;value=mod_'.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  229. }
  230. print '</td>';
  231. $ticket = new Ticket($db);
  232. $ticket->initAsSpecimen();
  233. // Info
  234. $htmltooltip = '';
  235. $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  236. $nextval = $module->getNextValue($mysoc, $ticket);
  237. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  238. $htmltooltip .= ''.$langs->trans("NextValue").': ';
  239. if ($nextval) {
  240. $htmltooltip .= $nextval.'<br>';
  241. } else {
  242. $htmltooltip .= $langs->trans($module->error).'<br>';
  243. }
  244. }
  245. print '<td class="center">';
  246. print $form->textwithpicto('', $htmltooltip, 1, 0);
  247. print '</td>';
  248. print '</tr>';
  249. }
  250. }
  251. }
  252. closedir($handle);
  253. }
  254. }
  255. }
  256. print '</table>';
  257. print '</div>';
  258. print '<br>';
  259. /*
  260. * Document templates generators
  261. */
  262. print load_fiche_titre($langs->trans("TicketsModelModule"), '', '');
  263. // Load array def with activated templates
  264. $def = array();
  265. $sql = "SELECT nom";
  266. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  267. $sql .= " WHERE type = '".$db->escape($type)."'";
  268. $sql .= " AND entity = ".$conf->entity;
  269. $resql = $db->query($sql);
  270. if ($resql) {
  271. $i = 0;
  272. $num_rows = $db->num_rows($resql);
  273. while ($i < $num_rows) {
  274. $array = $db->fetch_array($resql);
  275. array_push($def, $array[0]);
  276. $i++;
  277. }
  278. } else {
  279. dol_print_error($db);
  280. }
  281. print '<div class="div-table-responsive-no-min">';
  282. print "<table class=\"noborder\" width=\"100%\">\n";
  283. print "<tr class=\"liste_titre\">\n";
  284. print '<td>'.$langs->trans("Name").'</td>';
  285. print '<td>'.$langs->trans("Description").'</td>';
  286. print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
  287. print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
  288. print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
  289. print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
  290. print "</tr>\n";
  291. clearstatcache();
  292. foreach ($dirmodels as $reldir) {
  293. foreach (array('', '/doc') as $valdir) {
  294. $realpath = $reldir."core/modules/ticket".$valdir;
  295. $dir = dol_buildpath($realpath);
  296. if (is_dir($dir)) {
  297. $handle = opendir($dir);
  298. if (is_resource($handle)) {
  299. while (($file = readdir($handle)) !== false) {
  300. $filelist[] = $file;
  301. }
  302. closedir($handle);
  303. arsort($filelist);
  304. foreach ($filelist as $file) {
  305. if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  306. if (file_exists($dir.'/'.$file)) {
  307. $name = substr($file, 4, dol_strlen($file) - 16);
  308. $classname = substr($file, 0, dol_strlen($file) - 12);
  309. require_once $dir.'/'.$file;
  310. $module = new $classname($db);
  311. $modulequalified = 1;
  312. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  313. $modulequalified = 0;
  314. }
  315. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  316. $modulequalified = 0;
  317. }
  318. if ($modulequalified) {
  319. print '<tr class="oddeven"><td width="100">';
  320. print (empty($module->name) ? $name : $module->name);
  321. print "</td><td>\n";
  322. if (method_exists($module, 'info')) {
  323. print $module->info($langs);
  324. } else {
  325. print $module->description;
  326. }
  327. print '</td>';
  328. // Active
  329. if (in_array($name, $def)) {
  330. print '<td class="center">'."\n";
  331. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
  332. print img_picto($langs->trans("Enabled"), 'switch_on');
  333. print '</a>';
  334. print '</td>';
  335. } else {
  336. print '<td class="center">'."\n";
  337. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  338. print "</td>";
  339. }
  340. // Default
  341. print '<td class="center">';
  342. if ($conf->global->TICKET_ADDON_PDF == $name) {
  343. print img_picto($langs->trans("Default"), 'on');
  344. } else {
  345. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  346. }
  347. print '</td>';
  348. // Info
  349. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  350. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  351. if ($module->type == 'pdf') {
  352. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  353. }
  354. $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
  355. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  356. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
  357. $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
  358. //$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
  359. //$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
  360. //$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
  361. print '<td class="center">';
  362. print $form->textwithpicto('', $htmltooltip, 1, 0);
  363. print '</td>';
  364. // Preview
  365. print '<td class="center">';
  366. if ($module->type == 'pdf') {
  367. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
  368. } else {
  369. print img_object($langs->trans("PreviewNotAvailable"), 'generic');
  370. }
  371. print '</td>';
  372. print "</tr>\n";
  373. }
  374. }
  375. }
  376. }
  377. }
  378. }
  379. }
  380. }
  381. print '</table>';
  382. print '</div><br>';
  383. if (!$conf->use_javascript_ajax) {
  384. print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
  385. print '<input type="hidden" name="token" value="'.newToken().'">';
  386. print '<input type="hidden" name="action" value="setvarother">';
  387. }
  388. print load_fiche_titre($langs->trans("Other"), '', '');
  389. print '<table class="noborder centpercent">';
  390. print '<tr class="liste_titre">';
  391. print '<td>'.$langs->trans("Parameter").'</td>';
  392. print '<td></td>';
  393. print '<td></td>';
  394. print "</tr>\n";
  395. // Auto assign ticket at user who created it
  396. print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
  397. print '<td class="left">';
  398. if ($conf->use_javascript_ajax) {
  399. print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
  400. } else {
  401. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  402. print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
  403. }
  404. print '</td>';
  405. print '<td class="center">';
  406. print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
  407. print '</td>';
  408. print '</tr>';
  409. print '</table><br>';
  410. if (!$conf->use_javascript_ajax) {
  411. print '</form>';
  412. }
  413. // Admin var of module
  414. print load_fiche_titre($langs->trans("Notification"), '', '');
  415. print '<table class="noborder centpercent">';
  416. print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
  417. print '<input type="hidden" name="token" value="'.newToken().'">';
  418. print '<input type="hidden" name="action" value="setvar">';
  419. print '<tr class="liste_titre">';
  420. print '<td colspan="3">'.$langs->trans("Email").'</td>';
  421. print "</tr>\n";
  422. if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
  423. print '<tr>';
  424. print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
  425. print "</tr>\n";
  426. }
  427. // @todo Use module notification instead...
  428. // Email d'envoi des notifications
  429. print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationFrom").'</td>';
  430. print '<td class="left">';
  431. print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'"></td>';
  432. print '<td class="center">';
  433. print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
  434. print '</td>';
  435. print '</tr>';
  436. // Email for notification of TICKET_CREATE
  437. print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").' ('.$langs->trans("Creation").')</td>';
  438. print '<td class="left">';
  439. print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : '').'"></td>';
  440. print '<td class="center">';
  441. print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
  442. print '</td>';
  443. print '</tr>';
  444. // Also send to TICKET_NOTIFICATION_EMAIL_TO for responses (not only creation)
  445. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  446. print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
  447. print '<td class="left">';
  448. if ($conf->use_javascript_ajax) {
  449. print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
  450. } else {
  451. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  452. print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
  453. }
  454. print '</td>';
  455. print '<td class="center">';
  456. print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
  457. print '</td>';
  458. print '</tr>';
  459. }
  460. // Texte d'introduction
  461. $mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
  462. print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailIntroLabelAdmin").' ('.$langs->trans("Responses").')';
  463. print '</td><td>';
  464. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  465. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
  466. $doleditor->Create();
  467. print '</td>';
  468. print '<td class="center">';
  469. print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
  470. print '</td></tr>';
  471. // Texte de signature
  472. $mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText');
  473. print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailSignatureLabelAdmin").'</label>';
  474. print '</td><td>';
  475. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  476. $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
  477. $doleditor->Create();
  478. print '</td>';
  479. print '<td class="center">';
  480. print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
  481. print '</td></tr>';
  482. print '</table>';
  483. print '<div class="center">';
  484. print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
  485. print '</div>';
  486. print '</form>';
  487. // End of page
  488. llxFooter();
  489. $db->close();