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