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';
56$langsArray = array(
"errors",
"admin",
"mails",
"languages");
58if (isModEnabled(
'member')) {
59 $langsArray[] =
'members';
61if (isModEnabled(
'eventorganization')) {
62 $langsArray[] =
'eventorganization';
65$langs->loadLangs($langsArray);
67$toselect =
GETPOST(
'toselect',
'array');
68$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
69$massaction =
GETPOST(
'massaction',
'alpha');
70$confirm =
GETPOST(
'confirm',
'alpha');
72$optioncss =
GETPOST(
'optioncss',
'alpha');
73$backtopage =
GETPOST(
'backtopage');
74$contextpage =
GETPOST(
'contextpage',
'aZ09');
77$search_label =
GETPOST(
'search_label',
'alphanohtml');
78$search_type_template =
GETPOST(
'search_type_template',
'alpha');
79$search_lang =
GETPOST(
'search_lang',
'alpha');
80$search_fk_user =
GETPOST(
'search_fk_user',
'intcomma');
81$search_topic =
GETPOST(
'search_topic',
'alpha');
82$search_module =
GETPOST(
'search_module',
'alpha');
88$actl[0] =
img_picto($langs->trans(
"Disabled"),
'switch_off',
'class="size15x"');
89$actl[1] =
img_picto($langs->trans(
"Activated"),
'switch_on',
'class="size15x"');
91$listoffset =
GETPOST(
'listoffset',
'alpha');
92$listlimit =
GETPOST(
'listlimit',
'alpha') > 0 ?
GETPOST(
'listlimit',
'alpha') : 1000;
95$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
96$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
98if (empty($page) || $page == -1) {
101$offset = $listlimit * $page;
102$pageprev = $page - 1;
103$pagenext = $page + 1;
105if (empty($sortfield)) {
106 $sortfield =
'type_template,lang,position,label';
108if (empty($sortorder)) {
113$hookmanager->initHooks(array(
'emailtemplates'));
118$tabname[25] = MAIN_DB_PREFIX.
"c_email_templates";
122$tabfield[25] =
"label,lang,type_template,fk_user,private,position,module,topic,joinfiles,defaultfortype,content";
124 $tabfield[25] .=
',content_lines';
128$tabfieldvalue = array();
129$tabfieldvalue[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
131 $tabfieldvalue[25] .=
',content_lines';
135$tabfieldinsert = array();
136$tabfieldinsert[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
138 $tabfieldinsert[25] .=
',content_lines';
140$tabfieldinsert[25] .=
',entity';
148require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
152 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
153 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
154 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
155 foreach ($tmp as $key => $val) {
156 $helpsubstit .= $key.
' -> '.$val.
'<br>';
157 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
161 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
162 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
163 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
164 foreach ($tmp as $key => $val) {
165 $helpsubstit .= $key.
' -> '.$val.
'<br>';
168 foreach ($tmp as $key => $val) {
169 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
176 'label' => $langs->trans(
'EnterAnyCode'),
177 'type_template' => $langs->trans(
"TemplateForElement"),
178 'private' => $langs->trans(
"TemplateIsVisibleByOwnerOnly"),
179 'position' => $langs->trans(
"PositionIntoComboList"),
180 'topic' =>
'<span class="small">'.$helpsubstit.
'</span>',
181 'email_from' => $langs->trans(
'ForceEmailFrom'),
182 'joinfiles' => $langs->trans(
'AttachMainDocByDefault'),
183 'defaultfortype' => $langs->trans(
"DefaultForTypeDesc"),
184 'content' =>
'<span class="small">'.$helpsubstit.
'</span>',
185 'content_lines' =>
'<span class="small">'.$helpsubstitforlines.
'</span>'
190$elementList = array();
193$elementList[
'all'] =
'-- '.dol_escape_htmltag($langs->trans(
"All")).
' --';
194$elementList[
'none'] =
'-- '.dol_escape_htmltag($langs->trans(
"None")).
' --';
195$elementList[
'user'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToUser'));
196if (isModEnabled(
'member') && $user->hasRight(
'adherent',
'lire')) {
197 $elementList[
'member'] =
img_picto(
'',
'object_member',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToMember'));
199if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
200 $elementList[
'recruitmentcandidature_send'] =
img_picto(
'',
'recruitmentcandidature',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'RecruitmentCandidatures'));
202if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
203 $elementList[
'thirdparty'] =
img_picto(
'',
'company',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToThirdparty'));
205if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'contact',
'lire')) {
206 $elementList[
'contact'] =
img_picto(
'',
'contact',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToContact'));
208if (isModEnabled(
'project')) {
209 $elementList[
'project'] =
img_picto(
'',
'project',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToProject'));
211if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
212 $elementList[
'propal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendProposal'));
214if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
215 $elementList[
'order_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendOrder'));
217if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
218 $elementList[
'facture_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendInvoice'));
220if (isModEnabled(
"shipping")) {
221 $elementList[
'shipping_send'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendShipment'));
223if (isModEnabled(
"reception")) {
224 $elementList[
'reception_send'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendReception'));
226if (isModEnabled(
'intervention')) {
227 $elementList[
'fichinter_send'] =
img_picto(
'',
'intervention',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendIntervention'));
229if (isModEnabled(
'supplier_proposal')) {
230 $elementList[
'supplier_proposal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierRequestForQuotation'));
232if (isModEnabled(
"supplier_order") && ($user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'read'))) {
233 $elementList[
'order_supplier_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierOrder'));
235if (isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
236 $elementList[
'invoice_supplier_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierInvoice'));
238if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
239 $elementList[
'contract'] =
img_picto(
'',
'contract',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendContract'));
241if (isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
242 $elementList[
'ticket_send'] =
img_picto(
'',
'ticket',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToTicket'));
244if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
245 $elementList[
'expensereport_send'] =
img_picto(
'',
'trip',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToExpenseReport'));
247if (isModEnabled(
'agenda')) {
248 $elementList[
'actioncomm_send'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventPush'));
250if (isModEnabled(
'eventorganization') && $user->hasRight(
'eventorganization',
'read')) {
251 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventOrganization'));
253if (isModEnabled(
'partnership') && $user->hasRight(
'partnership',
'read')) {
254 $elementList[
'partnership_send'] =
img_picto(
'',
'partnership',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToPartnership'));
257$parameters = array(
'elementList' => $elementList);
258$reshook = $hookmanager->executeHooks(
'emailElementlist', $parameters);
260 foreach ($hookmanager->resArray as $item => $value) {
261 $elementList[$item] = $value;
270if (!empty($user->socid)) {
275$permissiontoedit = ($user->admin ? 1 : 0);
276$permissiontodelete = ($user->admin ? 1 : 0);
279 $tmpmailtemplate->fetch($rowid);
280 if ($tmpmailtemplate->fk_user == $user->id) {
281 $permissiontoedit = 1;
282 $permissiontodelete = 1;
291if (
GETPOST(
'cancel',
'alpha') ||
GETPOST(
'actioncancel',
'alpha')) {
295 if (!empty($backtopage)) {
296 header(
"Location: ".$backtopage);
300if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
304$parameters = array();
306$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
311if (empty($reshook)) {
313 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
316 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
319 $search_type_template =
'';
321 $search_fk_user =
'';
325 $search_array_options = array();
329 if ((
GETPOST(
'actionadd',
'alpha') && $permissiontoadd) || (
GETPOST(
'actionmodify',
'alpha') && $permissiontoedit)) {
330 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[25]));
331 $listfieldinsert = explode(
',', $tabfieldinsert[25]);
332 $listfieldmodify = explode(
',', $tabfieldinsert[25]);
333 $listfieldvalue = explode(
',', $tabfieldvalue[25]);
337 foreach ($listfield as $f => $value) {
339 if (in_array($value, [
'joinfiles',
'defaultfortype',
'content',
'content_lines',
'module'])) {
344 if (
GETPOST(
'actionmodify',
'alpha') && $value ==
'topic') {
345 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
348 if ((!GETPOSTISSET($value) ||
GETPOST($value) ==
'' ||
GETPOST($value) ==
'-1') && $value !=
'lang' && $value !=
'fk_user' && $value !=
'position') {
350 $fieldnamekey = $listfield[$f];
352 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
353 $fieldnamekey =
'Code';
355 if ($fieldnamekey ==
'code') {
356 $fieldnamekey =
'Code';
358 if ($fieldnamekey ==
'note') {
359 $fieldnamekey =
'Note';
361 if ($fieldnamekey ==
'type_template') {
362 $fieldnamekey =
'TypeOfTemplate';
364 if ($fieldnamekey ==
'fk_user') {
365 $fieldnamekey =
'Owner';
367 if ($fieldnamekey ==
'private') {
368 $fieldnamekey =
'Private';
370 if ($fieldnamekey ==
'position') {
371 $fieldnamekey =
'Position';
373 if ($fieldnamekey ==
'topic') {
374 $fieldnamekey =
'Topic';
377 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
383 if ($ok &&
GETPOST(
'actionadd')) {
385 $sql =
"INSERT INTO ".$tabname[25].
" (";
387 $sql .= $tabfieldinsert[25];
388 $sql .=
", active, enabled)";
393 foreach ($listfieldinsert as $f => $value) {
394 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
"";
395 if ($value ==
'lang') {
396 $keycode =
'langcode';
398 if (empty($keycode)) {
403 if ($value ==
'entity') {
404 $_POST[$keycode] =
$conf->entity;
406 if ($value ==
'fk_user' && !($_POST[$keycode] > 0)) {
407 $_POST[$keycode] =
'';
409 if ($value ==
'private' && !is_numeric($_POST[$keycode])) {
410 $_POST[$keycode] =
'0';
412 if ($value ==
'position' && !is_numeric($_POST[$keycode])) {
413 $_POST[$keycode] =
'1';
415 if ($value ==
'defaultfortype' && !is_numeric($_POST[$keycode])) {
416 $_POST[$keycode] =
'0';
423 if (
GETPOST($keycode) ==
'' && $keycode !=
'langcode') {
425 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
427 } elseif ($keycode ==
'fk_user') {
429 $sql .=
" ".((int) $user->id);
431 $sql .=
" ".(GETPOSTINT($keycode));
433 } elseif ($keycode ==
'content') {
434 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
435 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position',
'entity'))) {
438 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
445 $result = $db->query($sql);
448 $_POST = array(
'id' => 25);
450 if (!empty($backtopage)) {
451 header(
"Location: ".$backtopage);
455 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
456 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
465 if ($ok &&
GETPOST(
'actionmodify')) {
469 setEventMessages($langs->trans(
"AnOwnerMustBeSetIfEmailTemplateIsPrivate"),
null,
'errors');
476 $sql =
"UPDATE ".$tabname[25].
" SET ";
479 foreach ($listfieldmodify as $field) {
480 if ($field ==
'entity') {
483 $_POST[$keycode] =
$conf->entity;
485 $keycode = $listfieldvalue[$i];
488 if ($field ==
'lang') {
489 $keycode =
'langcode';
491 if (empty($keycode)) {
496 if ($field ==
'fk_user' && !(
GETPOSTINT(
'fk_user') > 0)) {
497 $_POST[
'fk_user'] =
'';
499 if ($field ==
'topic') {
500 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
502 if ($field ==
'joinfiles') {
503 $_POST[
'joinfiles'] =
GETPOST(
'joinfiles-'.$rowid);
505 if ($field ==
'content') {
506 $_POST[
'content'] =
GETPOST(
'content-'.$rowid,
'restricthtml');
508 if ($field ==
'content_lines') {
509 $_POST[
'content_lines'] =
GETPOST(
'content_lines-'.$rowid,
'restricthtml');
511 if ($field ==
'email_from') {
512 $_POST[
'email_from'] =
GETPOST(
'email_from-'.$rowid,
'restricthtml');
520 if (
GETPOST($keycode) ==
'' || (!in_array($keycode, array(
'langcode',
'position',
'private',
'defaultfortype')) && !
GETPOST($keycode))) {
522 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
524 } elseif ($keycode ==
'fk_user') {
526 $sql .=
" ".((int) $user->id);
528 $sql .=
" ".(GETPOSTINT($keycode));
530 } elseif ($keycode ==
'content') {
531 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
532 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position'))) {
535 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
540 $sql .=
" WHERE ".$db->escape($rowidcol).
" = ".((int) $rowid);
542 $sql .=
" AND fk_user = ".((int) $user->id);
548 $resql = $db->query($sql);
562 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
565 $sql =
"DELETE from ".$tabname[25].
" WHERE ".$rowidcol.
" = ".((int) $rowid);
567 $sql .=
" AND fk_user = ".((int) $user->id);
570 $result = $db->query($sql);
572 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
573 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
581 if ($action == $acts[0] && $permissiontoedit) {
584 $sql =
"UPDATE ".$tabname[25].
" SET active = 1 WHERE rowid = ".((int) $rowid);
586 $result = $db->query($sql);
593 if ($action == $acts[1] && $permissiontoedit) {
596 $sql =
"UPDATE ".$tabname[25].
" SET active = 0 WHERE rowid = ".((int) $rowid);
598 $result = $db->query($sql);
610$form =
new Form($db);
617if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
618 $title = $langs->trans(
"EMailsSetup");
620 $title = $langs->trans(
"EMailTemplates");
625$sql =
"SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
626$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_email_templates";
627$sql .=
" WHERE entity IN (".getEntity(
'email_template').
")";
629 $sql .=
" AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id).
"))";
630 $sql .=
" AND (active = 1 OR fk_user = ".((int) $user->id).
")";
633 $sql .=
" AND (lang = '".$db->escape($langs->defaultlang).
"' OR lang IS NULL OR lang = '')";
638if ($search_type_template !=
'' && $search_type_template !=
'-1') {
644if ($search_fk_user !=
'' && $search_fk_user !=
'-1') {
654if ($sortfield ==
'country') {
655 $sortfield =
'country_code';
657$sql .= $db->order($sortfield, $sortorder);
658$sql .= $db->plimit($listlimit + 1, $offset);
664llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-admin page-mails_templates');
666$arrayofselected = is_array($toselect) ? $toselect : array();
670 $param .=
'&mode='.urlencode($mode);
672if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
673 $param .=
'&contextpage='.urlencode($contextpage);
675if ($limit > 0 && $limit !=
$conf->liste_limit) {
676 $param .=
'&limit='.((int) $limit);
678if (!empty($search) && is_array($search)) {
679 foreach ($search as $key => $val) {
680 if (is_array($search[$key]) && count($search[$key])) {
681 foreach ($search[$key] as $skey) {
683 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
686 } elseif ($search[$key] !=
'') {
687 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
691if ($optioncss !=
'') {
692 $param .=
'&optioncss='.urlencode($optioncss);
695include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
697$parameters = array();
698$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
699$param .= $hookmanager->resPrint;
703$titlepicto =
'title_setup';
706$url = DOL_URL_ROOT.
'/admin/mails_templates.php?action=create';
708$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewEMailTemplate'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
711if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
717if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
722 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
729if ($action ==
'delete') {
730 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);
734$fieldlist = explode(
',', $tabfield[25]);
736if ($action ==
'create') {
739 $obj->label =
GETPOST(
'label');
741 $obj->type_template =
GETPOST(
'type_template');
744 $obj->position =
GETPOST(
'position');
745 $obj->topic =
GETPOST(
'topic');
746 $obj->joinfiles =
GETPOST(
'joinfiles');
747 $obj->defaultfortype =
GETPOST(
'defaultfortype') ? 1 : 0;
748 $obj->content =
GETPOST(
'content',
'restricthtml');
751 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
752 print
'<input type="hidden" name="token" value="'.newToken().
'">';
753 print
'<input type="hidden" name="action" value="add">';
754 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
755 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
757 print
'<div class="div-table-responsive-no-min">';
758 print
'<table class="noborder centpercent">';
761 print
'<tr class="liste_titre">';
762 foreach ($fieldlist as $field => $value) {
765 $valuetoshow = ucfirst($fieldlist[$field]);
766 $valuetoshow = $langs->trans($valuetoshow);
768 if ($fieldlist[$field] ==
'module') {
769 $valuetoshow =
' ';
771 if ($fieldlist[$field] ==
'fk_user') {
772 $valuetoshow = $langs->trans(
"Owner");
774 if ($fieldlist[$field] ==
'lang') {
775 $valuetoshow = (!
getDolGlobalInt(
'MAIN_MULTILANGS') ?
' ' : $langs->trans(
"Language"));
777 if ($fieldlist[$field] ==
'type') {
778 $valuetoshow = $langs->trans(
"Type");
780 if ($fieldlist[$field] ==
'position') {
783 if ($fieldlist[$field] ==
'code') {
784 $valuetoshow = $langs->trans(
"Code");
786 if ($fieldlist[$field] ==
'label') {
787 $valuetoshow = $langs->trans(
"Code");
789 if ($fieldlist[$field] ==
'type_template') {
790 $valuetoshow = $langs->trans(
"TypeOfTemplate");
793 if (in_array($fieldlist[$field], array(
'private',
'private',
'defaultfortype'))) {
797 if ($fieldlist[$field] ==
'topic') {
800 if ($fieldlist[$field] ==
'joinfiles') {
803 if ($fieldlist[$field] ==
'content') {
806 if ($fieldlist[$field] ==
'content_lines') {
809 if ($valuetoshow !=
'') {
810 print
'<th class="'.$css.
'">';
811 if (!empty($tabhelp[25][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[25][$value])) {
812 print
'<a href="'.$tabhelp[25][$value].
'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
813 } elseif (!empty($tabhelp[25][$value])) {
814 if (in_array($value, array(
'topic'))) {
815 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2, $value);
817 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2);
829 $tmpaction =
'create';
831 'fieldlist' => $fieldlist,
832 'tabname' => $tabname[25]
834 $reshook = $hookmanager->executeHooks(
'createEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
835 $error = $hookmanager->error;
836 $errors = $hookmanager->errors;
840 print
'<tr class="oddeven">';
842 if (empty($reshook)) {
843 if ($action ==
'edit') {
844 fieldList($fieldlist, $obj, $tabname[25],
'hide');
846 fieldList($fieldlist, $obj, $tabname[25],
'add');
850 print
'<td class="right">';
854 print
'<tr class="oddeven nodrag nodrop nohover"><td colspan="9">';
857 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
859 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content',
'content_lines');
861 foreach ($fieldsforcontent as $tmpfieldlist) {
863 if ($tmpfieldlist ==
'topic') {
864 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
866 if ($tmpfieldlist ==
'email_from') {
867 print $form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist);
869 if ($tmpfieldlist ==
'joinfiles') {
870 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
872 if ($tmpfieldlist ==
'content') {
873 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
875 if ($tmpfieldlist ==
'content_lines') {
876 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
880 if ($tmpfieldlist ==
'topic') {
881 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
882 } elseif ($tmpfieldlist ==
'email_from') {
883 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
884 } elseif ($tmpfieldlist ==
'joinfiles') {
885 print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, false, 0, 1);
887 $okforextended =
true;
889 $okforextended =
false;
891 $doleditor =
new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
''),
'', 400,
'dolibarr_mailings',
'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
892 print $doleditor->Create(1);
901 if ($action !=
'edit') {
903 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'"> ';
904 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
911 print
'<br><br><br>';
916$resql = $db->query($sql);
922$num = $db->num_rows($resql);
924print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
925print
'<input type="hidden" name="token" value="'.newToken().
'">';
926print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
928print
'<div class="div-table-responsive-no-min">';
929print
'<table class="noborder centpercent">';
935 $param .=
'&search_label='.urlencode($search_label);
937if (!empty($search_lang) && $search_lang !=
'-1') {
938 $param .=
'&search_lang='.urlencode($search_lang);
940if ($search_type_template !=
'-1') {
941 $param .=
'&search_type_template='.urlencode($search_type_template);
943if ($search_fk_user > 0) {
944 $param .=
'&search_fk_user='.urlencode($search_fk_user);
947 $param .=
'&search_module='.urlencode($search_module);
950 $param .=
'&search_topic='.urlencode($search_topic);
953$paramwithsearch = $param;
955 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
958 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
961 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
965if ($num > $listlimit) {
966 print
'<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).
'">';
967 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit ? 1 : 0),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
973print
'<tr class="liste_titre">';
976 print
'<td class="liste_titre center" width="64">';
977 $searchpicto = $form->showFilterButtons();
981foreach ($fieldlist as $field => $value) {
982 if ($value ==
'module') {
983 print
'<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).
'"></td>';
984 } elseif ($value ==
'label') {
985 print
'<td class="liste_titre"><input type="text" name="search_label" class="maxwidth75" value="'.dol_escape_htmltag($search_label).
'"></td>';
986 } elseif ($value ==
'lang') {
987 print
'<td class="liste_titre">';
988 print $formadmin->select_language($search_lang,
'search_lang', 0, array(), 1, 0, 0,
'maxwidth100');
990 } elseif ($value ==
'fk_user') {
991 print
'<td class="liste_titre">';
992 print $form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'), array(), 0, 0, 0,
'', 0,
'',
'maxwidth100', 1);
994 } elseif ($value ==
'topic') {
995 print
'<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).
'"></td>';
996 } elseif ($value ==
'type_template') {
997 print
'<td class="liste_titre center">';
999 print $form->selectarray(
'search_type_template', $elementList, $search_type_template, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth125', 1,
'', 0, 1);
1001 } elseif (!in_array($value, array(
'content',
'content_lines'))) {
1002 print
'<td class="liste_titre"></td>';
1012 print
'<td class="liste_titre center" width="64">';
1013 $searchpicto = $form->showFilterButtons();
1020print
'<tr class="liste_titre">';
1025foreach ($fieldlist as $field => $value) {
1038 $valuetoshow = ucfirst($fieldlist[$field]);
1039 $valuetoshow = $langs->trans($valuetoshow);
1040 if ($fieldlist[$field] ==
'module') {
1041 $css =
'tdoverflowmax100';
1043 if ($fieldlist[$field] ==
'fk_user') {
1044 $valuetoshow = $langs->trans(
"Owner");
1046 if ($fieldlist[$field] ==
'lang') {
1047 $valuetoshow = $langs->trans(
"Language");
1049 if ($fieldlist[$field] ==
'type') {
1050 $valuetoshow = $langs->trans(
"Type");
1052 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
1053 $valuetoshow = $langs->trans(
"Code");
1055 if ($fieldlist[$field] ==
'type_template') {
1057 $valuetoshow = $langs->trans(
"TypeOfTemplate");
1059 if ($fieldlist[$field] ==
'private') {
1062 if ($fieldlist[$field] ==
'position') {
1066 if ($fieldlist[$field] ==
'joinfiles') {
1067 $valuetoshow = $langs->trans(
"FilesAttachedToEmail");
1071 if ($fieldlist[$field] ==
'content') {
1072 $valuetoshow = $langs->trans(
"Content");
1075 if ($fieldlist[$field] ==
'content_lines') {
1076 $valuetoshow = $langs->trans(
"ContentForLines");
1082 if (!empty($tabhelp[25][$value])) {
1083 if (in_array($value, array(
'topic'))) {
1084 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2,
'tooltip'.$value, $forcenowrap);
1086 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2,
'', $forcenowrap);
1089 $sortfieldtouse = ($sortable ? $fieldlist[$field] :
'');
1090 if ($sortfieldtouse ==
'type_template') {
1091 $sortfieldtouse .=
',lang,position,label';
1093 print
getTitleFieldOfList($valuetoshow, 0, $_SERVER[
"PHP_SELF"], $sortfieldtouse, ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $css.
' ');
1097print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
1108 $obj = $db->fetch_object($resql);
1111 if (($action ==
'edit' || $action ==
'preview') && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1112 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1114 $tmpaction =
'edit';
1115 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[25]);
1116 $reshook = $hookmanager->executeHooks(
'editEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1117 $error = $hookmanager->error;
1118 $errors = $hookmanager->errors;
1122 print
'<td class="center">';
1123 print
'<input type="hidden" name="page" value="'.$page.
'">';
1124 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1125 if ($action ==
'edit') {
1126 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1128 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1129 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1133 if (empty($reshook)) {
1134 fieldList($fieldlist, $obj, $tabname[25], $action);
1138 print
'<td class="center">';
1139 print
'<input type="hidden" name="page" value="'.$page.
'">';
1140 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1141 if ($action ==
'edit') {
1142 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1144 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1145 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1150 print
'<tr class="oddeven nohover" id="tr-aaa-'.$rowid.
'">';
1151 print
'<td colspan="10" class="paddingleft" style="padding-left: 20px">';
1153 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
1155 $fieldsforcontent[] =
'content_lines';
1158 $parameters = array(
'fieldsforcontent' => &$fieldsforcontent,
'tabname' => $tabname[$id]);
1159 $hookmanager->executeHooks(
'editEmailTemplateFieldsForContent', $parameters, $obj, $tmpaction);
1161 foreach ($fieldsforcontent as $tmpfieldlist) {
1164 $valuetoshow = $obj->$tmpfieldlist;
1170 if ($tmpfieldlist ==
'topic') {
1171 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1172 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'"'.($action !=
'edit' ?
' disabled' :
'').
'>';
1175 if ($tmpfieldlist ==
'email_from') {
1176 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1177 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'"'.($action !=
'edit' ?
' disabled' :
'').
'>';
1180 if ($tmpfieldlist ==
'joinfiles') {
1181 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1182 print $form->selectyesno($tmpfieldlist.
'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, ($action !=
'edit'), 0, 1);
1186 if ($tmpfieldlist ==
'content') {
1187 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'margintoponly', 0, 2, $tmpfieldlist).
'<br>';
1188 $okforextended =
true;
1190 $okforextended =
false;
1192 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 500,
'dolibarr_mailings',
'In',
false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%', ($action !=
'edit' ? 1 : 0));
1193 print $doleditor->Create(1);
1195 if ($tmpfieldlist ==
'content_lines') {
1197 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'margintoponly', 0, 2, $tmpfieldlist).
'<br>';
1198 $okforextended =
true;
1200 $okforextended =
false;
1202 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 140,
'dolibarr_mailings',
'In',
false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1203 print $doleditor->Create(1);
1217 $tempmodulekey = $obj->module;
1218 if (empty(
$conf->$tempmodulekey) || !isModEnabled($tempmodulekey)) {
1224 $keyforobj =
'type_template';
1225 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1230 if (! (
int)
dol_eval($obj->enabled, 1, 1,
'1')) {
1241 if (!$user->admin && $obj->fk_user != $user->id) {
1247 $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) :
'');
1252 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1256 print
'<td class="center nowraponall" width="64">';
1257 if ($canbemodified) {
1258 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1260 print
'<a class="reposition editfielda" href="'.$url.
'&action=preview&token='.
newToken().
'">'.
img_view().
'</a>';
1263 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().$param.
'">'.
img_delete().
'</a>';
1268 $tmpaction =
'view';
1269 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[25]);
1270 $reshook = $hookmanager->executeHooks(
'viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1272 $error = $hookmanager->error;
1273 $errors = $hookmanager->errors;
1275 if (empty($reshook)) {
1276 foreach ($fieldlist as $field => $value) {
1277 if (in_array($fieldlist[$field], array(
'content',
'content_lines'))) {
1284 $tmpvar = $fieldlist[$field];
1285 $valuetoshow = $obj->$tmpvar;
1286 if ($value ==
'label' || $value ==
'topic') {
1287 if ($langs->trans($valuetoshow) != $valuetoshow) {
1288 $valuetoshow = $langs->trans($valuetoshow);
1292 if ($value ==
'label') {
1293 $class .=
' tdoverflowmax200';
1295 if ($value ==
'topic') {
1296 $class .=
' tdoverflowmax200 small';
1298 if ($value ==
'type_template') {
1299 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1300 $css =
"center tdoverflowmax150";
1302 if ($value ==
'lang' && $valuetoshow) {
1303 $valuetoshow = $valuetoshow.
' - '.$langs->trans(
"Language_".$valuetoshow);
1304 $class .=
' tdoverflowmax100';
1306 if ($value ==
'fk_user') {
1307 if ($valuetoshow > 0) {
1308 $fuser =
new User($db);
1309 $fuser->fetch($valuetoshow);
1310 $valuetoshow = $fuser->getNomUrl(-1);
1311 $class .=
' tdoverflowmax100';
1314 if ($value ==
'private') {
1317 $valuetoshow =
yn($valuetoshow);
1322 if ($value ==
'position') {
1325 if (in_array($value, array(
'joinfiles',
'defaultfortype'))) {
1329 $valuetoshow =
'<input type="checkbox" checked="checked" disabled>';
1340 print
'<!-- '.$fieldlist[$field].
' -->';
1341 print
'<td class="'.$class.
'"';
1342 if (in_array($value, array(
'code',
'label',
'topic'))) {
1343 print
' title="'.dol_escape_htmltag($valuetoshow).
'"';
1353 print
'<td class="center nowrap">';
1354 if ($canbedisabled) {
1355 print
'<a class="reposition" href="'.$url.
'&action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
1357 print
'<span class="opacitymedium">'.$actl[$obj->active].
'</span>';
1363 print
'<td class="center nowraponall" width="64">';
1364 if ($canbemodified) {
1365 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1368 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
1383if ($nbqualified == 0) {
1385 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1394if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1415 global $langs, $user, $db;
1417 global $elementList;
1421 foreach ($fieldlist as $field => $value) {
1423 if ($value ==
'module') {
1425 } elseif ($value ==
'fk_user') {
1427 if ($user->admin &&
$context !=
'preview') {
1428 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');
1431 print $user->getNomUrl(-1);
1432 $forcedvalue = $user->id;
1434 if ($obj && !empty($obj->$value) && $obj->$value > 0) {
1435 $fuser =
new User($db);
1436 $fuser->fetch($obj->$value);
1437 print $fuser->getNomUrl(-1);
1438 $forcedvalue = $fuser->id;
1440 $forcedvalue = $obj->$value;
1444 print
'<input type="hidden" value="'.$forcedvalue.
'" name="'.$keyname.
'">';
1447 } elseif ($value ==
'lang') {
1450 $selectedlang = GETPOSTISSET(
'langcode') ?
GETPOST(
'langcode',
'aZ09') : $langs->defaultlang;
1452 $selectedlang = $obj->lang;
1454 print $formadmin->select_language($selectedlang,
'langcode', 0, array(), 1, 0, 0,
'maxwidth100');
1456 if (!empty($obj->lang)) {
1457 print $obj->lang.
' - '.$langs->trans(
'Language_'.$obj->lang);
1460 if ($keyname ==
'lang') {
1461 $keyname =
'langcode';
1463 print
'<input type="hidden" value="'.(empty($obj->lang) ?
'' : $obj->lang).
'" name="'.$keyname.
'">';
1466 } elseif ($value ==
'type_template') {
1468 print
'<td class="center">';
1469 if ((
$context ==
'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) ||
$context ==
'preview') {
1471 print
'<input type="hidden" name="type_template" value="'.$obj->type_template.
'">';
1472 print $obj->type_template;
1474 print $form->selectarray(
'type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth75 maxwidth125', 1,
'', 0, 1);
1477 } elseif (
$context ==
'add' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1479 } elseif (
$context ==
'edit' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1481 } elseif (
$context ==
'preview' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1483 } elseif (
$context ==
'hide' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1489 if ($value ==
'code') {
1490 $class =
'maxwidth100';
1492 if ($value ==
'label') {
1493 $class =
'maxwidth200';
1495 if ($value ==
'private') {
1496 $class =
'maxwidth50';
1497 $classtd =
'center';
1499 if ($value ==
'position') {
1500 $class =
'maxwidth50 center';
1501 $classtd =
'center';
1503 if ($value ==
'topic') {
1504 $class =
'quatrevingtpercent';
1506 if ($value ==
'defaultfortype') {
1507 $class =
'width25 center';
1508 $classtd =
'center';
1511 print
'<td'.($classtd ?
' class="'.$classtd.
'"' :
'').
'>';
1512 if ($value ==
'private' &&
$context !=
'preview') {
1513 if (empty($user->admin)) {
1515 print $form->selectyesno($value, GETPOSTISSET($value) ?
GETPOSTINT($value) : ((
$context !=
'add' && isset($obj->$value)) ? $obj->$value :
'1'), 1,
false, 0, 1);
1518 print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value :
''), 1,
false, 0, 1);
1521 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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
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.
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_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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...
$context
@method int call_trigger(string $triggerName, User $user)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.