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';
48$langsArray = array(
"errors",
"admin",
"mails",
"languages");
50if (isModEnabled(
'member')) {
51 $langsArray[] =
'members';
53if (isModEnabled(
'eventorganization')) {
54 $langsArray[] =
'eventorganization';
57$langs->loadLangs($langsArray);
59$toselect =
GETPOST(
'toselect',
'array');
60$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
61$massaction =
GETPOST(
'massaction',
'alpha');
62$confirm =
GETPOST(
'confirm',
'alpha');
64$optioncss =
GETPOST(
'optioncss',
'alpha');
65$contextpage =
GETPOST(
'contextpage',
'aZ09');
68$search_label =
GETPOST(
'search_label',
'alphanohtml');
69$search_type_template =
GETPOST(
'search_type_template',
'alpha');
70$search_lang =
GETPOST(
'search_lang',
'alpha');
71$search_fk_user =
GETPOST(
'search_fk_user',
'intcomma');
72$search_topic =
GETPOST(
'search_topic',
'alpha');
73$search_module =
GETPOST(
'search_module',
'alpha');
79$actl[0] =
img_picto($langs->trans(
"Disabled"),
'switch_off',
'class="size15x"');
80$actl[1] =
img_picto($langs->trans(
"Activated"),
'switch_on',
'class="size15x"');
82$listoffset =
GETPOST(
'listoffset',
'alpha');
83$listlimit =
GETPOST(
'listlimit',
'alpha') > 0 ?
GETPOST(
'listlimit',
'alpha') : 1000;
86$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
87$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
89if (empty($page) || $page == -1) {
92$offset = $listlimit * $page;
96if (empty($sortfield)) {
97 $sortfield =
'type_template,lang,position,label';
99if (empty($sortorder)) {
104$hookmanager->initHooks(array(
'emailtemplates'));
109$tabname[25] = MAIN_DB_PREFIX.
"c_email_templates";
113$tabfield[25] =
"label,lang,type_template,fk_user,private,position,module,topic,joinfiles,defaultfortype,content";
115 $tabfield[25] .=
',content_lines';
119$tabfieldvalue = array();
120$tabfieldvalue[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
122 $tabfieldvalue[25] .=
',content_lines';
126$tabfieldinsert = array();
127$tabfieldinsert[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
129 $tabfieldinsert[25] .=
',content_lines';
131$tabfieldinsert[25] .=
',entity';
139require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
143 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
144 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
145 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
146 foreach ($tmp as $key => $val) {
147 $helpsubstit .= $key.
' -> '.$val.
'<br>';
148 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
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>';
159 foreach ($tmp as $key => $val) {
160 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
167 'label' => $langs->trans(
'EnterAnyCode'),
168 'type_template' => $langs->trans(
"TemplateForElement"),
169 'private' => $langs->trans(
"TemplateIsVisibleByOwnerOnly"),
170 'position' => $langs->trans(
"PositionIntoComboList"),
171 'topic' =>
'<span class="small">'.$helpsubstit.
'</span>',
172 'email_from' => $langs->trans(
'ForceEmailFrom'),
173 'joinfiles' => $langs->trans(
'AttachMainDocByDefault'),
174 'defaultfortype' => $langs->trans(
"DefaultForTypeDesc"),
175 'content' =>
'<span class="small">'.$helpsubstit.
'</span>',
176 'content_lines' =>
'<span class="small">'.$helpsubstitforlines.
'</span>'
181$elementList = array();
184$elementList[
'all'] =
'-- '.dol_escape_htmltag($langs->trans(
"All")).
' --';
185$elementList[
'none'] =
'-- '.dol_escape_htmltag($langs->trans(
"None")).
' --';
186$elementList[
'user'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToUser'));
187if (isModEnabled(
'member') && $user->hasRight(
'adherent',
'lire')) {
188 $elementList[
'member'] =
img_picto(
'',
'object_member',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToMember'));
190if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
191 $elementList[
'recruitmentcandidature_send'] =
img_picto(
'',
'recruitmentcandidature',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'RecruitmentCandidatures'));
193if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
194 $elementList[
'thirdparty'] =
img_picto(
'',
'company',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToThirdparty'));
196if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'contact',
'lire')) {
197 $elementList[
'contact'] =
img_picto(
'',
'contact',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToContact'));
199if (isModEnabled(
'project')) {
200 $elementList[
'project'] =
img_picto(
'',
'project',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToProject'));
202if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
203 $elementList[
'propal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendProposal'));
205if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
206 $elementList[
'order_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendOrder'));
208if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
209 $elementList[
'facture_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendInvoice'));
211if (isModEnabled(
"shipping")) {
212 $elementList[
'shipping_send'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendShipment'));
214if (isModEnabled(
"reception")) {
215 $elementList[
'reception_send'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendReception'));
217if (isModEnabled(
'intervention')) {
218 $elementList[
'fichinter_send'] =
img_picto(
'',
'intervention',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendIntervention'));
220if (isModEnabled(
'supplier_proposal')) {
221 $elementList[
'supplier_proposal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierRequestForQuotation'));
223if (isModEnabled(
"supplier_order") && ($user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'read'))) {
224 $elementList[
'order_supplier_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierOrder'));
226if (isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
227 $elementList[
'invoice_supplier_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierInvoice'));
229if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
230 $elementList[
'contract'] =
img_picto(
'',
'contract',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendContract'));
232if (isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
233 $elementList[
'ticket_send'] =
img_picto(
'',
'ticket',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToTicket'));
235if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
236 $elementList[
'expensereport_send'] =
img_picto(
'',
'trip',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToExpenseReport'));
238if (isModEnabled(
'agenda')) {
239 $elementList[
'actioncomm_send'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventPush'));
241if (isModEnabled(
'eventorganization') && $user->hasRight(
'eventorganization',
'read')) {
242 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventOrganization'));
244if (isModEnabled(
'partnership') && $user->hasRight(
'partnership',
'read')) {
245 $elementList[
'partnership_send'] =
img_picto(
'',
'partnership',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToPartnership'));
248$parameters = array(
'elementList' => $elementList);
249$reshook = $hookmanager->executeHooks(
'emailElementlist', $parameters);
251 foreach ($hookmanager->resArray as $item => $value) {
252 $elementList[$item] = $value;
261if (!empty($user->socid)) {
266$permissiontoedit = ($user->admin ? 1 : 0);
267$permissiontodelete = ($user->admin ? 1 : 0);
270 $tmpmailtemplate->fetch($rowid);
271 if ($tmpmailtemplate->fk_user == $user->id) {
272 $permissiontoedit = 1;
273 $permissiontodelete = 1;
282if (
GETPOST(
'cancel',
'alpha')) {
286if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
290$parameters = array();
291$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
296if (empty($reshook)) {
298 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
301 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
304 $search_type_template =
'';
306 $search_fk_user =
'';
310 $search_array_options = array();
314 if ((
GETPOST(
'actionadd',
'alpha') && $permissiontoadd) || (
GETPOST(
'actionmodify',
'alpha') && $permissiontoedit)) {
315 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[25]));
316 $listfieldinsert = explode(
',', $tabfieldinsert[25]);
317 $listfieldmodify = explode(
',', $tabfieldinsert[25]);
318 $listfieldvalue = explode(
',', $tabfieldvalue[25]);
322 foreach ($listfield as $f => $value) {
324 if (in_array($value, [
'joinfiles',
'defaultfortype',
'content',
'content_lines',
'module'])) {
329 if (
GETPOST(
'actionmodify',
'alpha') && $value ==
'topic') {
330 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
333 if ((!GETPOSTISSET($value) ||
GETPOST($value) ==
'' ||
GETPOST($value) ==
'-1') && $value !=
'lang' && $value !=
'fk_user' && $value !=
'position') {
335 $fieldnamekey = $listfield[$f];
337 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
338 $fieldnamekey =
'Code';
340 if ($fieldnamekey ==
'code') {
341 $fieldnamekey =
'Code';
343 if ($fieldnamekey ==
'note') {
344 $fieldnamekey =
'Note';
346 if ($fieldnamekey ==
'type_template') {
347 $fieldnamekey =
'TypeOfTemplate';
349 if ($fieldnamekey ==
'fk_user') {
350 $fieldnamekey =
'Owner';
352 if ($fieldnamekey ==
'private') {
353 $fieldnamekey =
'Private';
355 if ($fieldnamekey ==
'position') {
356 $fieldnamekey =
'Position';
358 if ($fieldnamekey ==
'topic') {
359 $fieldnamekey =
'Topic';
362 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
368 if ($ok &&
GETPOST(
'actionadd')) {
370 $sql =
"INSERT INTO ".$tabname[25].
" (";
372 $sql .= $tabfieldinsert[25];
373 $sql .=
", active, enabled)";
378 foreach ($listfieldinsert as $f => $value) {
379 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
"";
380 if ($value ==
'lang') {
381 $keycode =
'langcode';
383 if (empty($keycode)) {
388 if ($value ==
'entity') {
389 $_POST[$keycode] = $conf->entity;
391 if ($value ==
'fk_user' && !($_POST[$keycode] > 0)) {
392 $_POST[$keycode] =
'';
394 if ($value ==
'private' && !is_numeric($_POST[$keycode])) {
395 $_POST[$keycode] =
'0';
397 if ($value ==
'position' && !is_numeric($_POST[$keycode])) {
398 $_POST[$keycode] =
'1';
400 if ($value ==
'defaultfortype' && !is_numeric($_POST[$keycode])) {
401 $_POST[$keycode] =
'0';
408 if (
GETPOST($keycode) ==
'' && $keycode !=
'langcode') {
410 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
412 } elseif ($keycode ==
'fk_user') {
414 $sql .=
" ".((int) $user->id);
416 $sql .=
" ".(GETPOSTINT($keycode));
418 } elseif ($keycode ==
'content') {
419 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
420 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position',
'entity'))) {
423 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
430 $result = $db->query($sql);
433 $_POST = array(
'id' => 25);
435 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
436 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
445 if ($ok &&
GETPOST(
'actionmodify')) {
449 setEventMessages($langs->trans(
"AnOwnerMustBeSetIfEmailTemplateIsPrivate"),
null,
'errors');
456 $sql =
"UPDATE ".$tabname[25].
" SET ";
459 foreach ($listfieldmodify as $field) {
460 if ($field ==
'entity') {
463 $_POST[$keycode] = $conf->entity;
465 $keycode = $listfieldvalue[$i];
468 if ($field ==
'lang') {
469 $keycode =
'langcode';
471 if (empty($keycode)) {
476 if ($field ==
'fk_user' && !(
GETPOSTINT(
'fk_user') > 0)) {
477 $_POST[
'fk_user'] =
'';
479 if ($field ==
'topic') {
480 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
482 if ($field ==
'joinfiles') {
483 $_POST[
'joinfiles'] =
GETPOST(
'joinfiles-'.$rowid);
485 if ($field ==
'content') {
486 $_POST[
'content'] =
GETPOST(
'content-'.$rowid,
'restricthtml');
488 if ($field ==
'content_lines') {
489 $_POST[
'content_lines'] =
GETPOST(
'content_lines-'.$rowid,
'restricthtml');
497 if (
GETPOST($keycode) ==
'' || (!in_array($keycode, array(
'langcode',
'position',
'private',
'defaultfortype')) && !
GETPOST($keycode))) {
499 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
501 } elseif ($keycode ==
'fk_user') {
503 $sql .=
" ".((int) $user->id);
505 $sql .=
" ".(GETPOSTINT($keycode));
507 } elseif ($keycode ==
'content') {
508 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
509 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position'))) {
512 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
517 $sql .=
" WHERE ".$db->escape($rowidcol).
" = ".((int) $rowid);
519 $sql .=
" AND fk_user = ".((int) $user->id);
525 $resql = $db->query($sql);
539 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
542 $sql =
"DELETE from ".$tabname[25].
" WHERE ".$rowidcol.
" = ".((int) $rowid);
544 $sql .=
" AND fk_user = ".((int) $user->id);
547 $result = $db->query($sql);
549 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
550 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
558 if ($action == $acts[0] && $permissiontoedit) {
561 $sql =
"UPDATE ".$tabname[25].
" SET active = 1 WHERE rowid = ".((int) $rowid);
563 $result = $db->query($sql);
570 if ($action == $acts[1] && $permissiontoedit) {
573 $sql =
"UPDATE ".$tabname[25].
" SET active = 0 WHERE rowid = ".((int) $rowid);
575 $result = $db->query($sql);
587$form =
new Form($db);
594if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
595 $title = $langs->trans(
"EMailsSetup");
597 $title = $langs->trans(
"EMailTemplates");
602$sql =
"SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
603$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_email_templates";
604$sql .=
" WHERE entity IN (".getEntity(
'email_template').
")";
606 $sql .=
" AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id).
"))";
607 $sql .=
" AND (active = 1 OR fk_user = ".((int) $user->id).
")";
610 $sql .=
" AND (lang = '".$db->escape($langs->defaultlang).
"' OR lang IS NULL OR lang = '')";
615if ($search_type_template !=
'' && $search_type_template !=
'-1') {
621if ($search_fk_user !=
'' && $search_fk_user !=
'-1') {
631if ($sortfield ==
'country') {
632 $sortfield =
'country_code';
634$sql .= $db->order($sortfield, $sortorder);
635$sql .= $db->plimit($listlimit + 1, $offset);
641llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-admin page-mails_templates');
643$arrayofselected = is_array($toselect) ? $toselect : array();
647 $param .=
'&mode='.urlencode($mode);
649if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
650 $param .=
'&contextpage='.urlencode($contextpage);
652if ($limit > 0 && $limit != $conf->liste_limit) {
653 $param .=
'&limit='.((int) $limit);
655if (!empty($search) && is_array($search)) {
656 foreach ($search as $key => $val) {
657 if (is_array($search[$key]) && count($search[$key])) {
658 foreach ($search[$key] as $skey) {
660 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
663 } elseif ($search[$key] !=
'') {
664 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
668if ($optioncss !=
'') {
669 $param .=
'&optioncss='.urlencode($optioncss);
672include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
674$parameters = array();
675$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object);
676$param .= $hookmanager->resPrint;
680$titlepicto =
'title_setup';
683$url = DOL_URL_ROOT.
'/admin/mails_templates.php?action=create';
685$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewEMailTemplate'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
688if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
694if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
699 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
706if ($action ==
'delete') {
707 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);
711$fieldlist = explode(
',', $tabfield[25]);
713if ($action ==
'create') {
716 $obj->label =
GETPOST(
'label');
718 $obj->type_template =
GETPOST(
'type_template');
721 $obj->position =
GETPOST(
'position');
722 $obj->topic =
GETPOST(
'topic');
723 $obj->joinfiles =
GETPOST(
'joinfiles');
724 $obj->defaultfortype =
GETPOST(
'defaultfortype') ? 1 : 0;
725 $obj->content =
GETPOST(
'content',
'restricthtml');
728 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
729 print
'<input type="hidden" name="token" value="'.newToken().
'">';
730 print
'<input type="hidden" name="action" value="add">';
731 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
733 print
'<div class="div-table-responsive-no-min">';
734 print
'<table class="noborder centpercent">';
737 print
'<tr class="liste_titre">';
738 foreach ($fieldlist as $field => $value) {
741 $valuetoshow = ucfirst($fieldlist[$field]);
742 $valuetoshow = $langs->trans($valuetoshow);
744 if ($fieldlist[$field] ==
'module') {
745 $valuetoshow =
' ';
747 if ($fieldlist[$field] ==
'fk_user') {
748 $valuetoshow = $langs->trans(
"Owner");
750 if ($fieldlist[$field] ==
'lang') {
751 $valuetoshow = (!
getDolGlobalInt(
'MAIN_MULTILANGS') ?
' ' : $langs->trans(
"Language"));
753 if ($fieldlist[$field] ==
'type') {
754 $valuetoshow = $langs->trans(
"Type");
756 if ($fieldlist[$field] ==
'position') {
759 if ($fieldlist[$field] ==
'code') {
760 $valuetoshow = $langs->trans(
"Code");
762 if ($fieldlist[$field] ==
'label') {
763 $valuetoshow = $langs->trans(
"Code");
765 if ($fieldlist[$field] ==
'type_template') {
766 $valuetoshow = $langs->trans(
"TypeOfTemplate");
769 if (in_array($fieldlist[$field], array(
'private',
'private',
'defaultfortype'))) {
773 if ($fieldlist[$field] ==
'topic') {
776 if ($fieldlist[$field] ==
'joinfiles') {
779 if ($fieldlist[$field] ==
'content') {
782 if ($fieldlist[$field] ==
'content_lines') {
785 if ($valuetoshow !=
'') {
786 print
'<th class="'.$css.
'">';
787 if (!empty($tabhelp[25][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[25][$value])) {
788 print
'<a href="'.$tabhelp[25][$value].
'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
789 } elseif (!empty($tabhelp[25][$value])) {
790 if (in_array($value, array(
'topic'))) {
791 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2, $value);
793 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2);
805 $tmpaction =
'create';
807 'fieldlist' => $fieldlist,
808 'tabname' => $tabname[25]
810 $reshook = $hookmanager->executeHooks(
'createEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
811 $error = $hookmanager->error;
812 $errors = $hookmanager->errors;
816 print
'<tr class="oddeven">';
818 if (empty($reshook)) {
819 if ($action ==
'edit') {
820 fieldList($fieldlist, $obj, $tabname[25],
'hide');
822 fieldList($fieldlist, $obj, $tabname[25],
'add');
826 print
'<td class="right">';
830 print
'<tr class="oddeven nodrag nodrop nohover"><td colspan="9">';
833 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
835 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content',
'content_lines');
837 foreach ($fieldsforcontent as $tmpfieldlist) {
839 if ($tmpfieldlist ==
'topic') {
840 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
842 if ($tmpfieldlist ==
'email_from') {
843 print $form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist);
845 if ($tmpfieldlist ==
'joinfiles') {
846 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
848 if ($tmpfieldlist ==
'content') {
849 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
851 if ($tmpfieldlist ==
'content_lines') {
852 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
856 if ($tmpfieldlist ==
'topic') {
857 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
858 } elseif ($tmpfieldlist ==
'email_from') {
859 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
860 } elseif ($tmpfieldlist ==
'joinfiles') {
861 print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, false, 0, 1);
863 $okforextended =
true;
865 $okforextended =
false;
867 $doleditor =
new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
''),
'', 400,
'dolibarr_mailings',
'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
868 print $doleditor->Create(1);
877 if ($action !=
'edit') {
879 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'"> ';
880 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
887 print
'<br><br><br>';
892$resql = $db->query($sql);
898$num = $db->num_rows($resql);
900print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
901print
'<input type="hidden" name="token" value="'.newToken().
'">';
902print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
904print
'<div class="div-table-responsive-no-min">';
905print
'<table class="noborder centpercent">';
911 $param .=
'&search_label='.urlencode($search_label);
913if (!empty($search_lang) && $search_lang !=
'-1') {
914 $param .=
'&search_lang='.urlencode($search_lang);
916if ($search_type_template !=
'-1') {
917 $param .=
'&search_type_template='.urlencode($search_type_template);
919if ($search_fk_user > 0) {
920 $param .=
'&search_fk_user='.urlencode($search_fk_user);
923 $param .=
'&search_module='.urlencode($search_module);
926 $param .=
'&search_topic='.urlencode($search_topic);
929$paramwithsearch = $param;
931 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
934 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
937 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
941if ($num > $listlimit) {
942 print
'<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).
'">';
943 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit ? 1 : 0),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
949print
'<tr class="liste_titre">';
952 print
'<td class="liste_titre center" width="64">';
953 $searchpicto = $form->showFilterButtons();
957foreach ($fieldlist as $field => $value) {
958 if ($value ==
'module') {
959 print
'<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).
'"></td>';
960 } elseif ($value ==
'label') {
961 print
'<td class="liste_titre"><input type="text" name="search_label" class="maxwidth75" value="'.dol_escape_htmltag($search_label).
'"></td>';
962 } elseif ($value ==
'lang') {
963 print
'<td class="liste_titre">';
964 print $formadmin->select_language($search_lang,
'search_lang', 0, array(), 1, 0, 0,
'maxwidth100');
966 } elseif ($value ==
'fk_user') {
967 print
'<td class="liste_titre">';
968 print $form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'), array(), 0, 0, 0,
'', 0,
'',
'maxwidth100', 1);
970 } elseif ($value ==
'topic') {
971 print
'<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).
'"></td>';
972 } elseif ($value ==
'type_template') {
973 print
'<td class="liste_titre center">';
975 print $form->selectarray(
'search_type_template', $elementList, $search_type_template, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth125', 1,
'', 0, 1);
977 } elseif (!in_array($value, array(
'content',
'content_lines'))) {
978 print
'<td class="liste_titre"></td>';
988 print
'<td class="liste_titre center" width="64">';
989 $searchpicto = $form->showFilterButtons();
996print
'<tr class="liste_titre">';
1001foreach ($fieldlist as $field => $value) {
1014 $valuetoshow = ucfirst($fieldlist[$field]);
1015 $valuetoshow = $langs->trans($valuetoshow);
1016 if ($fieldlist[$field] ==
'module') {
1017 $css =
'tdoverflowmax100';
1019 if ($fieldlist[$field] ==
'fk_user') {
1020 $valuetoshow = $langs->trans(
"Owner");
1022 if ($fieldlist[$field] ==
'lang') {
1023 $valuetoshow = $langs->trans(
"Language");
1025 if ($fieldlist[$field] ==
'type') {
1026 $valuetoshow = $langs->trans(
"Type");
1028 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
1029 $valuetoshow = $langs->trans(
"Code");
1031 if ($fieldlist[$field] ==
'type_template') {
1033 $valuetoshow = $langs->trans(
"TypeOfTemplate");
1035 if ($fieldlist[$field] ==
'private') {
1038 if ($fieldlist[$field] ==
'position') {
1042 if ($fieldlist[$field] ==
'joinfiles') {
1043 $valuetoshow = $langs->trans(
"FilesAttachedToEmail");
1047 if ($fieldlist[$field] ==
'content') {
1048 $valuetoshow = $langs->trans(
"Content");
1051 if ($fieldlist[$field] ==
'content_lines') {
1052 $valuetoshow = $langs->trans(
"ContentForLines");
1058 if (!empty($tabhelp[25][$value])) {
1059 if (in_array($value, array(
'topic'))) {
1060 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2,
'tooltip'.$value, $forcenowrap);
1062 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2,
'', $forcenowrap);
1065 $sortfieldtouse = ($sortable ? $fieldlist[$field] :
'');
1066 if ($sortfieldtouse ==
'type_template') {
1067 $sortfieldtouse .=
',lang,position,label';
1069 print
getTitleFieldOfList($valuetoshow, 0, $_SERVER[
"PHP_SELF"], $sortfieldtouse, ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $css.
' ');
1073print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
1084 $obj = $db->fetch_object($resql);
1087 if (($action ==
'edit' || $action ==
'preview') && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1088 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1090 $tmpaction =
'edit';
1091 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[25]);
1092 $reshook = $hookmanager->executeHooks(
'editEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1093 $error = $hookmanager->error;
1094 $errors = $hookmanager->errors;
1098 print
'<td class="center">';
1099 print
'<input type="hidden" name="page" value="'.$page.
'">';
1100 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1101 if ($action ==
'edit') {
1102 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1104 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1105 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1109 if (empty($reshook)) {
1110 fieldList($fieldlist, $obj, $tabname[25], $action);
1114 print
'<td class="center">';
1115 print
'<input type="hidden" name="page" value="'.$page.
'">';
1116 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1117 if ($action ==
'edit') {
1118 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1120 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1121 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1126 print
'<tr class="oddeven nohover" id="tr-aaa-'.$rowid.
'">';
1127 print
'<td colspan="10" class="paddingleft" style="padding-left: 20px">';
1129 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
1131 $fieldsforcontent[] =
'content_lines';
1133 foreach ($fieldsforcontent as $tmpfieldlist) {
1136 $valuetoshow = $obj->$tmpfieldlist;
1142 if ($tmpfieldlist ==
'topic') {
1143 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1144 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'"'.($action !=
'edit' ?
' disabled' :
'').
'>';
1147 if ($tmpfieldlist ==
'email_from') {
1148 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1149 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'"'.($action !=
'edit' ?
' disabled' :
'').
'>';
1152 if ($tmpfieldlist ==
'joinfiles') {
1153 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1154 print $form->selectyesno($tmpfieldlist.
'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, ($action !=
'edit'), 0, 1);
1158 if ($tmpfieldlist ==
'content') {
1159 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'margintoponly', 0, 2, $tmpfieldlist).
'<br>';
1160 $okforextended =
true;
1162 $okforextended =
false;
1164 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 500,
'dolibarr_mailings',
'In',
false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%', ($action !=
'edit' ? 1 : 0));
1165 print $doleditor->Create(1);
1167 if ($tmpfieldlist ==
'content_lines') {
1169 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'margintoponly', 0, 2, $tmpfieldlist).
'<br>';
1170 $okforextended =
true;
1172 $okforextended =
false;
1174 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 140,
'dolibarr_mailings',
'In',
false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1175 print $doleditor->Create(1);
1189 $tempmodulekey = $obj->module;
1190 if (empty($conf->$tempmodulekey) || !isModEnabled($tempmodulekey)) {
1196 $keyforobj =
'type_template';
1197 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1202 if (! (
int)
dol_eval($obj->enabled, 1, 1,
'1')) {
1213 if (!$user->admin && $obj->fk_user != $user->id) {
1219 $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) :
'');
1224 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1228 print
'<td class="center nowraponall" width="64">';
1229 if ($canbemodified) {
1230 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1232 print
'<a class="reposition editfielda" href="'.$url.
'&action=preview&token='.
newToken().
'">'.
img_view().
'</a>';
1235 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().$param.
'">'.
img_delete().
'</a>';
1240 $tmpaction =
'view';
1241 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[25]);
1242 $reshook = $hookmanager->executeHooks(
'viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1244 $error = $hookmanager->error;
1245 $errors = $hookmanager->errors;
1247 if (empty($reshook)) {
1248 foreach ($fieldlist as $field => $value) {
1249 if (in_array($fieldlist[$field], array(
'content',
'content_lines'))) {
1256 $tmpvar = $fieldlist[$field];
1257 $valuetoshow = $obj->$tmpvar;
1258 if ($value ==
'label' || $value ==
'topic') {
1259 if ($langs->trans($valuetoshow) != $valuetoshow) {
1260 $valuetoshow = $langs->trans($valuetoshow);
1264 if ($value ==
'label') {
1265 $class .=
' tdoverflowmax200';
1267 if ($value ==
'topic') {
1268 $class .=
' tdoverflowmax200 small';
1270 if ($value ==
'type_template') {
1271 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1272 $css =
"center tdoverflowmax150";
1274 if ($value ==
'lang' && $valuetoshow) {
1275 $valuetoshow = $valuetoshow.
' - '.$langs->trans(
"Language_".$valuetoshow);
1276 $class .=
' tdoverflowmax100';
1278 if ($value ==
'fk_user') {
1279 if ($valuetoshow > 0) {
1280 $fuser =
new User($db);
1281 $fuser->fetch($valuetoshow);
1282 $valuetoshow = $fuser->getNomUrl(-1);
1283 $class .=
' tdoverflowmax100';
1286 if ($value ==
'private') {
1289 $valuetoshow =
yn($valuetoshow);
1294 if ($value ==
'position') {
1297 if (in_array($value, array(
'joinfiles',
'defaultfortype'))) {
1301 $valuetoshow =
'<input type="checkbox" checked="checked" disabled>';
1312 print
'<!-- '.$fieldlist[$field].
' -->';
1313 print
'<td class="'.$class.
'"';
1314 if (in_array($value, array(
'code',
'label',
'topic'))) {
1315 print
' title="'.dol_escape_htmltag($valuetoshow).
'"';
1325 print
'<td class="center nowrap">';
1326 if ($canbedisabled) {
1327 print
'<a class="reposition" href="'.$url.
'&action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
1329 print
'<span class="opacitymedium">'.$actl[$obj->active].
'</span>';
1335 print
'<td class="center nowraponall" width="64">';
1336 if ($canbemodified) {
1337 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1340 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
1355if ($nbqualified == 0) {
1357 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1366if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1387 global $langs, $user, $db;
1389 global $elementList;
1393 foreach ($fieldlist as $field => $value) {
1395 if ($value ==
'module') {
1397 } elseif ($value ==
'fk_user') {
1399 if ($user->admin &&
$context !=
'preview') {
1400 print $form->select_dolusers(GETPOSTISSET(
'fk_user') ?
GETPOSTINT(
'fk_user') : (empty($obj->$value) ?
'' : $obj->$value),
'fk_user', 1, array(), 0, ($user->admin ?
'' :
'hierarchyme'), array(), 0, 0, 0,
'', 0,
'',
'minwidth75 maxwidth100');
1403 print $user->getNomUrl(-1);
1404 $forcedvalue = $user->id;
1406 if ($obj && !empty($obj->$value) && $obj->$value > 0) {
1407 $fuser =
new User($db);
1408 $fuser->fetch($obj->$value);
1409 print $fuser->getNomUrl(-1);
1410 $forcedvalue = $fuser->id;
1412 $forcedvalue = $obj->$value;
1416 print
'<input type="hidden" value="'.$forcedvalue.
'" name="'.$keyname.
'">';
1419 } elseif ($value ==
'lang') {
1422 $selectedlang = GETPOSTISSET(
'langcode') ?
GETPOST(
'langcode',
'aZ09') : $langs->defaultlang;
1424 $selectedlang = $obj->lang;
1426 print $formadmin->select_language($selectedlang,
'langcode', 0, array(), 1, 0, 0,
'maxwidth100');
1428 if (!empty($obj->lang)) {
1429 print $obj->lang.
' - '.$langs->trans(
'Language_'.$obj->lang);
1432 if ($keyname ==
'lang') {
1433 $keyname =
'langcode';
1435 print
'<input type="hidden" value="'.(empty($obj->lang) ?
'' : $obj->lang).
'" name="'.$keyname.
'">';
1438 } elseif ($value ==
'type_template') {
1440 print
'<td class="center">';
1441 if ((
$context ==
'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) ||
$context ==
'preview') {
1443 print
'<input type="hidden" name="type_template" value="'.$obj->type_template.
'">';
1444 print $obj->type_template;
1446 print $form->selectarray(
'type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth75 maxwidth125', 1,
'', 0, 1);
1449 } elseif (
$context ==
'add' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1451 } elseif (
$context ==
'edit' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1453 } elseif (
$context ==
'preview' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1455 } elseif (
$context ==
'hide' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1461 if ($value ==
'code') {
1462 $class =
'maxwidth100';
1464 if ($value ==
'label') {
1465 $class =
'maxwidth200';
1467 if ($value ==
'private') {
1468 $class =
'maxwidth50';
1469 $classtd =
'center';
1471 if ($value ==
'position') {
1472 $class =
'maxwidth50 center';
1473 $classtd =
'center';
1475 if ($value ==
'topic') {
1476 $class =
'quatrevingtpercent';
1478 if ($value ==
'defaultfortype') {
1479 $class =
'width25 center';
1480 $classtd =
'center';
1483 print
'<td'.($classtd ?
' class="'.$classtd.
'"' :
'').
'>';
1484 if ($value ==
'private' &&
$context !=
'preview') {
1485 if (empty($user->admin)) {
1487 print $form->selectyesno($value, GETPOSTISSET($value) ?
GETPOSTINT($value) : ((
$context !=
'add' && isset($obj->$value)) ? $obj->$value :
'1'), 1,
false, 0, 1);
1490 print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value :
''), 1,
false, 0, 1);
1493 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($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_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.
$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.