dolibarr 21.0.0-alpha
mails_templates.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
5 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
7 * Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
8 * Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
9 * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
10 * Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
11 * Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
12 * Copyright (C) 2015-2024 Ferran Marcet <fmarcet@2byte.es>
13 * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
14 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
15 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <https://www.gnu.org/licenses/>.
29 */
30
37// Load Dolibarr environment
38require '../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
43require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
44require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
46
47// Load translation files required by the page
48$langsArray = array("errors", "admin", "mails", "languages");
49
50if (isModEnabled('member')) {
51 $langsArray[] = 'members';
52}
53if (isModEnabled('eventorganization')) {
54 $langsArray[] = 'eventorganization';
55}
56
57$langs->loadLangs($langsArray);
58
59$toselect = GETPOST('toselect', 'array');
60$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
61$massaction = GETPOST('massaction', 'alpha');
62$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
63$mode = GETPOST('mode', 'aZ09');
64$optioncss = GETPOST('optioncss', 'alpha');
65
66$id = $rowid = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('rowid'));
67$search_label = GETPOST('search_label', 'alphanohtml'); // Must allow value like 'Abc Def' or '(MyTemplateName)'
68$search_type_template = GETPOST('search_type_template', 'alpha');
69$search_lang = GETPOST('search_lang', 'alpha');
70$search_fk_user = GETPOST('search_fk_user', 'intcomma');
71$search_topic = GETPOST('search_topic', 'alpha');
72$search_module = GETPOST('search_module', 'alpha');
73
74$acts = array();
75$actl = array();
76$acts[0] = "activate";
77$acts[1] = "disable";
78$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
79$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
80
81$listoffset = GETPOST('listoffset', 'alpha');
82$listlimit = GETPOST('listlimit', 'alpha') > 0 ? GETPOST('listlimit', 'alpha') : 1000;
83
84$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
85$sortfield = GETPOST('sortfield', 'aZ09comma');
86$sortorder = GETPOST('sortorder', 'aZ09comma');
87$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
88if (empty($page) || $page == -1) {
89 $page = 0;
90} // If $page is not defined, or '' or -1
91$offset = $listlimit * $page;
92$pageprev = $page - 1;
93$pagenext = $page + 1;
94
95if (empty($sortfield)) {
96 $sortfield = 'type_template,lang,position,label';
97}
98if (empty($sortorder)) {
99 $sortorder = 'ASC';
100}
101
102// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
103$hookmanager->initHooks(array('emailtemplates'));
104
105
106// Name of SQL tables of dictionaries
107$tabname = array();
108$tabname[25] = MAIN_DB_PREFIX."c_email_templates";
109
110// Nom des champs en resultat de select pour affichage du dictionnaire
111$tabfield = array();
112$tabfield[25] = "label,lang,type_template,fk_user,private,position,module,topic,joinfiles,defaultfortype,content";
113if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) {
114 $tabfield[25] .= ',content_lines';
115}
116
117// Nom des champs d'edition pour modification d'un enregistrement
118$tabfieldvalue = array();
119$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
120if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) {
121 $tabfieldvalue[25] .= ',content_lines';
122}
123
124// Nom des champs dans la table pour insertion d'un enregistrement
125$tabfieldinsert = array();
126$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
127if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) {
128 $tabfieldinsert[25] .= ',content_lines';
129}
130$tabfieldinsert[25] .= ',entity'; // Must be at end because not into other arrays
131
132// Condition to show dictionary in setup page
133$tabcond = array();
134$tabcond[25] = true;
135
136// List of help for fields
137// Set MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES to allow edit of template for lines
138require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
139$formmail = new FormMail($db);
140if (!getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) {
141 $tmp = FormMail::getAvailableSubstitKey('formemail');
142 $tmp['__(AnyTranslationKey)__'] = 'Translation';
143 $helpsubstit = $langs->trans("AvailableVariables").':<br>';
144 $helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
145 foreach ($tmp as $key => $val) {
146 $helpsubstit .= $key.' -> '.$val.'<br>';
147 $helpsubstitforlines .= $key.' -> '.$val.'<br>';
148 }
149} else {
150 $tmp = FormMail::getAvailableSubstitKey('formemailwithlines');
151 $tmp['__(AnyTranslationKey)__'] = 'Translation';
152 $helpsubstit = $langs->trans("AvailableVariables").':<br>';
153 $helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
154 foreach ($tmp as $key => $val) {
155 $helpsubstit .= $key.' -> '.$val.'<br>';
156 }
157 $tmp = FormMail::getAvailableSubstitKey('formemailforlines');
158 foreach ($tmp as $key => $val) {
159 $helpsubstitforlines .= $key.' -> '.$val.'<br>';
160 }
161}
162
163
164$tabhelp = array();
165$tabhelp[25] = array(
166 'label' => $langs->trans('EnterAnyCode'),
167 'type_template' => $langs->trans("TemplateForElement"),
168 'private' => $langs->trans("TemplateIsVisibleByOwnerOnly"),
169 'position' => $langs->trans("PositionIntoComboList"),
170 'topic' => '<span class="small">'.$helpsubstit.'</span>',
171 'email_from' => $langs->trans('ForceEmailFrom'),
172 'joinfiles' => $langs->trans('AttachMainDocByDefault'),
173 'defaultfortype' => $langs->trans("DefaultForTypeDesc"),
174 'content' => '<span class="small">'.$helpsubstit.'</span>',
175 'content_lines' => '<span class="small">'.$helpsubstitforlines.'</span>'
176);
177
178
179// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
180$elementList = array();
181// Add all and none after the sort
182
183$elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --';
184$elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --';
185$elementList['user'] = img_picto('', 'user', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToUser'));
186if (isModEnabled('member') && $user->hasRight('adherent', 'lire')) {
187 $elementList['member'] = img_picto('', 'object_member', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToMember'));
188}
189if (isModEnabled('recruitment') && $user->hasRight('recruitment', 'recruitmentjobposition', 'read')) {
190 $elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
191}
192if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) {
193 $elementList['thirdparty'] = img_picto('', 'company', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
194}
195if (isModEnabled("societe") && $user->hasRight('societe', 'contact', 'lire')) {
196 $elementList['contact'] = img_picto('', 'contact', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToContact'));
197}
198if (isModEnabled('project')) {
199 $elementList['project'] = img_picto('', 'project', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToProject'));
200}
201if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
202 $elementList['propal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
203}
204if (isModEnabled('order') && $user->hasRight('commande', 'lire')) {
205 $elementList['order_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
206}
207if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
208 $elementList['facture_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
209}
210if (isModEnabled("shipping")) {
211 $elementList['shipping_send'] = img_picto('', 'dolly', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
212}
213if (isModEnabled("reception")) {
214 $elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendReception'));
215}
216if (isModEnabled('intervention')) {
217 $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
218}
219if (isModEnabled('supplier_proposal')) {
220 $elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
221}
222if (isModEnabled("supplier_order") && ($user->hasRight('fournisseur', 'commande', 'lire') || $user->hasRight('supplier_order', 'read'))) {
223 $elementList['order_supplier_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
224}
225if (isModEnabled("supplier_invoice") && ($user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('supplier_invoice', 'read'))) {
226 $elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
227}
228if (isModEnabled('contract') && $user->hasRight('contrat', 'lire')) {
229 $elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract'));
230}
231if (isModEnabled('ticket') && $user->hasRight('ticket', 'read')) {
232 $elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket'));
233}
234if (isModEnabled('expensereport') && $user->hasRight('expensereport', 'lire')) {
235 $elementList['expensereport_send'] = img_picto('', 'trip', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToExpenseReport'));
236}
237if (isModEnabled('agenda')) {
238 $elementList['actioncomm_send'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
239}
240if (isModEnabled('eventorganization') && $user->hasRight('eventorganization', 'read')) {
241 $elementList['conferenceorbooth'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
242}
243if (isModEnabled('partnership') && $user->hasRight('partnership', 'read')) {
244 $elementList['partnership_send'] = img_picto('', 'partnership', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToPartnership'));
245}
246
247$parameters = array('elementList' => $elementList);
248$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks
249if ($reshook == 0) {
250 foreach ($hookmanager->resArray as $item => $value) {
251 $elementList[$item] = $value;
252 }
253}
254
255$error = 0;
256
257$acceptlocallinktomedia = (acceptLocalLinktoMedia() > 0 ? 1 : 0);
258
259// Security
260if (!empty($user->socid)) {
262}
263
264$permissiontoadd = 1;
265$permissiontoedit = ($user->admin ? 1 : 0);
266$permissiontodelete = ($user->admin ? 1 : 0);
267if ($rowid > 0) {
268 $tmpmailtemplate = new ModelMail($db);
269 $tmpmailtemplate->fetch($rowid);
270 if ($tmpmailtemplate->fk_user == $user->id) {
271 $permissiontoedit = 1;
272 $permissiontodelete = 1;
273 }
274}
275
276
277/*
278 * Actions
279 */
280
281if (GETPOST('cancel', 'alpha')) {
282 $action = 'list';
283 $massaction = '';
284}
285if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
286 $massaction = '';
287}
288
289$parameters = array();
290$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
291if ($reshook < 0) {
292 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
293}
294
295if (empty($reshook)) {
296 // Selection of new fields
297 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
298
299 // Purge search criteria
300 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
301 // All tests are required to be compatible with all browsers
302 $search_label = '';
303 $search_type_template = '';
304 $search_lang = '';
305 $search_fk_user = '';
306 $search_topic = '';
307 $search_module = '';
308 $toselect = array();
309 $search_array_options = array();
310 }
311
312 // Actions add or modify an email template
313 if ((GETPOST('actionadd', 'alpha') && $permissiontoadd) || (GETPOST('actionmodify', 'alpha') && $permissiontoedit)) {
314 $listfield = explode(',', str_replace(' ', '', $tabfield[25]));
315 $listfieldinsert = explode(',', $tabfieldinsert[25]);
316 $listfieldmodify = explode(',', $tabfieldinsert[25]);
317 $listfieldvalue = explode(',', $tabfieldvalue[25]);
318
319 // Check that all fields are filled
320 $ok = 1;
321 foreach ($listfield as $f => $value) {
322 // Not mandatory fields
323 if (in_array($value, ['joinfiles', 'defaultfortype', 'content', 'content_lines', 'module'])) {
324 continue;
325 }
326
327 // Rename some POST variables into a generic name
328 if (GETPOST('actionmodify', 'alpha') && $value == 'topic') {
329 $_POST['topic'] = GETPOST('topic-'.$rowid);
330 }
331
332 if ((!GETPOSTISSET($value) || GETPOST($value) == '' || GETPOST($value) == '-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position') {
333 $ok = 0;
334 $fieldnamekey = $listfield[$f];
335 // We take translate key of field
336 if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) {
337 $fieldnamekey = 'Code';
338 }
339 if ($fieldnamekey == 'code') {
340 $fieldnamekey = 'Code';
341 }
342 if ($fieldnamekey == 'note') {
343 $fieldnamekey = 'Note';
344 }
345 if ($fieldnamekey == 'type_template') {
346 $fieldnamekey = 'TypeOfTemplate';
347 }
348 if ($fieldnamekey == 'fk_user') {
349 $fieldnamekey = 'Owner';
350 }
351 if ($fieldnamekey == 'private') {
352 $fieldnamekey = 'Private';
353 }
354 if ($fieldnamekey == 'position') {
355 $fieldnamekey = 'Position';
356 }
357 if ($fieldnamekey == 'topic') {
358 $fieldnamekey = 'Topic';
359 }
360
361 setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
362 $action = 'create';
363 }
364 }
365
366 // If previous test is ok action is add, we add the line
367 if ($ok && GETPOST('actionadd')) {
368 // Add new entry
369 $sql = "INSERT INTO ".$tabname[25]." (";
370 // List of fields
371 $sql .= $tabfieldinsert[25];
372 $sql .= ", active, enabled)";
373 $sql .= " VALUES(";
374
375 // List of values
376 $i = 0;
377 foreach ($listfieldinsert as $f => $value) {
378 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] : "";
379 if ($value == 'lang') {
380 $keycode = 'langcode';
381 }
382 if (empty($keycode)) {
383 $keycode = $value;
384 }
385
386 // Clean input variables
387 if ($value == 'entity') {
388 $_POST[$keycode] = $conf->entity;
389 }
390 if ($value == 'fk_user' && !($_POST[$keycode] > 0)) {
391 $_POST[$keycode] = '';
392 }
393 if ($value == 'private' && !is_numeric($_POST[$keycode])) {
394 $_POST[$keycode] = '0';
395 }
396 if ($value == 'position' && !is_numeric($_POST[$keycode])) {
397 $_POST[$keycode] = '1';
398 }
399 if ($value == 'defaultfortype' && !is_numeric($_POST[$keycode])) {
400 $_POST[$keycode] = '0';
401 }
402 //var_dump($keycode.' '.$value);
403
404 if ($i) {
405 $sql .= ", ";
406 }
407 if (GETPOST($keycode) == '' && $keycode != 'langcode') {
408 $sql .= "null"; // langcode must be '' if not defined so the unique key that include lang will work
409 } elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') {
410 $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
411 } elseif ($keycode == 'fk_user') {
412 if (!$user->admin) { // A non admin user can only edit its own template
413 $sql .= " ".((int) $user->id);
414 } else {
415 $sql .= " ".(GETPOSTINT($keycode));
416 }
417 } elseif ($keycode == 'content') {
418 $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
419 } elseif (in_array($keycode, array('joinfiles', 'defaultfortype', 'private', 'position', 'entity'))) {
420 $sql .= GETPOSTINT($keycode);
421 } else {
422 $sql .= "'".$db->escape(GETPOST($keycode, 'alphanohtml'))."'";
423 }
424 $i++;
425 }
426 $sql .= ", 1, 1)";
427
428 dol_syslog("actionadd", LOG_DEBUG);
429 $result = $db->query($sql);
430 if ($result) { // Add is ok
431 setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
432 $_POST = array('id' => 25); // Clean $_POST array, we keep only id
433 } else {
434 if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
435 setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
436 } else {
437 dol_print_error($db);
438 }
439 $action = 'create';
440 }
441 }
442
443 // We modify the line
444 if ($ok && GETPOST('actionmodify')) {
445 $rowidcol = "rowid";
446
447 if (GETPOSTINT('fk_user') <= 0 && GETPOST('private')) {
448 setEventMessages($langs->trans("AnOwnerMustBeSetIfEmailTemplateIsPrivate"), null, 'errors');
449 $error++;
450 $action = 'edit';
451 }
452
453 if (!$error) {
454 // Modify entry
455 $sql = "UPDATE ".$tabname[25]." SET ";
456 // Modify value of fields
457 $i = 0;
458 foreach ($listfieldmodify as $field) {
459 if ($field == 'entity') {
460 // entity not present on listfieldmodify array
461 $keycode = $field;
462 $_POST[$keycode] = $conf->entity;
463 } else {
464 $keycode = $listfieldvalue[$i];
465 }
466
467 if ($field == 'lang') {
468 $keycode = 'langcode';
469 }
470 if (empty($keycode)) {
471 $keycode = $field;
472 }
473
474 // Rename some POST variables into a generic name
475 if ($field == 'fk_user' && !(GETPOSTINT('fk_user') > 0)) {
476 $_POST['fk_user'] = '';
477 }
478 if ($field == 'topic') {
479 $_POST['topic'] = GETPOST('topic-'.$rowid);
480 }
481 if ($field == 'joinfiles') {
482 $_POST['joinfiles'] = GETPOST('joinfiles-'.$rowid);
483 }
484 if ($field == 'content') {
485 $_POST['content'] = GETPOST('content-'.$rowid, 'restricthtml');
486 }
487 if ($field == 'content_lines') {
488 $_POST['content_lines'] = GETPOST('content_lines-'.$rowid, 'restricthtml');
489 }
490
491 if ($i) {
492 $sql .= ", ";
493 }
494 $sql .= $field."=";
495
496 if (GETPOST($keycode) == '' || (!in_array($keycode, array('langcode', 'position', 'private', 'defaultfortype')) && !GETPOST($keycode))) {
497 $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work
498 } elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') {
499 $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
500 } elseif ($keycode == 'fk_user') {
501 if (!$user->admin) { // A non admin user can only edit its own template
502 $sql .= " ".((int) $user->id);
503 } else {
504 $sql .= " ".(GETPOSTINT($keycode));
505 }
506 } elseif ($keycode == 'content') {
507 $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
508 } elseif (in_array($keycode, array('joinfiles', 'defaultfortype', 'private', 'position'))) {
509 $sql .= GETPOSTINT($keycode);
510 } else {
511 $sql .= "'".$db->escape(GETPOST($keycode, 'alphanohtml'))."'";
512 }
513 $i++;
514 }
515
516 $sql .= " WHERE ".$db->escape($rowidcol)." = ".((int) $rowid);
517 if (!$user->admin) { // A non admin user can only edit its own template
518 $sql .= " AND fk_user = ".((int) $user->id);
519 }
520 //print $sql;exit;
521 dol_syslog("actionmodify", LOG_DEBUG);
522
523 //print $sql;
524 $resql = $db->query($sql);
525 if (!$resql) {
526 $error++;
527 setEventMessages($db->error(), null, 'errors');
528 $action = 'edit';
529 }
530 }
531
532 if (!$error) {
533 setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
534 }
535 }
536 }
537
538 if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontodelete) { // delete
539 $rowidcol = "rowid";
540
541 $sql = "DELETE from ".$tabname[25]." WHERE ".$rowidcol." = ".((int) $rowid);
542 if (!$user->admin) { // A non admin user can only edit its own template
543 $sql .= " AND fk_user = ".((int) $user->id);
544 }
545 dol_syslog("delete", LOG_DEBUG);
546 $result = $db->query($sql);
547 if (!$result) {
548 if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') {
549 setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
550 } else {
551 dol_print_error($db);
552 }
553 }
554 }
555
556 // activate
557 if ($action == $acts[0] && $permissiontoedit) {
558 $rowidcol = "rowid";
559
560 $sql = "UPDATE ".$tabname[25]." SET active = 1 WHERE rowid = ".((int) $rowid);
561
562 $result = $db->query($sql);
563 if (!$result) {
564 dol_print_error($db);
565 }
566 }
567
568 // disable
569 if ($action == $acts[1] && $permissiontoedit) {
570 $rowidcol = "rowid";
571
572 $sql = "UPDATE ".$tabname[25]." SET active = 0 WHERE rowid = ".((int) $rowid);
573
574 $result = $db->query($sql);
575 if (!$result) {
576 dol_print_error($db);
577 }
578 }
579}
580
581
582/*
583 * View
584 */
585
586$form = new Form($db);
587$formadmin = new FormAdmin($db);
588
589$now = dol_now();
590
591//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
592$help_url = '';
593if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
594 $title = $langs->trans("EMailsSetup");
595} else {
596 $title = $langs->trans("EMailTemplates");
597}
598$morejs = array();
599$morecss = array();
600
601$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
602$sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates";
603$sql .= " WHERE entity IN (".getEntity('email_template').")";
604if (!$user->admin) {
605 $sql .= " AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id)."))"; // Show only public and private to me
606 $sql .= " AND (active = 1 OR fk_user = ".((int) $user->id).")"; // Show only active or owned by me
607}
608if (!getDolGlobalInt('MAIN_MULTILANGS')) {
609 $sql .= " AND (lang = '".$db->escape($langs->defaultlang)."' OR lang IS NULL OR lang = '')";
610}
611if ($search_label) {
612 $sql .= natural_search('label', $search_label);
613}
614if ($search_type_template != '' && $search_type_template != '-1') {
615 $sql .= natural_search('type_template', $search_type_template);
616}
617if ($search_lang) {
618 $sql .= natural_search('lang', $search_lang);
619}
620if ($search_fk_user != '' && $search_fk_user != '-1') {
621 $sql .= natural_search('fk_user', $search_fk_user, 2);
622}
623if ($search_module) {
624 $sql .= natural_search('module', $search_module);
625}
626if ($search_topic) {
627 $sql .= natural_search('topic', $search_topic);
628}
629// If sort order is "country", we use country_code instead
630if ($sortfield == 'country') {
631 $sortfield = 'country_code';
632}
633$sql .= $db->order($sortfield, $sortorder);
634$sql .= $db->plimit($listlimit + 1, $offset);
635//print $sql;
636
637// Output page
638// --------------------------------------------------------------------
639
640llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-admin page-mails_templates');
641
642$arrayofselected = is_array($toselect) ? $toselect : array();
643
644$param = '';
645if (!empty($mode)) {
646 $param .= '&mode='.urlencode($mode);
647}
648if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
649 $param .= '&contextpage='.urlencode($contextpage);
650}
651if ($limit > 0 && $limit != $conf->liste_limit) {
652 $param .= '&limit='.((int) $limit);
653}
654if (!empty($search) && is_array($search)) {
655 foreach ($search as $key => $val) {
656 if (is_array($search[$key]) && count($search[$key])) {
657 foreach ($search[$key] as $skey) {
658 if ($skey != '') {
659 $param .= '&search_'.$key.'[]='.urlencode($skey);
660 }
661 }
662 } elseif ($search[$key] != '') {
663 $param .= '&search_'.$key.'='.urlencode($search[$key]);
664 }
665 }
666}
667if ($optioncss != '') {
668 $param .= '&optioncss='.urlencode($optioncss);
669}
670// Add $param from extra fields
671include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
672// Add $param from hooks
673$parameters = array();
674$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
675$param .= $hookmanager->resPrint;
676
677
678$linkback = '';
679$titlepicto = 'title_setup';
680
681
682$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=create';
683$newcardbutton = '';
684$newcardbutton .= dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
685
686
687if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
688 print load_fiche_titre($title, '', $titlepicto);
689} else {
690 print load_fiche_titre($title, $newcardbutton, $titlepicto);
691}
692
693if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
694 $head = email_admin_prepare_head();
695
696 print dol_get_fiche_head($head, 'templates', '', -1);
697
698 if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
699 print load_fiche_titre('', $newcardbutton, '');
700 }
701}
702
703
704// Confirm deletion of record
705if ($action == 'delete') {
706 print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
707}
708
709
710$fieldlist = explode(',', $tabfield[25]);
711
712if ($action == 'create') {
713 // If data was already input, we define them in obj to populate input fields.
714 $obj = new stdClass();
715 $obj->label = GETPOST('label');
716 $obj->lang = GETPOST('lang');
717 $obj->type_template = GETPOST('type_template');
718 $obj->fk_user = GETPOSTINT('fk_user');
719 $obj->private = GETPOSTINT('private');
720 $obj->position = GETPOST('position');
721 $obj->topic = GETPOST('topic');
722 $obj->joinfiles = GETPOST('joinfiles');
723 $obj->defaultfortype = GETPOST('defaultfortype') ? 1 : 0;
724 $obj->content = GETPOST('content', 'restricthtml');
725
726 // Form to add a new line
727 print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
728 print '<input type="hidden" name="token" value="'.newToken().'">';
729 print '<input type="hidden" name="action" value="add">';
730 print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
731
732 print '<div class="div-table-responsive-no-min">';
733 print '<table class="noborder centpercent">';
734
735 // Line to enter new values (title)
736 print '<tr class="liste_titre">';
737 foreach ($fieldlist as $field => $value) {
738 // Determine le nom du champ par rapport aux noms possibles
739 // dans les dictionnaires de donnees
740 $valuetoshow = ucfirst($fieldlist[$field]); // Par default
741 $valuetoshow = $langs->trans($valuetoshow); // try to translate
742 $css = "left";
743 if ($fieldlist[$field] == 'module') {
744 $valuetoshow = '&nbsp;';
745 }
746 if ($fieldlist[$field] == 'fk_user') {
747 $valuetoshow = $langs->trans("Owner");
748 }
749 if ($fieldlist[$field] == 'lang') {
750 $valuetoshow = (!getDolGlobalInt('MAIN_MULTILANGS') ? '&nbsp;' : $langs->trans("Language"));
751 }
752 if ($fieldlist[$field] == 'type') {
753 $valuetoshow = $langs->trans("Type");
754 }
755 if ($fieldlist[$field] == 'position') {
756 $css = 'center';
757 }
758 if ($fieldlist[$field] == 'code') {
759 $valuetoshow = $langs->trans("Code");
760 }
761 if ($fieldlist[$field] == 'label') {
762 $valuetoshow = $langs->trans("Code");
763 }
764 if ($fieldlist[$field] == 'type_template') {
765 $valuetoshow = $langs->trans("TypeOfTemplate");
766 $css = "center";
767 }
768 if (in_array($fieldlist[$field], array('private', 'private', 'defaultfortype'))) {
769 $css = 'center';
770 }
771
772 if ($fieldlist[$field] == 'topic') {
773 $valuetoshow = '';
774 }
775 if ($fieldlist[$field] == 'joinfiles') {
776 $valuetoshow = '';
777 }
778 if ($fieldlist[$field] == 'content') {
779 $valuetoshow = '';
780 }
781 if ($fieldlist[$field] == 'content_lines') {
782 $valuetoshow = '';
783 }
784 if ($valuetoshow != '') {
785 print '<th class="'.$css.'">';
786 if (!empty($tabhelp[25][$value]) && preg_match('/^http(s*):/i', $tabhelp[25][$value])) {
787 print '<a href="'.$tabhelp[25][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
788 } elseif (!empty($tabhelp[25][$value])) {
789 if (in_array($value, array('topic'))) {
790 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
791 } else {
792 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1, 'help', '', 0, 2); // Tooltip on hover
793 }
794 } else {
795 print $valuetoshow;
796 }
797 print '</th>';
798 }
799 }
800 print '<th>';
801 print '</th>';
802 print '</tr>';
803
804 $tmpaction = 'create';
805 $parameters = array(
806 'fieldlist' => $fieldlist,
807 'tabname' => $tabname[25]
808 );
809 $reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
810 $error = $hookmanager->error;
811 $errors = $hookmanager->errors;
812
813
814 // Line to enter new values (input fields)
815 print '<tr class="oddeven">';
816
817 if (empty($reshook)) {
818 if ($action == 'edit') {
819 fieldList($fieldlist, $obj, $tabname[25], 'hide');
820 } else {
821 fieldList($fieldlist, $obj, $tabname[25], 'add');
822 }
823 }
824 // Action column
825 print '<td class="right">';
826 print '</td>';
827 print "</tr>";
828
829 print '<tr class="oddeven nodrag nodrop nohover"><td colspan="9">';
830
831 // Show fields for topic, join files and body
832 $fieldsforcontent = array('topic', 'email_from', 'joinfiles', 'content');
833 if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) {
834 $fieldsforcontent = array('topic', 'email_from', 'joinfiles', 'content', 'content_lines');
835 }
836 foreach ($fieldsforcontent as $tmpfieldlist) {
837 // Topic of email
838 if ($tmpfieldlist == 'topic') {
839 print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
840 }
841 if ($tmpfieldlist == 'email_from') {
842 print $form->textwithpicto($langs->trans("MailFrom"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist);
843 }
844 if ($tmpfieldlist == 'joinfiles') {
845 print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
846 }
847 if ($tmpfieldlist == 'content') {
848 print $form->textwithpicto($langs->trans("Content"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
849 }
850 if ($tmpfieldlist == 'content_lines') {
851 print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
852 }
853
854 // Input field
855 if ($tmpfieldlist == 'topic') {
856 print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '').'">';
857 } elseif ($tmpfieldlist == 'email_from') {
858 print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '').'">';
859 } elseif ($tmpfieldlist == 'joinfiles') {
860 print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
861 } else {
862 $okforextended = true;
863 if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) {
864 $okforextended = false;
865 }
866 $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 400, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
867 print $doleditor->Create(1);
868 }
869 print '<br>';
870 }
871
872 print '</tr>';
873
874 print '</table>';
875
876 if ($action != 'edit') {
877 print '<center>';
878 print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'"> ';
879 print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
880 print '</center>';
881 }
882
883 print '</div>';
884 print '</form>';
885
886 print '<br><br><br>';
887}
888
889// List of available record in database
890dol_syslog("htdocs/admin/dict", LOG_DEBUG);
891$resql = $db->query($sql);
892if (!$resql) {
893 dol_print_error($db);
894 exit;
895}
896
897$num = $db->num_rows($resql);
898
899print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
900print '<input type="hidden" name="token" value="'.newToken().'">';
901print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
902
903print '<div class="div-table-responsive-no-min">';
904print '<table class="noborder centpercent">';
905
906$i = 0;
907
908$param = '';
909if ($search_label) {
910 $param .= '&search_label='.urlencode($search_label);
911}
912if (!empty($search_lang) && $search_lang != '-1') {
913 $param .= '&search_lang='.urlencode($search_lang);
914}
915if ($search_type_template != '-1') {
916 $param .= '&search_type_template='.urlencode($search_type_template);
917}
918if ($search_fk_user > 0) {
919 $param .= '&search_fk_user='.urlencode($search_fk_user);
920}
921if ($search_module) {
922 $param .= '&search_module='.urlencode($search_module);
923}
924if ($search_topic) {
925 $param .= '&search_topic='.urlencode($search_topic);
926}
927
928$paramwithsearch = $param;
929if ($sortorder) {
930 $paramwithsearch .= '&sortorder='.urlencode($sortorder);
931}
932if ($sortfield) {
933 $paramwithsearch .= '&sortfield='.urlencode($sortfield);
934}
935if (GETPOST('from', 'alpha')) {
936 $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
937}
938
939// There is several pages
940if ($num > $listlimit) {
941 print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
942 print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit ? 1 : 0), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
943 print '</td></tr>';
944}
945
946
947// Title line with search boxes
948print '<tr class="liste_titre">';
949// Action column
950if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
951 print '<td class="liste_titre center" width="64">';
952 $searchpicto = $form->showFilterButtons();
953 print $searchpicto;
954 print '</td>';
955}
956foreach ($fieldlist as $field => $value) {
957 if ($value == 'module') {
958 print '<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).'"></td>';
959 } elseif ($value == 'label') {
960 print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth75" value="'.dol_escape_htmltag($search_label).'"></td>';
961 } elseif ($value == 'lang') {
962 print '<td class="liste_titre">';
963 print $formadmin->select_language($search_lang, 'search_lang', 0, array(), 1, 0, 0, 'maxwidth100');
964 print '</td>';
965 } elseif ($value == 'fk_user') {
966 print '<td class="liste_titre">';
967 print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), array(), 0, 0, 0, '', 0, '', 'maxwidth100', 1);
968 print '</td>';
969 } elseif ($value == 'topic') {
970 print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
971 } elseif ($value == 'type_template') {
972 print '<td class="liste_titre center">';
973 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
974 print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth125', 1, '', 0, 1);
975 print '</td>';
976 } elseif (!in_array($value, array('content', 'content_lines'))) {
977 print '<td class="liste_titre"></td>';
978 }
979}
980/*if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
981 print '<td class="liste_titre"></td>';
982}*/
983// Status
984print '<td></td>';
985// Action column
986if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
987 print '<td class="liste_titre center" width="64">';
988 $searchpicto = $form->showFilterButtons();
989 print $searchpicto;
990 print '</td>';
991}
992print '</tr>';
993
994// Title of lines
995print '<tr class="liste_titre">';
996// Action column
997if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
998 print getTitleFieldOfList('');
999}
1000foreach ($fieldlist as $field => $value) {
1001 $showfield = 1; // By default
1002 $css = "left";
1003 $sortable = 1;
1004 $valuetoshow = '';
1005 $forcenowrap = 1;
1006 /*
1007 $tmparray=getLabelOfField($fieldlist[$field]);
1008 $showfield=$tmp['showfield'];
1009 $valuetoshow=$tmp['valuetoshow'];
1010 $css=$tmp['align'];
1011 $sortable=$tmp['sortable'];
1012 */
1013 $valuetoshow = ucfirst($fieldlist[$field]); // By default
1014 $valuetoshow = $langs->trans($valuetoshow); // try to translate
1015 if ($fieldlist[$field] == 'module') {
1016 $css = 'tdoverflowmax100';
1017 }
1018 if ($fieldlist[$field] == 'fk_user') {
1019 $valuetoshow = $langs->trans("Owner");
1020 }
1021 if ($fieldlist[$field] == 'lang') {
1022 $valuetoshow = $langs->trans("Language");
1023 }
1024 if ($fieldlist[$field] == 'type') {
1025 $valuetoshow = $langs->trans("Type");
1026 }
1027 if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
1028 $valuetoshow = $langs->trans("Code");
1029 }
1030 if ($fieldlist[$field] == 'type_template') {
1031 $css = 'center';
1032 $valuetoshow = $langs->trans("TypeOfTemplate");
1033 }
1034 if ($fieldlist[$field] == 'private') {
1035 $css = 'center';
1036 }
1037 if ($fieldlist[$field] == 'position') {
1038 $css = 'center';
1039 }
1040
1041 if ($fieldlist[$field] == 'joinfiles') {
1042 $valuetoshow = $langs->trans("FilesAttachedToEmail");
1043 $css = 'center';
1044 $forcenowrap = 0;
1045 }
1046 if ($fieldlist[$field] == 'content') {
1047 $valuetoshow = $langs->trans("Content");
1048 $showfield = 0;
1049 }
1050 if ($fieldlist[$field] == 'content_lines') {
1051 $valuetoshow = $langs->trans("ContentForLines");
1052 $showfield = 0;
1053 }
1054
1055 // Show fields
1056 if ($showfield) {
1057 if (!empty($tabhelp[25][$value])) {
1058 if (in_array($value, array('topic'))) {
1059 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
1060 } else {
1061 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
1062 }
1063 }
1064 $sortfieldtouse = ($sortable ? $fieldlist[$field] : '');
1065 if ($sortfieldtouse == 'type_template') {
1066 $sortfieldtouse .= ',lang,position,label';
1067 }
1068 print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], $sortfieldtouse, ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $css.' ');
1069 }
1070}
1071
1072print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
1073// Action column
1074if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1075 print getTitleFieldOfList('');
1076}
1077print '</tr>';
1078
1079$nbqualified = 0;
1080if ($num) {
1081 // Lines with values
1082 while ($i < $num) {
1083 $obj = $db->fetch_object($resql);
1084
1085 if ($obj) {
1086 if (($action == 'edit' || $action == 'preview') && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1087 print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
1088
1089 $tmpaction = 'edit';
1090 $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[25]);
1091 $reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
1092 $error = $hookmanager->error;
1093 $errors = $hookmanager->errors;
1094
1095 // Action column
1096 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1097 print '<td class="center">';
1098 print '<input type="hidden" name="page" value="'.$page.'">';
1099 print '<input type="hidden" name="rowid" value="'.$rowid.'">';
1100 if ($action == 'edit') {
1101 print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
1102 }
1103 print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
1104 print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
1105 print '</td>';
1106 }
1107 // Show main fields
1108 if (empty($reshook)) {
1109 fieldList($fieldlist, $obj, $tabname[25], $action);
1110 }
1111 // Action column
1112 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1113 print '<td class="center">';
1114 print '<input type="hidden" name="page" value="'.$page.'">';
1115 print '<input type="hidden" name="rowid" value="'.$rowid.'">';
1116 if ($action == 'edit') {
1117 print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
1118 }
1119 print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
1120 print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
1121 print '</td>';
1122 }
1123 print "</tr>\n";
1124
1125 print '<tr class="oddeven nohover" id="tr-aaa-'.$rowid.'">';
1126 print '<td colspan="10">';
1127
1128 $fieldsforcontent = array('topic', 'email_from','joinfiles', 'content');
1129 if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) {
1130 $fieldsforcontent[] = 'content_lines';
1131 }
1132 foreach ($fieldsforcontent as $tmpfieldlist) {
1133 $showfield = 1;
1134 $css = "left";
1135 $valuetoshow = $obj->$tmpfieldlist;
1136
1137 $class = 'tddict';
1138 // Show value for field
1139 if ($showfield) {
1140 // Show line for topic, joinfiles and content
1141 if ($tmpfieldlist == 'topic') {
1142 print '<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</div> ';
1143 print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'"'.($action != 'edit' ? ' disabled' : '').'>';
1144 print '<br>'."\n";
1145 }
1146 if ($tmpfieldlist == 'email_from') {
1147 print '<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</div> ';
1148 print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'"'.($action != 'edit' ? ' disabled' : '').'>';
1149 print '<br>'."\n";
1150 }
1151 if ($tmpfieldlist == 'joinfiles') {
1152 print '<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</div> ';
1153 print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, ($action != 'edit'), 0, 1);
1154 print '<br>'."\n";
1155 }
1156
1157 if ($tmpfieldlist == 'content') {
1158 print $form->textwithpicto($langs->trans("Content"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
1159 $okforextended = true;
1160 if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) {
1161 $okforextended = false;
1162 }
1163 $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%', ($action != 'edit' ? 1 : 0));
1164 print $doleditor->Create(1);
1165 }
1166 if ($tmpfieldlist == 'content_lines') {
1167 print '<br>'."\n";
1168 print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
1169 $okforextended = true;
1170 if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) {
1171 $okforextended = false;
1172 }
1173 $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
1174 print $doleditor->Create(1);
1175 }
1176 }
1177 }
1178 print '</td>';
1179 print '<td></td>';
1180 print '<td></td>';
1181
1182 print "</tr>\n";
1183
1184 $nbqualified++;
1185 } else {
1186 // If template is for a module, check module is enabled.
1187 if ($obj->module) {
1188 $tempmodulekey = $obj->module;
1189 if (empty($conf->$tempmodulekey) || !isModEnabled($tempmodulekey)) {
1190 $i++;
1191 continue;
1192 }
1193 }
1194
1195 $keyforobj = 'type_template';
1196 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1197 $i++;
1198 continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
1199 }
1200 // Test on 'enabled'
1201 if (! (int) dol_eval($obj->enabled, 1, 1, '1')) {
1202 $i++;
1203 continue; // Email template not qualified
1204 }
1205
1206 $nbqualified++;
1207
1208 // Can an entry be erased or disabled ?
1209 $iserasable = 1;
1210 $canbedisabled = 1;
1211 $canbemodified = 1; // true by default
1212 if (!$user->admin && $obj->fk_user != $user->id) {
1213 $iserasable = 0;
1214 $canbedisabled = 0;
1215 $canbemodified = 0;
1216 }
1217
1218 $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).(!empty($obj->code) ? '&code='.urlencode($obj->code) : '');
1219 if ($param) {
1220 $url .= '&'.$param;
1221 }
1222
1223 print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
1224
1225 // Action column - Modify link / Delete link
1226 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1227 print '<td class="center nowraponall" width="64">';
1228 if ($canbemodified) {
1229 print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
1230 } else {
1231 print '<a class="reposition editfielda" href="'.$url.'&action=preview&token='.newToken().'">'.img_view().'</a>';
1232 }
1233 if ($iserasable) {
1234 print '<a class="reposition marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
1235 //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
1236 }
1237 print '</td>';
1238 }
1239
1240 $tmpaction = 'view';
1241 $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[25]);
1242 $reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
1243
1244 $error = $hookmanager->error;
1245 $errors = $hookmanager->errors;
1246
1247 if (empty($reshook)) {
1248 foreach ($fieldlist as $field => $value) {
1249 if (in_array($fieldlist[$field], array('content', 'content_lines'))) {
1250 continue;
1251 }
1252 $showfield = 1;
1253 $css = "";
1254 $class = "tddict";
1255 $title = '';
1256 $tmpvar = $fieldlist[$field];
1257 $valuetoshow = $obj->$tmpvar;
1258 if ($value == 'label' || $value == 'topic') {
1259 if ($langs->trans($valuetoshow) != $valuetoshow) {
1260 $valuetoshow = $langs->trans($valuetoshow);
1261 }
1262 $valuetoshow = dol_escape_htmltag($valuetoshow);
1263 }
1264 if ($value == 'label') {
1265 $class .= ' tdoverflowmax200';
1266 }
1267 if ($value == 'topic') {
1268 $class .= ' tdoverflowmax200 small';
1269 }
1270 if ($value == 'type_template') {
1271 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1272 $css = "center tdoverflowmax150";
1273 }
1274 if ($value == 'lang' && $valuetoshow) {
1275 $valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
1276 $class .= ' tdoverflowmax100';
1277 }
1278 if ($value == 'fk_user') {
1279 if ($valuetoshow > 0) {
1280 $fuser = new User($db);
1281 $fuser->fetch($valuetoshow);
1282 $valuetoshow = $fuser->getNomUrl(-1);
1283 $class .= ' tdoverflowmax100';
1284 }
1285 }
1286 if ($value == 'private') {
1287 $css = "center";
1288 if ($valuetoshow) {
1289 $valuetoshow = yn($valuetoshow);
1290 } else {
1291 $valuetoshow = '';
1292 }
1293 }
1294 if ($value == 'position') {
1295 $css = "center";
1296 }
1297 if (in_array($value, array('joinfiles', 'defaultfortype'))) {
1298 $css = "center";
1299 if ($valuetoshow) {
1300 //$valuetoshow = yn(1);
1301 $valuetoshow = '<input type="checkbox" checked="checked" disabled>';
1302 } else {
1303 $valuetoshow = '';
1304 }
1305 }
1306 if ($css) {
1307 $class .= ' '.$css;
1308 }
1309
1310 // Show value for field
1311 if ($showfield) {
1312 print '<!-- '.$fieldlist[$field].' -->';
1313 print '<td class="'.$class.'"';
1314 if (in_array($value, array('code', 'label', 'topic'))) {
1315 print ' title="'.dol_escape_htmltag($valuetoshow).'"';
1316 }
1317 print '>';
1318 print $valuetoshow;
1319 print '</td>';
1320 }
1321 }
1322 }
1323
1324 // Status / Active
1325 print '<td class="center nowrap">';
1326 if ($canbedisabled) {
1327 print '<a class="reposition" href="'.$url.'&action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
1328 } else {
1329 print '<span class="opacitymedium">'.$actl[$obj->active].'</span>';
1330 }
1331 print "</td>";
1332
1333 // Action column - Modify link / Delete link
1334 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1335 print '<td class="center nowraponall" width="64">';
1336 if ($canbemodified) {
1337 print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
1338 }
1339 if ($iserasable) {
1340 print '<a class="reposition marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
1341 //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
1342 }
1343 print '</td>';
1344 }
1345
1346 print "</tr>\n";
1347 }
1348 }
1349
1350 $i++;
1351 }
1352}
1353
1354// If no record found
1355if ($nbqualified == 0) {
1356 $colspan = 12;
1357 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1358}
1359
1360print '</table>';
1361print '</div>';
1362
1363print '</form>';
1364
1365
1366if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
1367 print dol_get_fiche_end();
1368}
1369
1370
1371// End of page
1372llxFooter();
1373$db->close();
1374
1375
1385function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
1386{
1387 global $langs, $user, $db;
1388 global $form;
1389 global $elementList;
1390
1391 $formadmin = new FormAdmin($db);
1392
1393 foreach ($fieldlist as $field => $value) {
1394 //print $value;
1395 if ($value == 'module') {
1396 print '<td></td>';
1397 } elseif ($value == 'fk_user') {
1398 print '<td>';
1399 if ($user->admin && $context != 'preview') {
1400 print $form->select_dolusers(GETPOSTISSET('fk_user') ? GETPOSTINT('fk_user') : (empty($obj->$value) ? '' : $obj->$value), 'fk_user', 1, array(), 0, ($user->admin ? '' : 'hierarchyme'), array(), 0, 0, 0, '', 0, '', 'minwidth75 maxwidth100');
1401 } else {
1402 if ($context == 'add') { // I am not admin and we show the add form
1403 print $user->getNomUrl(-1); // Me
1404 $forcedvalue = $user->id;
1405 } else {
1406 if ($obj && !empty($obj->$value) && $obj->$value > 0) {
1407 $fuser = new User($db);
1408 $fuser->fetch($obj->$value);
1409 print $fuser->getNomUrl(-1);
1410 $forcedvalue = $fuser->id;
1411 } else {
1412 $forcedvalue = $obj->$value;
1413 }
1414 }
1415 $keyname = $value;
1416 print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">';
1417 }
1418 print '</td>';
1419 } elseif ($value == 'lang') {
1420 print '<td>';
1421 if (getDolGlobalInt('MAIN_MULTILANGS') && $context != 'preview') {
1422 $selectedlang = GETPOSTISSET('langcode') ? GETPOST('langcode', 'aZ09') : $langs->defaultlang;
1423 if ($context == 'edit') {
1424 $selectedlang = $obj->lang;
1425 }
1426 print $formadmin->select_language($selectedlang, 'langcode', 0, array(), 1, 0, 0, 'maxwidth100');
1427 } else {
1428 if (!empty($obj->lang)) {
1429 print $obj->lang.' - '.$langs->trans('Language_'.$obj->lang);
1430 }
1431 $keyname = $value;
1432 if ($keyname == 'lang') {
1433 $keyname = 'langcode'; // Avoid conflict with lang param
1434 }
1435 print '<input type="hidden" value="'.(empty($obj->lang) ? '' : $obj->lang).'" name="'.$keyname.'">';
1436 }
1437 print '</td>';
1438 } elseif ($value == 'type_template') {
1439 // Le type de template
1440 print '<td class="center">';
1441 if (($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) || $context == 'preview') {
1442 // Current template type is an unknown type, so we must keep it as it is.
1443 print '<input type="hidden" name="type_template" value="'.$obj->type_template.'">';
1444 print $obj->type_template;
1445 } else {
1446 print $form->selectarray('type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template : ''), 1, 0, 0, '', 0, 0, 0, '', 'minwidth75 maxwidth125', 1, '', 0, 1);
1447 }
1448 print '</td>';
1449 } elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
1450 //print '<td></td>';
1451 } elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
1452 print '<td></td>';
1453 } elseif ($context == 'preview' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
1454 print '<td></td>';
1455 } elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
1456 //print '<td></td>';
1457 } else {
1458 $size = '';
1459 $class = '';
1460 $classtd = '';
1461 if ($value == 'code') {
1462 $class = 'maxwidth100';
1463 }
1464 if ($value == 'label') {
1465 $class = 'maxwidth200';
1466 }
1467 if ($value == 'private') {
1468 $class = 'maxwidth50';
1469 $classtd = 'center';
1470 }
1471 if ($value == 'position') {
1472 $class = 'maxwidth50 center';
1473 $classtd = 'center';
1474 }
1475 if ($value == 'topic') {
1476 $class = 'quatrevingtpercent';
1477 }
1478 if ($value == 'defaultfortype') {
1479 $class = 'width25 center';
1480 $classtd = 'center';
1481 }
1482
1483 print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>';
1484 if ($value == 'private' && $context != 'preview') {
1485 if (empty($user->admin)) {
1486 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
1487 print $form->selectyesno($value, GETPOSTISSET($value) ? GETPOSTINT($value) : (($context != 'add' && isset($obj->$value)) ? $obj->$value : '1'), 1, false, 0, 1);
1488 } else {
1489 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
1490 print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value : ''), 1, false, 0, 1);
1491 }
1492 } else {
1493 print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'. $value .'"'.($context == 'preview' ? ' disabled' : '').'>';
1494 }
1495 print '</td>';
1496 }
1497 }
1498}
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
email_admin_prepare_head()
Return array head with list of tabs to view object information.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to manage a WYSIWYG editor.
Class to generate html code for admin pages.
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
static getAvailableSubstitKey($mode='formemail', $object=null)
Get list of substitution keys available for emails.
Object of table llx_c_email_templates.
Class to manage Dolibarr users.
llxFooter()
Footer empty.
Definition document.php:107
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0, $hideselectlimit=0, $beforearrows='', $hidenavigation=0)
Function to show navigation arrows into lists.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_view($titlealt='default', $float=0, $other='class="valignmiddle"')
Show logo view card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
fieldList($fieldlist, $obj=null, $tabname='', $context='')
Show fields in insert/edit mode.
$context
@method int call_trigger(string $triggerName, User $user)
Definition logout.php:42
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.