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');
67$search_label =
GETPOST(
'search_label',
'alphanohtml');
68$search_type_template =
GETPOST(
'search_type_template',
'alpha');
69$search_lang =
GETPOST(
'search_lang',
'alpha');
70$search_fk_user =
GETPOST(
'search_fk_user',
'intcomma');
71$search_topic =
GETPOST(
'search_topic',
'alpha');
72$search_module =
GETPOST(
'search_module',
'alpha');
78$actl[0] =
img_picto($langs->trans(
"Disabled"),
'switch_off',
'class="size15x"');
79$actl[1] =
img_picto($langs->trans(
"Activated"),
'switch_on',
'class="size15x"');
81$listoffset =
GETPOST(
'listoffset',
'alpha');
82$listlimit =
GETPOST(
'listlimit',
'alpha') > 0 ?
GETPOST(
'listlimit',
'alpha') : 1000;
85$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
86$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
88if (empty($page) || $page == -1) {
91$offset = $listlimit * $page;
95if (empty($sortfield)) {
96 $sortfield =
'type_template,lang,position,label';
98if (empty($sortorder)) {
103$hookmanager->initHooks(array(
'emailtemplates'));
108$tabname[25] = MAIN_DB_PREFIX.
"c_email_templates";
112$tabfield[25] =
"label,lang,type_template,fk_user,private,position,module,topic,joinfiles,defaultfortype,content";
114 $tabfield[25] .=
',content_lines';
118$tabfieldvalue = array();
119$tabfieldvalue[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
121 $tabfieldvalue[25] .=
',content_lines';
125$tabfieldinsert = array();
126$tabfieldinsert[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
128 $tabfieldinsert[25] .=
',content_lines';
130$tabfieldinsert[25] .=
',entity';
138require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
142 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
143 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
144 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
145 foreach ($tmp as $key => $val) {
146 $helpsubstit .= $key.
' -> '.$val.
'<br>';
147 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
151 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
152 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
153 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
154 foreach ($tmp as $key => $val) {
155 $helpsubstit .= $key.
' -> '.$val.
'<br>';
158 foreach ($tmp as $key => $val) {
159 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
166 'label' => $langs->trans(
'EnterAnyCode'),
167 'type_template' => $langs->trans(
"TemplateForElement"),
168 'private' => $langs->trans(
"TemplateIsVisibleByOwnerOnly"),
169 'position' => $langs->trans(
"PositionIntoComboList"),
170 'topic' =>
'<span class="small">'.$helpsubstit.
'</span>',
171 'email_from' => $langs->trans(
'ForceEmailFrom'),
172 'joinfiles' => $langs->trans(
'AttachMainDocByDefault'),
173 'defaultfortype' => $langs->trans(
"DefaultForTypeDesc"),
174 'content' =>
'<span class="small">'.$helpsubstit.
'</span>',
175 'content_lines' =>
'<span class="small">'.$helpsubstitforlines.
'</span>'
180$elementList = array();
183$elementList[
'all'] =
'-- '.dol_escape_htmltag($langs->trans(
"All")).
' --';
184$elementList[
'none'] =
'-- '.dol_escape_htmltag($langs->trans(
"None")).
' --';
185$elementList[
'user'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToUser'));
186if (isModEnabled(
'member') && $user->hasRight(
'adherent',
'lire')) {
187 $elementList[
'member'] =
img_picto(
'',
'object_member',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToMember'));
189if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
190 $elementList[
'recruitmentcandidature_send'] =
img_picto(
'',
'recruitmentcandidature',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'RecruitmentCandidatures'));
192if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
193 $elementList[
'thirdparty'] =
img_picto(
'',
'company',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToThirdparty'));
195if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'contact',
'lire')) {
196 $elementList[
'contact'] =
img_picto(
'',
'contact',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToContact'));
198if (isModEnabled(
'project')) {
199 $elementList[
'project'] =
img_picto(
'',
'project',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToProject'));
201if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
202 $elementList[
'propal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendProposal'));
204if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
205 $elementList[
'order_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendOrder'));
207if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
208 $elementList[
'facture_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendInvoice'));
210if (isModEnabled(
"shipping")) {
211 $elementList[
'shipping_send'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendShipment'));
213if (isModEnabled(
"reception")) {
214 $elementList[
'reception_send'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendReception'));
216if (isModEnabled(
'intervention')) {
217 $elementList[
'fichinter_send'] =
img_picto(
'',
'intervention',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendIntervention'));
219if (isModEnabled(
'supplier_proposal')) {
220 $elementList[
'supplier_proposal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierRequestForQuotation'));
222if (isModEnabled(
"supplier_order") && ($user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'read'))) {
223 $elementList[
'order_supplier_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierOrder'));
225if (isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
226 $elementList[
'invoice_supplier_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierInvoice'));
228if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
229 $elementList[
'contract'] =
img_picto(
'',
'contract',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendContract'));
231if (isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
232 $elementList[
'ticket_send'] =
img_picto(
'',
'ticket',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToTicket'));
234if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
235 $elementList[
'expensereport_send'] =
img_picto(
'',
'trip',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToExpenseReport'));
237if (isModEnabled(
'agenda')) {
238 $elementList[
'actioncomm_send'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventPush'));
240if (isModEnabled(
'eventorganization') && $user->hasRight(
'eventorganization',
'read')) {
241 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventOrganization'));
243if (isModEnabled(
'partnership') && $user->hasRight(
'partnership',
'read')) {
244 $elementList[
'partnership_send'] =
img_picto(
'',
'partnership',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToPartnership'));
247$parameters = array(
'elementList' => $elementList);
248$reshook = $hookmanager->executeHooks(
'emailElementlist', $parameters);
250 foreach ($hookmanager->resArray as $item => $value) {
251 $elementList[$item] = $value;
260if (!empty($user->socid)) {
265$permissiontoedit = ($user->admin ? 1 : 0);
266$permissiontodelete = ($user->admin ? 1 : 0);
269 $tmpmailtemplate->fetch($rowid);
270 if ($tmpmailtemplate->fk_user == $user->id) {
271 $permissiontoedit = 1;
272 $permissiontodelete = 1;
281if (
GETPOST(
'cancel',
'alpha')) {
285if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
289$parameters = array();
290$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
295if (empty($reshook)) {
297 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
300 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
303 $search_type_template =
'';
305 $search_fk_user =
'';
309 $search_array_options = array();
313 if ((
GETPOST(
'actionadd',
'alpha') && $permissiontoadd) || (
GETPOST(
'actionmodify',
'alpha') && $permissiontoedit)) {
314 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[25]));
315 $listfieldinsert = explode(
',', $tabfieldinsert[25]);
316 $listfieldmodify = explode(
',', $tabfieldinsert[25]);
317 $listfieldvalue = explode(
',', $tabfieldvalue[25]);
321 foreach ($listfield as $f => $value) {
323 if (in_array($value, [
'joinfiles',
'defaultfortype',
'content',
'content_lines',
'module'])) {
328 if (
GETPOST(
'actionmodify',
'alpha') && $value ==
'topic') {
329 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
332 if ((!GETPOSTISSET($value) ||
GETPOST($value) ==
'' ||
GETPOST($value) ==
'-1') && $value !=
'lang' && $value !=
'fk_user' && $value !=
'position') {
334 $fieldnamekey = $listfield[$f];
336 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
337 $fieldnamekey =
'Code';
339 if ($fieldnamekey ==
'code') {
340 $fieldnamekey =
'Code';
342 if ($fieldnamekey ==
'note') {
343 $fieldnamekey =
'Note';
345 if ($fieldnamekey ==
'type_template') {
346 $fieldnamekey =
'TypeOfTemplate';
348 if ($fieldnamekey ==
'fk_user') {
349 $fieldnamekey =
'Owner';
351 if ($fieldnamekey ==
'private') {
352 $fieldnamekey =
'Private';
354 if ($fieldnamekey ==
'position') {
355 $fieldnamekey =
'Position';
357 if ($fieldnamekey ==
'topic') {
358 $fieldnamekey =
'Topic';
361 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
367 if ($ok &&
GETPOST(
'actionadd')) {
369 $sql =
"INSERT INTO ".$tabname[25].
" (";
371 $sql .= $tabfieldinsert[25];
372 $sql .=
", active, enabled)";
377 foreach ($listfieldinsert as $f => $value) {
378 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
"";
379 if ($value ==
'lang') {
380 $keycode =
'langcode';
382 if (empty($keycode)) {
387 if ($value ==
'entity') {
388 $_POST[$keycode] = $conf->entity;
390 if ($value ==
'fk_user' && !($_POST[$keycode] > 0)) {
391 $_POST[$keycode] =
'';
393 if ($value ==
'private' && !is_numeric($_POST[$keycode])) {
394 $_POST[$keycode] =
'0';
396 if ($value ==
'position' && !is_numeric($_POST[$keycode])) {
397 $_POST[$keycode] =
'1';
399 if ($value ==
'defaultfortype' && !is_numeric($_POST[$keycode])) {
400 $_POST[$keycode] =
'0';
407 if (
GETPOST($keycode) ==
'' && $keycode !=
'langcode') {
409 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
411 } elseif ($keycode ==
'fk_user') {
413 $sql .=
" ".((int) $user->id);
415 $sql .=
" ".(GETPOSTINT($keycode));
417 } elseif ($keycode ==
'content') {
418 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
419 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position',
'entity'))) {
422 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
429 $result = $db->query($sql);
432 $_POST = array(
'id' => 25);
434 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
435 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
444 if ($ok &&
GETPOST(
'actionmodify')) {
448 setEventMessages($langs->trans(
"AnOwnerMustBeSetIfEmailTemplateIsPrivate"),
null,
'errors');
455 $sql =
"UPDATE ".$tabname[25].
" SET ";
458 foreach ($listfieldmodify as $field) {
459 if ($field ==
'entity') {
462 $_POST[$keycode] = $conf->entity;
464 $keycode = $listfieldvalue[$i];
467 if ($field ==
'lang') {
468 $keycode =
'langcode';
470 if (empty($keycode)) {
475 if ($field ==
'fk_user' && !(
GETPOSTINT(
'fk_user') > 0)) {
476 $_POST[
'fk_user'] =
'';
478 if ($field ==
'topic') {
479 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
481 if ($field ==
'joinfiles') {
482 $_POST[
'joinfiles'] =
GETPOST(
'joinfiles-'.$rowid);
484 if ($field ==
'content') {
485 $_POST[
'content'] =
GETPOST(
'content-'.$rowid,
'restricthtml');
487 if ($field ==
'content_lines') {
488 $_POST[
'content_lines'] =
GETPOST(
'content_lines-'.$rowid,
'restricthtml');
496 if (
GETPOST($keycode) ==
'' || (!in_array($keycode, array(
'langcode',
'position',
'private',
'defaultfortype')) && !
GETPOST($keycode))) {
498 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
500 } elseif ($keycode ==
'fk_user') {
502 $sql .=
" ".((int) $user->id);
504 $sql .=
" ".(GETPOSTINT($keycode));
506 } elseif ($keycode ==
'content') {
507 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
508 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position'))) {
511 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
516 $sql .=
" WHERE ".$db->escape($rowidcol).
" = ".((int) $rowid);
518 $sql .=
" AND fk_user = ".((int) $user->id);
524 $resql = $db->query($sql);
538 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
541 $sql =
"DELETE from ".$tabname[25].
" WHERE ".$rowidcol.
" = ".((int) $rowid);
543 $sql .=
" AND fk_user = ".((int) $user->id);
546 $result = $db->query($sql);
548 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
549 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
557 if ($action == $acts[0] && $permissiontoedit) {
560 $sql =
"UPDATE ".$tabname[25].
" SET active = 1 WHERE rowid = ".((int) $rowid);
562 $result = $db->query($sql);
569 if ($action == $acts[1] && $permissiontoedit) {
572 $sql =
"UPDATE ".$tabname[25].
" SET active = 0 WHERE rowid = ".((int) $rowid);
574 $result = $db->query($sql);
586$form =
new Form($db);
593if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
594 $title = $langs->trans(
"EMailsSetup");
596 $title = $langs->trans(
"EMailTemplates");
601$sql =
"SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
602$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_email_templates";
603$sql .=
" WHERE entity IN (".getEntity(
'email_template').
")";
605 $sql .=
" AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id).
"))";
606 $sql .=
" AND (active = 1 OR fk_user = ".((int) $user->id).
")";
609 $sql .=
" AND (lang = '".$db->escape($langs->defaultlang).
"' OR lang IS NULL OR lang = '')";
614if ($search_type_template !=
'' && $search_type_template !=
'-1') {
620if ($search_fk_user !=
'' && $search_fk_user !=
'-1') {
630if ($sortfield ==
'country') {
631 $sortfield =
'country_code';
633$sql .= $db->order($sortfield, $sortorder);
634$sql .= $db->plimit($listlimit + 1, $offset);
640llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-admin page-mails_templates');
642$arrayofselected = is_array($toselect) ? $toselect : array();
646 $param .=
'&mode='.urlencode($mode);
648if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
649 $param .=
'&contextpage='.urlencode($contextpage);
651if ($limit > 0 && $limit != $conf->liste_limit) {
652 $param .=
'&limit='.((int) $limit);
654if (!empty($search) && is_array($search)) {
655 foreach ($search as $key => $val) {
656 if (is_array($search[$key]) && count($search[$key])) {
657 foreach ($search[$key] as $skey) {
659 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
662 } elseif ($search[$key] !=
'') {
663 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
667if ($optioncss !=
'') {
668 $param .=
'&optioncss='.urlencode($optioncss);
671include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
673$parameters = array();
674$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object);
675$param .= $hookmanager->resPrint;
679$titlepicto =
'title_setup';
682$url = DOL_URL_ROOT.
'/admin/mails_templates.php?action=create';
684$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewEMailTemplate'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
687if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
693if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
698 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
705if ($action ==
'delete') {
706 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.((int) $rowid), $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_delete',
'', 0, 1);
710$fieldlist = explode(
',', $tabfield[25]);
712if ($action ==
'create') {
715 $obj->label =
GETPOST(
'label');
717 $obj->type_template =
GETPOST(
'type_template');
720 $obj->position =
GETPOST(
'position');
721 $obj->topic =
GETPOST(
'topic');
722 $obj->joinfiles =
GETPOST(
'joinfiles');
723 $obj->defaultfortype =
GETPOST(
'defaultfortype') ? 1 : 0;
724 $obj->content =
GETPOST(
'content',
'restricthtml');
727 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
728 print
'<input type="hidden" name="token" value="'.newToken().
'">';
729 print
'<input type="hidden" name="action" value="add">';
730 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
732 print
'<div class="div-table-responsive-no-min">';
733 print
'<table class="noborder centpercent">';
736 print
'<tr class="liste_titre">';
737 foreach ($fieldlist as $field => $value) {
740 $valuetoshow = ucfirst($fieldlist[$field]);
741 $valuetoshow = $langs->trans($valuetoshow);
743 if ($fieldlist[$field] ==
'module') {
744 $valuetoshow =
' ';
746 if ($fieldlist[$field] ==
'fk_user') {
747 $valuetoshow = $langs->trans(
"Owner");
749 if ($fieldlist[$field] ==
'lang') {
750 $valuetoshow = (!
getDolGlobalInt(
'MAIN_MULTILANGS') ?
' ' : $langs->trans(
"Language"));
752 if ($fieldlist[$field] ==
'type') {
753 $valuetoshow = $langs->trans(
"Type");
755 if ($fieldlist[$field] ==
'position') {
758 if ($fieldlist[$field] ==
'code') {
759 $valuetoshow = $langs->trans(
"Code");
761 if ($fieldlist[$field] ==
'label') {
762 $valuetoshow = $langs->trans(
"Code");
764 if ($fieldlist[$field] ==
'type_template') {
765 $valuetoshow = $langs->trans(
"TypeOfTemplate");
768 if (in_array($fieldlist[$field], array(
'private',
'private',
'defaultfortype'))) {
772 if ($fieldlist[$field] ==
'topic') {
775 if ($fieldlist[$field] ==
'joinfiles') {
778 if ($fieldlist[$field] ==
'content') {
781 if ($fieldlist[$field] ==
'content_lines') {
784 if ($valuetoshow !=
'') {
785 print
'<th class="'.$css.
'">';
786 if (!empty($tabhelp[25][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[25][$value])) {
787 print
'<a href="'.$tabhelp[25][$value].
'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
788 } elseif (!empty($tabhelp[25][$value])) {
789 if (in_array($value, array(
'topic'))) {
790 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2, $value);
792 print $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2);
804 $tmpaction =
'create';
806 'fieldlist' => $fieldlist,
807 'tabname' => $tabname[25]
809 $reshook = $hookmanager->executeHooks(
'createEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
810 $error = $hookmanager->error;
811 $errors = $hookmanager->errors;
815 print
'<tr class="oddeven">';
817 if (empty($reshook)) {
818 if ($action ==
'edit') {
819 fieldList($fieldlist, $obj, $tabname[25],
'hide');
821 fieldList($fieldlist, $obj, $tabname[25],
'add');
825 print
'<td class="right">';
829 print
'<tr class="oddeven nodrag nodrop nohover"><td colspan="9">';
832 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
834 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content',
'content_lines');
836 foreach ($fieldsforcontent as $tmpfieldlist) {
838 if ($tmpfieldlist ==
'topic') {
839 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
841 if ($tmpfieldlist ==
'email_from') {
842 print $form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist);
844 if ($tmpfieldlist ==
'joinfiles') {
845 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
847 if ($tmpfieldlist ==
'content') {
848 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
850 if ($tmpfieldlist ==
'content_lines') {
851 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
855 if ($tmpfieldlist ==
'topic') {
856 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
857 } elseif ($tmpfieldlist ==
'email_from') {
858 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
859 } elseif ($tmpfieldlist ==
'joinfiles') {
860 print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, false, 0, 1);
862 $okforextended =
true;
864 $okforextended =
false;
866 $doleditor =
new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
''),
'', 400,
'dolibarr_mailings',
'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
867 print $doleditor->Create(1);
876 if ($action !=
'edit') {
878 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'"> ';
879 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
886 print
'<br><br><br>';
891$resql = $db->query($sql);
897$num = $db->num_rows($resql);
899print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
900print
'<input type="hidden" name="token" value="'.newToken().
'">';
901print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
903print
'<div class="div-table-responsive-no-min">';
904print
'<table class="noborder centpercent">';
910 $param .=
'&search_label='.urlencode($search_label);
912if (!empty($search_lang) && $search_lang !=
'-1') {
913 $param .=
'&search_lang='.urlencode($search_lang);
915if ($search_type_template !=
'-1') {
916 $param .=
'&search_type_template='.urlencode($search_type_template);
918if ($search_fk_user > 0) {
919 $param .=
'&search_fk_user='.urlencode($search_fk_user);
922 $param .=
'&search_module='.urlencode($search_module);
925 $param .=
'&search_topic='.urlencode($search_topic);
928$paramwithsearch = $param;
930 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
933 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
936 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
940if ($num > $listlimit) {
941 print
'<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).
'">';
942 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit ? 1 : 0),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
948print
'<tr class="liste_titre">';
951 print
'<td class="liste_titre center" width="64">';
952 $searchpicto = $form->showFilterButtons();
956foreach ($fieldlist as $field => $value) {
957 if ($value ==
'module') {
958 print
'<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).
'"></td>';
959 } elseif ($value ==
'label') {
960 print
'<td class="liste_titre"><input type="text" name="search_label" class="maxwidth75" value="'.dol_escape_htmltag($search_label).
'"></td>';
961 } elseif ($value ==
'lang') {
962 print
'<td class="liste_titre">';
963 print $formadmin->select_language($search_lang,
'search_lang', 0, array(), 1, 0, 0,
'maxwidth100');
965 } elseif ($value ==
'fk_user') {
966 print
'<td class="liste_titre">';
967 print $form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'), array(), 0, 0, 0,
'', 0,
'',
'maxwidth100', 1);
969 } elseif ($value ==
'topic') {
970 print
'<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).
'"></td>';
971 } elseif ($value ==
'type_template') {
972 print
'<td class="liste_titre center">';
974 print $form->selectarray(
'search_type_template', $elementList, $search_type_template, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth125', 1,
'', 0, 1);
976 } elseif (!in_array($value, array(
'content',
'content_lines'))) {
977 print
'<td class="liste_titre"></td>';
987 print
'<td class="liste_titre center" width="64">';
988 $searchpicto = $form->showFilterButtons();
995print
'<tr class="liste_titre">';
1000foreach ($fieldlist as $field => $value) {
1013 $valuetoshow = ucfirst($fieldlist[$field]);
1014 $valuetoshow = $langs->trans($valuetoshow);
1015 if ($fieldlist[$field] ==
'module') {
1016 $css =
'tdoverflowmax100';
1018 if ($fieldlist[$field] ==
'fk_user') {
1019 $valuetoshow = $langs->trans(
"Owner");
1021 if ($fieldlist[$field] ==
'lang') {
1022 $valuetoshow = $langs->trans(
"Language");
1024 if ($fieldlist[$field] ==
'type') {
1025 $valuetoshow = $langs->trans(
"Type");
1027 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
1028 $valuetoshow = $langs->trans(
"Code");
1030 if ($fieldlist[$field] ==
'type_template') {
1032 $valuetoshow = $langs->trans(
"TypeOfTemplate");
1034 if ($fieldlist[$field] ==
'private') {
1037 if ($fieldlist[$field] ==
'position') {
1041 if ($fieldlist[$field] ==
'joinfiles') {
1042 $valuetoshow = $langs->trans(
"FilesAttachedToEmail");
1046 if ($fieldlist[$field] ==
'content') {
1047 $valuetoshow = $langs->trans(
"Content");
1050 if ($fieldlist[$field] ==
'content_lines') {
1051 $valuetoshow = $langs->trans(
"ContentForLines");
1057 if (!empty($tabhelp[25][$value])) {
1058 if (in_array($value, array(
'topic'))) {
1059 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2,
'tooltip'.$value, $forcenowrap);
1061 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[25][$value], 1,
'help',
'', 0, 2,
'', $forcenowrap);
1064 $sortfieldtouse = ($sortable ? $fieldlist[$field] :
'');
1065 if ($sortfieldtouse ==
'type_template') {
1066 $sortfieldtouse .=
',lang,position,label';
1068 print
getTitleFieldOfList($valuetoshow, 0, $_SERVER[
"PHP_SELF"], $sortfieldtouse, ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $css.
' ');
1072print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
1083 $obj = $db->fetch_object($resql);
1086 if (($action ==
'edit' || $action ==
'preview') && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1087 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1089 $tmpaction =
'edit';
1090 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[25]);
1091 $reshook = $hookmanager->executeHooks(
'editEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1092 $error = $hookmanager->error;
1093 $errors = $hookmanager->errors;
1097 print
'<td class="center">';
1098 print
'<input type="hidden" name="page" value="'.$page.
'">';
1099 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1100 if ($action ==
'edit') {
1101 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1103 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1104 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1108 if (empty($reshook)) {
1109 fieldList($fieldlist, $obj, $tabname[25], $action);
1113 print
'<td class="center">';
1114 print
'<input type="hidden" name="page" value="'.$page.
'">';
1115 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1116 if ($action ==
'edit') {
1117 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1119 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1120 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1125 print
'<tr class="oddeven nohover" id="tr-aaa-'.$rowid.
'">';
1126 print
'<td colspan="10">';
1128 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
1130 $fieldsforcontent[] =
'content_lines';
1132 foreach ($fieldsforcontent as $tmpfieldlist) {
1135 $valuetoshow = $obj->$tmpfieldlist;
1141 if ($tmpfieldlist ==
'topic') {
1142 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1143 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'"'.($action !=
'edit' ?
' disabled' :
'').
'>';
1146 if ($tmpfieldlist ==
'email_from') {
1147 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1148 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'"'.($action !=
'edit' ?
' disabled' :
'').
'>';
1151 if ($tmpfieldlist ==
'joinfiles') {
1152 print
'<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</div> ';
1153 print $form->selectyesno($tmpfieldlist.
'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, ($action !=
'edit'), 0, 1);
1157 if ($tmpfieldlist ==
'content') {
1158 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1159 $okforextended =
true;
1161 $okforextended =
false;
1163 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 500,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%', ($action !=
'edit' ? 1 : 0));
1164 print $doleditor->Create(1);
1166 if ($tmpfieldlist ==
'content_lines') {
1168 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[25][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1169 $okforextended =
true;
1171 $okforextended =
false;
1173 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 140,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1174 print $doleditor->Create(1);
1188 $tempmodulekey = $obj->module;
1189 if (empty($conf->$tempmodulekey) || !isModEnabled($tempmodulekey)) {
1195 $keyforobj =
'type_template';
1196 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1201 if (! (
int)
dol_eval($obj->enabled, 1, 1,
'1')) {
1212 if (!$user->admin && $obj->fk_user != $user->id) {
1218 $url = $_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code :
'')).(!empty($obj->code) ?
'&code='.urlencode($obj->code) :
'');
1223 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1227 print
'<td class="center nowraponall" width="64">';
1228 if ($canbemodified) {
1229 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1231 print
'<a class="reposition editfielda" href="'.$url.
'&action=preview&token='.
newToken().
'">'.
img_view().
'</a>';
1234 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
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.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0, $hideselectlimit=0, $beforearrows='', $hidenavigation=0)
Function to show navigation arrows into lists.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_view($titlealt='default', $float=0, $other='class="valignmiddle"')
Show logo view card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
fieldList($fieldlist, $obj=null, $tabname='', $context='')
Show fields in insert/edit mode.
$context
@method int call_trigger(string $triggerName, User $user)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.