37require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
47$langsArray = array(
"errors",
"admin",
"mails",
"languages");
49if (isModEnabled(
'member')) {
50 $langsArray[] =
'members';
52if (isModEnabled(
'eventorganization')) {
53 $langsArray[] =
'eventorganization';
56$langs->loadLangs($langsArray);
58$toselect =
GETPOST(
'toselect',
'array');
59$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
60$massaction =
GETPOST(
'massaction',
'alpha');
61$confirm =
GETPOST(
'confirm',
'alpha');
63$optioncss =
GETPOST(
'optioncss',
'alpha');
66$search_label =
GETPOST(
'search_label',
'alphanohtml');
67$search_type_template =
GETPOST(
'search_type_template',
'alpha');
68$search_lang =
GETPOST(
'search_lang',
'alpha');
69$search_fk_user =
GETPOST(
'search_fk_user',
'intcomma');
70$search_topic =
GETPOST(
'search_topic',
'alpha');
71$search_module =
GETPOST(
'search_module',
'alpha');
77$actl[0] =
img_picto($langs->trans(
"Disabled"),
'switch_off',
'class="size15x"');
78$actl[1] =
img_picto($langs->trans(
"Activated"),
'switch_on',
'class="size15x"');
80$listoffset =
GETPOST(
'listoffset',
'alpha');
81$listlimit =
GETPOST(
'listlimit',
'alpha') > 0 ?
GETPOST(
'listlimit',
'alpha') : 1000;
84$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
85$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
87if (empty($page) || $page == -1) {
90$offset = $listlimit * $page;
94if (empty($sortfield)) {
95 $sortfield =
'type_template,lang,position,label';
97if (empty($sortorder)) {
102$hookmanager->initHooks(array(
'emailtemplates'));
107$tabname[25] = MAIN_DB_PREFIX.
"c_email_templates";
111$tabfield[25] =
"label,lang,type_template,fk_user,private,position,module,topic,joinfiles,defaultfortype,content";
113 $tabfield[25] .=
',content_lines';
117$tabfieldvalue = array();
118$tabfieldvalue[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
120 $tabfieldvalue[25] .=
',content_lines';
124$tabfieldinsert = array();
125$tabfieldinsert[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
127 $tabfieldinsert[25] .=
',content_lines';
129$tabfieldinsert[25] .=
',entity';
137require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
141 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
142 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
143 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
144 foreach ($tmp as $key => $val) {
145 $helpsubstit .= $key.
' -> '.$val.
'<br>';
146 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
150 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
151 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
152 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
153 foreach ($tmp as $key => $val) {
154 $helpsubstit .= $key.
' -> '.$val.
'<br>';
157 foreach ($tmp as $key => $val) {
158 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
165 'label' => $langs->trans(
'EnterAnyCode'),
166 'type_template' => $langs->trans(
"TemplateForElement"),
167 'private' => $langs->trans(
"TemplateIsVisibleByOwnerOnly"),
168 'position' => $langs->trans(
"PositionIntoComboList"),
169 'topic' =>
'<span class="small">'.$helpsubstit.
'</span>',
170 'email_from' => $langs->trans(
'ForceEmailFrom'),
171 'joinfiles' => $langs->trans(
'AttachMainDocByDefault'),
172 'defaultfortype' => $langs->trans(
"DefaultForTypeDesc"),
173 'content' =>
'<span class="small">'.$helpsubstit.
'</span>',
174 'content_lines' =>
'<span class="small">'.$helpsubstitforlines.
'</span>'
179$elementList = array();
182$elementList[
'all'] =
'-- '.dol_escape_htmltag($langs->trans(
"All")).
' --';
183$elementList[
'none'] =
'-- '.dol_escape_htmltag($langs->trans(
"None")).
' --';
184$elementList[
'user'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToUser'));
185if (isModEnabled(
'member') && $user->hasRight(
'adherent',
'lire')) {
186 $elementList[
'member'] =
img_picto(
'',
'object_member',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToMember'));
188if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
189 $elementList[
'recruitmentcandidature_send'] =
img_picto(
'',
'recruitmentcandidature',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'RecruitmentCandidatures'));
191if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
192 $elementList[
'thirdparty'] =
img_picto(
'',
'company',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToThirdparty'));
194if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'contact',
'lire')) {
195 $elementList[
'contact'] =
img_picto(
'',
'contact',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToContact'));
197if (isModEnabled(
'project')) {
198 $elementList[
'project'] =
img_picto(
'',
'project',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToProject'));
200if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
201 $elementList[
'propal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendProposal'));
203if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
204 $elementList[
'order_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendOrder'));
206if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
207 $elementList[
'facture_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendInvoice'));
209if (isModEnabled(
"shipping")) {
210 $elementList[
'shipping_send'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendShipment'));
212if (isModEnabled(
"reception")) {
213 $elementList[
'reception_send'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendReception'));
215if (isModEnabled(
'intervention')) {
216 $elementList[
'fichinter_send'] =
img_picto(
'',
'intervention',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendIntervention'));
218if (isModEnabled(
'supplier_proposal')) {
219 $elementList[
'supplier_proposal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierRequestForQuotation'));
221if (isModEnabled(
"supplier_order") && ($user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'read'))) {
222 $elementList[
'order_supplier_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierOrder'));
224if (isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
225 $elementList[
'invoice_supplier_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierInvoice'));
227if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
228 $elementList[
'contract'] =
img_picto(
'',
'contract',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendContract'));
230if (isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
231 $elementList[
'ticket_send'] =
img_picto(
'',
'ticket',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToTicket'));
233if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
234 $elementList[
'expensereport_send'] =
img_picto(
'',
'trip',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToExpenseReport'));
236if (isModEnabled(
'agenda')) {
237 $elementList[
'actioncomm_send'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventPush'));
239if (isModEnabled(
'eventorganization') && $user->hasRight(
'eventorganization',
'read')) {
240 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventOrganization'));
242if (isModEnabled(
'partnership') && $user->hasRight(
'partnership',
'read')) {
243 $elementList[
'partnership_send'] =
img_picto(
'',
'partnership',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToPartnership'));
246$parameters = array(
'elementList' => $elementList);
247$reshook = $hookmanager->executeHooks(
'emailElementlist', $parameters);
249 foreach ($hookmanager->resArray as $item => $value) {
250 $elementList[$item] = $value;
259if (!empty($user->socid)) {
264$permissiontoedit = ($user->admin ? 1 : 0);
265$permissiontodelete = ($user->admin ? 1 : 0);
268 $tmpmailtemplate->fetch($rowid);
269 if ($tmpmailtemplate->fk_user == $user->id) {
270 $permissiontoedit = 1;
271 $permissiontodelete = 1;
280if (
GETPOST(
'cancel',
'alpha')) {
284if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
288$parameters = array();
289$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
294if (empty($reshook)) {
296 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
299 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
302 $search_type_template =
'';
304 $search_fk_user =
'';
308 $search_array_options = array();
312 if ((
GETPOST(
'actionadd',
'alpha') && $permissiontoadd) || (
GETPOST(
'actionmodify',
'alpha') && $permissiontoedit)) {
313 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[25]));
314 $listfieldinsert = explode(
',', $tabfieldinsert[25]);
315 $listfieldmodify = explode(
',', $tabfieldinsert[25]);
316 $listfieldvalue = explode(
',', $tabfieldvalue[25]);
320 foreach ($listfield as $f => $value) {
322 if (in_array($value, [
'joinfiles',
'defaultfortype',
'content',
'content_lines',
'module'])) {
327 if (
GETPOST(
'actionmodify',
'alpha') && $value ==
'topic') {
328 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
331 if ((!GETPOSTISSET($value) ||
GETPOST($value) ==
'' ||
GETPOST($value) ==
'-1') && $value !=
'lang' && $value !=
'fk_user' && $value !=
'position') {
333 $fieldnamekey = $listfield[$f];
335 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
336 $fieldnamekey =
'Code';
338 if ($fieldnamekey ==
'code') {
339 $fieldnamekey =
'Code';
341 if ($fieldnamekey ==
'note') {
342 $fieldnamekey =
'Note';
344 if ($fieldnamekey ==
'type_template') {
345 $fieldnamekey =
'TypeOfTemplate';
347 if ($fieldnamekey ==
'fk_user') {
348 $fieldnamekey =
'Owner';
350 if ($fieldnamekey ==
'private') {
351 $fieldnamekey =
'Private';
353 if ($fieldnamekey ==
'position') {
354 $fieldnamekey =
'Position';
356 if ($fieldnamekey ==
'topic') {
357 $fieldnamekey =
'Topic';
360 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
366 if ($ok &&
GETPOST(
'actionadd')) {
368 $sql =
"INSERT INTO ".$tabname[25].
" (";
370 $sql .= $tabfieldinsert[25];
371 $sql .=
", active, enabled)";
376 foreach ($listfieldinsert as $f => $value) {
377 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
"";
378 if ($value ==
'lang') {
379 $keycode =
'langcode';
381 if (empty($keycode)) {
386 if ($value ==
'entity') {
387 $_POST[$keycode] = $conf->entity;
389 if ($value ==
'fk_user' && !($_POST[$keycode] > 0)) {
390 $_POST[$keycode] =
'';
392 if ($value ==
'private' && !is_numeric($_POST[$keycode])) {
393 $_POST[$keycode] =
'0';
395 if ($value ==
'position' && !is_numeric($_POST[$keycode])) {
396 $_POST[$keycode] =
'1';
398 if ($value ==
'defaultfortype' && !is_numeric($_POST[$keycode])) {
399 $_POST[$keycode] =
'0';
406 if (
GETPOST($keycode) ==
'' && $keycode !=
'langcode') {
408 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
410 } elseif ($keycode ==
'fk_user') {
412 $sql .=
" ".((int) $user->id);
414 $sql .=
" ".(GETPOSTINT($keycode));
416 } elseif ($keycode ==
'content') {
417 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
418 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position',
'entity'))) {
421 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
428 $result = $db->query($sql);
431 $_POST = array(
'id' => 25);
433 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
434 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
443 if ($ok &&
GETPOST(
'actionmodify')) {
447 setEventMessages($langs->trans(
"AnOwnerMustBeSetIfEmailTemplateIsPrivate"),
null,
'errors');
454 $sql =
"UPDATE ".$tabname[25].
" SET ";
457 foreach ($listfieldmodify as $field) {
458 if ($field ==
'entity') {
461 $_POST[$keycode] = $conf->entity;
463 $keycode = $listfieldvalue[$i];
466 if ($field ==
'lang') {
467 $keycode =
'langcode';
469 if (empty($keycode)) {
474 if ($field ==
'fk_user' && !(
GETPOSTINT(
'fk_user') > 0)) {
475 $_POST[
'fk_user'] =
'';
477 if ($field ==
'topic') {
478 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
480 if ($field ==
'joinfiles') {
481 $_POST[
'joinfiles'] =
GETPOST(
'joinfiles-'.$rowid);
483 if ($field ==
'content') {
484 $_POST[
'content'] =
GETPOST(
'content-'.$rowid,
'restricthtml');
486 if ($field ==
'content_lines') {
487 $_POST[
'content_lines'] =
GETPOST(
'content_lines-'.$rowid,
'restricthtml');
489 if ($field ==
'email_from') {
490 $_POST[
'email_from'] =
GETPOST(
'email_from-'.$rowid,
'restricthtml');
498 if (
GETPOST($keycode) ==
'' || (!in_array($keycode, array(
'langcode',
'position',
'private',
'defaultfortype')) && !
GETPOST($keycode))) {
500 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
502 } elseif ($keycode ==
'fk_user') {
504 $sql .=
" ".((int) $user->id);
506 $sql .=
" ".(GETPOSTINT($keycode));
508 } elseif ($keycode ==
'content') {
509 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
510 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position'))) {
513 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
518 $sql .=
" WHERE ".$db->escape($rowidcol).
" = ".((int) $rowid);
520 $sql .=
" AND fk_user = ".((int) $user->id);
526 $resql = $db->query($sql);
540 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
543 $sql =
"DELETE from ".$tabname[25].
" WHERE ".$rowidcol.
" = ".((int) $rowid);
545 $sql .=
" AND fk_user = ".((int) $user->id);
548 $result = $db->query($sql);
550 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
551 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
559 if ($action == $acts[0] && $permissiontoedit) {
562 $sql =
"UPDATE ".$tabname[25].
" SET active = 1 WHERE rowid = ".((int) $rowid);
564 $result = $db->query($sql);
571 if ($action == $acts[1] && $permissiontoedit) {
574 $sql =
"UPDATE ".$tabname[25].
" SET active = 0 WHERE rowid = ".((int) $rowid);
576 $result = $db->query($sql);
588$form =
new Form($db);
595if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
596 $title = $langs->trans(
"EMailsSetup");
598 $title = $langs->trans(
"EMailTemplates");
603$sql =
"SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
604$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_email_templates";
605$sql .=
" WHERE entity IN (".getEntity(
'email_template').
")";
607 $sql .=
" AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id).
"))";
608 $sql .=
" AND (active = 1 OR fk_user = ".((int) $user->id).
")";
611 $sql .=
" AND (lang = '".$db->escape($langs->defaultlang).
"' OR lang IS NULL OR lang = '')";
616if ($search_type_template !=
'' && $search_type_template !=
'-1') {
622if ($search_fk_user !=
'' && $search_fk_user !=
'-1') {
632if ($sortfield ==
'country') {
633 $sortfield =
'country_code';
635$sql .= $db->order($sortfield, $sortorder);
636$sql .= $db->plimit($listlimit + 1, $offset);
642llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-admin page-mails_templates');
644$arrayofselected = is_array($toselect) ? $toselect : array();
648 $param .=
'&mode='.urlencode($mode);
650if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
651 $param .=
'&contextpage='.urlencode($contextpage);
653if ($limit > 0 && $limit != $conf->liste_limit) {
654 $param .=
'&limit='.((int) $limit);
656if (!empty($search) && is_array($search)) {
657 foreach ($search as $key => $val) {
658 if (is_array($search[$key]) && count($search[$key])) {
659 foreach ($search[$key] as $skey) {
661 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
664 } elseif ($search[$key] !=
'') {
665 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
669if ($optioncss !=
'') {
670 $param .=
'&optioncss='.urlencode($optioncss);
673include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
675$parameters = array();
676$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object);
677$param .= $hookmanager->resPrint;
681$titlepicto =
'title_setup';
684$url = DOL_URL_ROOT.
'/admin/mails_templates.php?action=create';
686$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewEMailTemplate'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
689if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
695if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
700 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
707if ($action ==
'delete') {
708 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);
712$fieldlist = explode(
',', $tabfield[25]);
714if ($action ==
'create') {
717 $obj->label =
GETPOST(
'label');
719 $obj->type_template =
GETPOST(
'type_template');
722 $obj->position =
GETPOST(
'position');
723 $obj->topic =
GETPOST(
'topic');
724 $obj->joinfiles =
GETPOST(
'joinfiles');
725 $obj->defaultfortype =
GETPOST(
'defaultfortype') ? 1 : 0;
726 $obj->content =
GETPOST(
'content',
'restricthtml');
729 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
730 print
'<input type="hidden" name="token" value="'.newToken().
'">';
731 print
'<input type="hidden" name="action" value="add">';
732 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
734 print
'<div class="div-table-responsive-no-min">';
735 print
'<table class="noborder centpercent">';
738 print
'<tr class="liste_titre">';
739 foreach ($fieldlist as $field => $value) {
742 $valuetoshow = ucfirst($fieldlist[$field]);
743 $valuetoshow = $langs->trans($valuetoshow);
745 if ($fieldlist[$field] ==
'module') {
746 $valuetoshow =
' ';
748 if ($fieldlist[$field] ==
'fk_user') {
749 $valuetoshow = $langs->trans(
"Owner");
751 if ($fieldlist[$field] ==
'lang') {
752 $valuetoshow = (!
getDolGlobalInt(
'MAIN_MULTILANGS') ?
' ' : $langs->trans(
"Language"));
754 if ($fieldlist[$field] ==
'type') {
755 $valuetoshow = $langs->trans(
"Type");
757 if ($fieldlist[$field] ==
'position') {
760 if ($fieldlist[$field] ==
'code') {
761 $valuetoshow = $langs->trans(
"Code");
763 if ($fieldlist[$field] ==
'label') {
764 $valuetoshow = $langs->trans(
"Code");
766 if ($fieldlist[$field] ==
'type_template') {
767 $valuetoshow = $langs->trans(
"TypeOfTemplate");
770 if (in_array($fieldlist[$field], array(
'private',
'private',
'defaultfortype'))) {
774 if ($fieldlist[$field] ==
'topic') {
777 if ($fieldlist[$field] ==
'joinfiles') {
780 if ($fieldlist[$field] ==
'content') {
783 if ($fieldlist[$field] ==
'content_lines') {
786 if ($valuetoshow !=
'') {
787 print
'<th class="'.$css.
'">';
788 if (!empty($tabhelp[25][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[25][$value])) {
789 print
'<a href="'.$tabhelp[25][$value].
'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
790 } elseif (!empty($tabhelp[25][$value])) {
791 if (in_array($value, array(
'topic'))) {
792 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2, $value);
794 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2);
806 $tmpaction =
'create';
808 'fieldlist' => $fieldlist,
809 'tabname' => $tabname[25]
811 $reshook = $hookmanager->executeHooks(
'createEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
812 $error = $hookmanager->error;
813 $errors = $hookmanager->errors;
817 print
'<tr class="oddeven">';
819 if (empty($reshook)) {
820 if ($action ==
'edit') {
821 fieldList($fieldlist, $obj, $tabname[25],
'hide');
823 fieldList($fieldlist, $obj, $tabname[25],
'add');
827 print
'<td class="right">';
831 print
'<tr class="oddeven nodrag nodrop nohover"><td colspan="9">';
834 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
836 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content',
'content_lines');
838 foreach ($fieldsforcontent as $tmpfieldlist) {
840 if ($tmpfieldlist ==
'topic') {
841 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
843 if ($tmpfieldlist ==
'email_from') {
844 print $form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist);
846 if ($tmpfieldlist ==
'joinfiles') {
847 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
849 if ($tmpfieldlist ==
'content') {
850 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
852 if ($tmpfieldlist ==
'content_lines') {
853 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
857 if ($tmpfieldlist ==
'topic') {
858 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
859 } elseif ($tmpfieldlist ==
'email_from') {
860 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
861 } elseif ($tmpfieldlist ==
'joinfiles') {
862 print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, false, 0, 1);
864 $okforextended =
true;
866 $okforextended =
false;
868 $doleditor =
new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
''),
'', 400,
'dolibarr_mailings',
'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
869 print $doleditor->Create(1);
878 if ($action !=
'edit') {
880 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'"> ';
881 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
888 print
'<br><br><br>';
893$resql = $db->query($sql);
899$num = $db->num_rows($resql);
901print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
902print
'<input type="hidden" name="token" value="'.newToken().
'">';
903print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
905print
'<div class="div-table-responsive-no-min">';
906print
'<table class="noborder centpercent">';
912 $param .=
'&search_label='.urlencode($search_label);
914if (!empty($search_lang) && $search_lang !=
'-1') {
915 $param .=
'&search_lang='.urlencode($search_lang);
917if ($search_type_template !=
'-1') {
918 $param .=
'&search_type_template='.urlencode($search_type_template);
920if ($search_fk_user > 0) {
921 $param .=
'&search_fk_user='.urlencode($search_fk_user);
924 $param .=
'&search_module='.urlencode($search_module);
927 $param .=
'&search_topic='.urlencode($search_topic);
930$paramwithsearch = $param;
932 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
935 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
938 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
942if ($num > $listlimit) {
943 print
'<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).
'">';
944 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
950print
'<tr class="liste_titre">';
953 print
'<td class="liste_titre center" width="64">';
954 $searchpicto = $form->showFilterButtons();
958foreach ($fieldlist as $field => $value) {
959 if ($value ==
'module') {
960 print
'<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).
'"></td>';
961 } elseif ($value ==
'label') {
962 print
'<td class="liste_titre"><input type="text" name="search_label" class="maxwidth75" value="'.dol_escape_htmltag($search_label).
'"></td>';
963 } elseif ($value ==
'lang') {
964 print
'<td class="liste_titre">';
965 print $formadmin->select_language($search_lang,
'search_lang', 0,
null, 1, 0, 0,
'maxwidth100');
967 } elseif ($value ==
'fk_user') {
968 print
'<td class="liste_titre">';
969 print $form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'), null, 0, 0, 0,
'', 0,
'',
'maxwidth100', 1);
971 } elseif ($value ==
'topic') {
972 print
'<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).
'"></td>';
973 } elseif ($value ==
'type_template') {
974 print
'<td class="liste_titre center">';
976 print $form->selectarray(
'search_type_template', $elementList, $search_type_template, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth125', 1,
'', 0, 1);
978 } elseif (!in_array($value, array(
'content',
'content_lines'))) {
979 print
'<td class="liste_titre"></td>';
989 print
'<td class="liste_titre center" width="64">';
990 $searchpicto = $form->showFilterButtons();
997print
'<tr class="liste_titre">';
1002foreach ($fieldlist as $field => $value) {
1015 $valuetoshow = ucfirst($fieldlist[$field]);
1016 $valuetoshow = $langs->trans($valuetoshow);
1017 if ($fieldlist[$field] ==
'module') {
1018 $css =
'tdoverflowmax100';
1020 if ($fieldlist[$field] ==
'fk_user') {
1021 $valuetoshow = $langs->trans(
"Owner");
1023 if ($fieldlist[$field] ==
'lang') {
1024 $valuetoshow = $langs->trans(
"Language");
1026 if ($fieldlist[$field] ==
'type') {
1027 $valuetoshow = $langs->trans(
"Type");
1029 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
1030 $valuetoshow = $langs->trans(
"Code");
1032 if ($fieldlist[$field] ==
'type_template') {
1034 $valuetoshow = $langs->trans(
"TypeOfTemplate");
1036 if ($fieldlist[$field] ==
'private') {
1039 if ($fieldlist[$field] ==
'position') {
1043 if ($fieldlist[$field] ==
'joinfiles') {
1044 $valuetoshow = $langs->trans(
"FilesAttachedToEmail");
1048 if ($fieldlist[$field] ==
'content') {
1049 $valuetoshow = $langs->trans(
"Content");
1052 if ($fieldlist[$field] ==
'content_lines') {
1053 $valuetoshow = $langs->trans(
"ContentForLines");
1059 if (!empty($tabhelp[25][$value])) {
1060 if (in_array($value, array(
'topic'))) {
1061 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2,
'tooltip'.$value, $forcenowrap);
1063 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2,
'', $forcenowrap);
1066 $sortfieldtouse = ($sortable ? $fieldlist[$field] :
'');
1067 if ($sortfieldtouse ==
'type_template') {
1068 $sortfieldtouse .=
',lang,position,label';
1070 print
getTitleFieldOfList($valuetoshow, 0, $_SERVER[
"PHP_SELF"], $sortfieldtouse, ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $css.
' ');
1074print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
1086 $obj = $db->fetch_object($resql);
1089 if (($action ==
'edit' || $action ==
'preview') && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1090 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1092 $tmpaction =
'edit';
1093 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[25]);
1094 $reshook = $hookmanager->executeHooks(
'editEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1095 $error = $hookmanager->error;
1096 $errors = $hookmanager->errors;
1100 print
'<td class="center">';
1101 print
'<input type="hidden" name="page" value="'.$page.
'">';
1102 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1103 if ($action ==
'edit') {
1104 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1106 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1107 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1111 if (empty($reshook)) {
1112 fieldList($fieldlist, $obj, $tabname[25], $action);
1116 print
'<td class="center">';
1117 print
'<input type="hidden" name="page" value="'.$page.
'">';
1118 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1119 if ($action ==
'edit') {
1120 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1122 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1123 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1128 print
'<tr class="oddeven nohover" id="tr-aaa-'.$rowid.
'">';
1129 print
'<td colspan="10">';
1131 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
1133 $fieldsforcontent[] =
'content_lines';
1136 $parameters = array(
'fieldsforcontent' => &$fieldsforcontent,
'tabname' => $tabname[$id]);
1137 $hookmanager->executeHooks(
'editEmailTemplateFieldsForContent', $parameters, $obj, $tmpaction);
1139 foreach ($fieldsforcontent as $tmpfieldlist) {
1142 $valuetoshow = $obj->$tmpfieldlist;
1148 if ($tmpfieldlist ==
'topic') {
1149 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1150 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'"'.($action !=
'edit' ?
' disabled' :
'').
'>';
1153 if ($tmpfieldlist ==
'email_from') {
1154 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1155 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'"'.($action !=
'edit' ?
' disabled' :
'').
'>';
1158 if ($tmpfieldlist ==
'joinfiles') {
1159 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1160 print $form->selectyesno($tmpfieldlist.
'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, ($action !=
'edit'), 0, 1);
1164 if ($tmpfieldlist ==
'content') {
1165 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1166 $okforextended =
true;
1168 $okforextended =
false;
1170 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 500,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%', ($action !=
'edit' ? 1 : 0));
1171 print $doleditor->Create(1);
1173 if ($tmpfieldlist ==
'content_lines') {
1175 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1176 $okforextended =
true;
1178 $okforextended =
false;
1180 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 140,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1181 print $doleditor->Create(1);
1195 $tempmodulekey = $obj->module;
1196 if (empty($conf->$tempmodulekey) || !isModEnabled($tempmodulekey)) {
1202 $keyforobj =
'type_template';
1203 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1208 if (! (
int)
dol_eval($obj->enabled, 1, 1,
'1')) {
1219 if (!$user->admin && $obj->fk_user != $user->id) {
1225 $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) :
'');
1230 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1234 print
'<td class="center nowraponall" width="64">';
1235 if ($canbemodified) {
1236 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1238 print
'<a class="reposition editfielda" href="'.$url.
'&action=preview&token='.
newToken().
'">'.
img_view().
'</a>';
1241 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
1247 $tmpaction =
'view';
1248 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[25]);
1249 $reshook = $hookmanager->executeHooks(
'viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1251 $error = $hookmanager->error;
1252 $errors = $hookmanager->errors;
1254 if (empty($reshook)) {
1255 foreach ($fieldlist as $field => $value) {
1256 if (in_array($fieldlist[$field], array(
'content',
'content_lines'))) {
1263 $tmpvar = $fieldlist[$field];
1264 $valuetoshow = $obj->$tmpvar;
1265 if ($value ==
'label' || $value ==
'topic') {
1266 if ($langs->trans($valuetoshow) != $valuetoshow) {
1267 $valuetoshow = $langs->trans($valuetoshow);
1271 if ($value ==
'label') {
1272 $class .=
' tdoverflowmax200';
1274 if ($value ==
'topic') {
1275 $class .=
' tdoverflowmax200 small';
1277 if ($value ==
'type_template') {
1278 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1279 $css =
"center tdoverflowmax150";
1281 if ($value ==
'lang' && $valuetoshow) {
1282 $valuetoshow = $valuetoshow.
' - '.$langs->trans(
"Language_".$valuetoshow);
1283 $class .=
' tdoverflowmax100';
1285 if ($value ==
'fk_user') {
1286 if ($valuetoshow > 0) {
1287 $fuser =
new User($db);
1288 $fuser->fetch($valuetoshow);
1289 $valuetoshow = $fuser->getNomUrl(-1);
1290 $class .=
' tdoverflowmax100';
1293 if ($value ==
'private') {
1296 $valuetoshow =
yn($valuetoshow);
1301 if ($value ==
'position') {
1304 if (in_array($value, array(
'joinfiles',
'defaultfortype'))) {
1308 $valuetoshow =
'<input type="checkbox" checked="checked" disabled>';
1319 print
'<!-- '.$fieldlist[$field].
' -->';
1320 print
'<td class="'.$class.
'"';
1321 if (in_array($value, array(
'code',
'label',
'topic'))) {
1322 print
' title="'.dol_escape_htmltag($valuetoshow).
'"';
1332 print
'<td class="center nowrap">';
1333 if ($canbedisabled) {
1334 print
'<a class="reposition" href="'.$url.
'&action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
1336 print
'<span class="opacitymedium">'.$actl[$obj->active].
'</span>';
1342 print
'<td class="center nowraponall" width="64">';
1343 if ($canbemodified) {
1344 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1347 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
1362if ($nbqualified == 0) {
1364 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1373if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1392function fieldList($fieldlist, $obj =
null, $tabname =
'', $context =
'')
1394 global $langs, $user, $db;
1396 global $elementList;
1400 foreach ($fieldlist as $field => $value) {
1402 if ($value ==
'module') {
1404 } elseif ($value ==
'fk_user') {
1406 if ($user->admin && $context !=
'preview') {
1407 print $form->select_dolusers(GETPOSTISSET(
'fk_user') ?
GETPOSTINT(
'fk_user') : (empty($obj->$value) ?
'' : $obj->$value),
'fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'),
null, 0, 0, 0,
'', 0,
'',
'minwidth75 maxwidth100');
1409 if ($context ==
'add') {
1410 print $user->getNomUrl(-1);
1411 $forcedvalue = $user->id;
1413 if ($obj && !empty($obj->$value) && $obj->$value > 0) {
1414 $fuser =
new User($db);
1415 $fuser->fetch($obj->$value);
1416 print $fuser->getNomUrl(-1);
1417 $forcedvalue = $fuser->id;
1419 $forcedvalue = $obj->$value;
1423 print
'<input type="hidden" value="'.$forcedvalue.
'" name="'.$keyname.
'">';
1426 } elseif ($value ==
'lang') {
1429 $selectedlang = GETPOSTISSET(
'langcode') ?
GETPOST(
'langcode',
'aZ09') : $langs->defaultlang;
1430 if ($context ==
'edit') {
1431 $selectedlang = $obj->lang;
1433 print $formadmin->select_language($selectedlang,
'langcode', 0,
null, 1, 0, 0,
'maxwidth100');
1435 if (!empty($obj->lang)) {
1436 print $obj->lang.
' - '.$langs->trans(
'Language_'.$obj->lang);
1439 if ($keyname ==
'lang') {
1440 $keyname =
'langcode';
1442 print
'<input type="hidden" value="'.(empty($obj->lang) ?
'' : $obj->lang).
'" name="'.$keyname.
'">';
1445 } elseif ($value ==
'type_template') {
1447 print
'<td class="center">';
1448 if (($context ==
'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) || $context ==
'preview') {
1450 print
'<input type="hidden" name="type_template" value="'.$obj->type_template.
'">';
1451 print $obj->type_template;
1453 print $form->selectarray(
'type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth75 maxwidth125', 1,
'', 0, 1);
1456 } elseif ($context ==
'add' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1458 } elseif ($context ==
'edit' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1460 } elseif ($context ==
'preview' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1462 } elseif ($context ==
'hide' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1468 if ($value ==
'code') {
1469 $class =
'maxwidth100';
1471 if ($value ==
'label') {
1472 $class =
'maxwidth200';
1474 if ($value ==
'private') {
1475 $class =
'maxwidth50';
1476 $classtd =
'center';
1478 if ($value ==
'position') {
1479 $class =
'maxwidth50 center';
1480 $classtd =
'center';
1482 if ($value ==
'topic') {
1483 $class =
'quatrevingtpercent';
1485 if ($value ==
'defaultfortype') {
1486 $class =
'width25 center';
1487 $classtd =
'center';
1490 print
'<td'.($classtd ?
' class="'.$classtd.
'"' :
'').
'>';
1491 if ($value ==
'private' && $context !=
'preview') {
1492 if (empty($user->admin)) {
1494 print $form->selectyesno($value, GETPOSTISSET($value) ?
GETPOSTINT($value) : (($context !=
'add' && isset($obj->$value)) ? $obj->$value :
'1'), 1,
false, 0, 1);
1497 print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value :
''), 1,
false, 0, 1);
1500 print
'<input type="text" '.$size.
'class="flat'.($class ?
' '.$class :
'').
'" value="'.(isset($obj->$value) ? $obj->$value :
'').
'" name="'. $value .
'"'.($context ==
'preview' ?
' disabled' :
'').
'>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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()
Empty header.
Class to manage a WYSIWYG editor.
Object of table llx_c_email_templates.
Class to manage Dolibarr users.
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.