37require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47$langsArray=array(
"errors",
"admin",
"mails",
"languages");
49if (isModEnabled(
'adherent')) {
50 $langsArray[]=
'members';
52if (isModEnabled(
'eventorganization')) {
53 $langsArray[]=
'eventorganization';
56$langs->loadLangs($langsArray);
58$toselect =
GETPOST(
'toselect',
'array');
59$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
60$massaction =
GETPOST(
'massaction',
'alpha');
61$confirm =
GETPOST(
'confirm',
'alpha');
63$optioncss =
GETPOST(
'optioncss',
'alpha');
66$rowid =
GETPOST(
'rowid',
'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;
84$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
85$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
86$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
87$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
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";
113if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
114 $tabfield[25] .=
',content_lines';
118$tabfieldvalue = array();
119$tabfieldvalue[25] =
"label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content";
120if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
121 $tabfieldvalue[25] .=
',content_lines';
125$tabfieldinsert = array();
126$tabfieldinsert[25] =
"label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content";
127if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
128 $tabfieldinsert[25] .=
',content_lines';
130$tabfieldinsert[25] .=
',entity';
138require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
140if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
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 'joinfiles'=>$langs->trans(
'AttachMainDocByDefault'),
172 'defaultfortype'=>$langs->trans(
"DefaultForTypeDesc"),
173 'content'=>
'<span class="small">'.$helpsubstit.
'</span>',
174 'content_lines'=>
'<span class="small">'.$helpsubstitforlines.
'</span>'
179$elementList = array();
182$elementList[
'all'] =
'-- '.dol_escape_htmltag($langs->trans(
"All")).
' --';
183$elementList[
'none'] =
'-- '.dol_escape_htmltag($langs->trans(
"None")).
' --';
184$elementList[
'user'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToUser'));
185if (isModEnabled(
'adherent') && $user->hasRight(
'adherent',
'lire')) {
186 $elementList[
'member'] =
img_picto(
'',
'object_member',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToMember'));
188if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
189 $elementList[
'recruitmentcandidature_send'] =
img_picto(
'',
'recruitmentcandidature',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'RecruitmentCandidatures'));
191if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
192 $elementList[
'thirdparty'] =
img_picto(
'',
'company',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToThirdparty'));
194if (isModEnabled(
'project')) {
195 $elementList[
'project'] =
img_picto(
'',
'project',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToProject'));
197if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
198 $elementList[
'propal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendProposal'));
200if (isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')) {
201 $elementList[
'order_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendOrder'));
203if (isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire')) {
204 $elementList[
'facture_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendInvoice'));
206if (isModEnabled(
"expedition")) {
207 $elementList[
'shipping_send'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendShipment'));
209if (isModEnabled(
"reception")) {
210 $elementList[
'reception_send'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendReception'));
212if (isModEnabled(
'ficheinter')) {
213 $elementList[
'fichinter_send'] =
img_picto(
'',
'intervention',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendIntervention'));
215if (isModEnabled(
'supplier_proposal')) {
216 $elementList[
'supplier_proposal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierRequestForQuotation'));
218if (isModEnabled(
"supplier_order") && ($user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'read'))) {
219 $elementList[
'order_supplier_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierOrder'));
221if (isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
222 $elementList[
'invoice_supplier_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierInvoice'));
224if (isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire')) {
225 $elementList[
'contract'] =
img_picto(
'',
'contract',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendContract'));
227if (isModEnabled(
'ticket') && !empty($user->rights->ticket->read)) {
228 $elementList[
'ticket_send'] =
img_picto(
'',
'ticket',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToTicket'));
230if (isModEnabled(
'expensereport') && !empty($user->rights->expensereport->lire)) {
231 $elementList[
'expensereport_send'] =
img_picto(
'',
'trip',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToExpenseReport'));
233if (isModEnabled(
'agenda')) {
234 $elementList[
'actioncomm_send'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventPush'));
236if (isModEnabled(
'eventorganization') && !empty($user->rights->eventorganization->read)) {
237 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventOrganization'));
239if (isModEnabled(
'partnership') && !empty($user->rights->partnership->read)) {
240 $elementList[
'partnership_send'] =
img_picto(
'',
'partnership',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToPartnership'));
243$parameters = array(
'elementList'=>$elementList);
244$reshook = $hookmanager->executeHooks(
'emailElementlist', $parameters);
246 foreach ($hookmanager->resArray as $item => $value) {
247 $elementList[$item] = $value;
256if (!empty($user->socid)) {
261$permissiontodelete = 1;
269if (
GETPOST(
'cancel',
'alpha')) {
273if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
277$parameters = array();
278$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
283if (empty($reshook)) {
285 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
288 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
291 $search_type_template =
'';
293 $search_fk_user =
'';
297 $search_array_options = array();
301 if ((
GETPOST(
'actionadd',
'alpha') ||
GETPOST(
'actionmodify',
'alpha')) && $permissiontoadd) {
302 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[$id]));
303 $listfieldinsert = explode(
',', $tabfieldinsert[$id]);
304 $listfieldmodify = explode(
',', $tabfieldinsert[$id]);
305 $listfieldvalue = explode(
',', $tabfieldvalue[$id]);
309 foreach ($listfield as $f => $value) {
311 if (in_array($value, [
'joinfiles',
'defaultfortype',
'content',
'content_lines',
'module'])) {
316 if (
GETPOST(
'actionmodify',
'alpha') && $value ==
'topic') {
317 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
320 if ((!GETPOSTISSET($value) ||
GETPOST($value) ==
'' ||
GETPOST($value) ==
'-1') && $value !=
'lang' && $value !=
'fk_user' && $value !=
'position') {
322 $fieldnamekey = $listfield[$f];
324 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
325 $fieldnamekey =
'Code';
327 if ($fieldnamekey ==
'code') {
328 $fieldnamekey =
'Code';
330 if ($fieldnamekey ==
'note') {
331 $fieldnamekey =
'Note';
333 if ($fieldnamekey ==
'type_template') {
334 $fieldnamekey =
'TypeOfTemplate';
336 if ($fieldnamekey ==
'fk_user') {
337 $fieldnamekey =
'Owner';
339 if ($fieldnamekey ==
'private') {
340 $fieldnamekey =
'Private';
342 if ($fieldnamekey ==
'position') {
343 $fieldnamekey =
'Position';
345 if ($fieldnamekey ==
'topic') {
346 $fieldnamekey =
'Topic';
349 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
355 if ($ok &&
GETPOST(
'actionadd')) {
357 $sql =
"INSERT INTO ".$tabname[$id].
" (";
359 $sql .= $tabfieldinsert[$id];
360 $sql .=
", active, enabled)";
365 foreach ($listfieldinsert as $f => $value) {
366 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
"";
367 if ($value ==
'lang') {
368 $keycode =
'langcode';
370 if (empty($keycode)) {
375 if ($value ==
'entity') {
376 $_POST[$keycode] = $conf->entity;
378 if ($value ==
'fk_user' && !($_POST[$keycode] > 0)) {
379 $_POST[$keycode] =
'';
381 if ($value ==
'private' && !is_numeric($_POST[$keycode])) {
382 $_POST[$keycode] =
'0';
384 if ($value ==
'position' && !is_numeric($_POST[$keycode])) {
385 $_POST[$keycode] =
'1';
387 if ($value ==
'defaultfortype' && !is_numeric($_POST[$keycode])) {
388 $_POST[$keycode] =
'0';
395 if (
GETPOST($keycode) ==
'' && $keycode !=
'langcode') {
397 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
399 } elseif ($keycode ==
'fk_user') {
401 $sql .=
" ".((int) $user->id);
403 $sql .=
" ".((int)
GETPOST($keycode,
'int'));
405 } elseif ($keycode ==
'content') {
406 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
407 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position',
'entity'))) {
408 $sql .= (int)
GETPOST($keycode,
'int');
410 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
417 $result = $db->query($sql);
420 $_POST = array(
'id'=>$id);
422 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
423 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
432 if ($ok &&
GETPOST(
'actionmodify')) {
436 $sql =
"UPDATE ".$tabname[$id].
" SET ";
439 foreach ($listfieldmodify as $field) {
440 if ($field ==
'entity') {
443 $_POST[$keycode] = $conf->entity;
445 $keycode = $listfieldvalue[$i];
448 if ($field ==
'lang') {
449 $keycode =
'langcode';
451 if (empty($keycode)) {
456 if ($field ==
'fk_user' && !(
GETPOST(
'fk_user',
'int') > 0)) {
457 $_POST[
'fk_user'] =
'';
459 if ($field ==
'topic') {
460 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
462 if ($field ==
'joinfiles') {
463 $_POST[
'joinfiles'] =
GETPOST(
'joinfiles-'.$rowid);
465 if ($field ==
'content') {
466 $_POST[
'content'] =
GETPOST(
'content-'.$rowid,
'restricthtml');
468 if ($field ==
'content_lines') {
469 $_POST[
'content_lines'] =
GETPOST(
'content_lines-'.$rowid,
'restricthtml');
477 if (
GETPOST($keycode) ==
'' || (!in_array($keycode, array(
'langcode',
'position',
'private',
'defaultfortype')) && !
GETPOST($keycode))) {
479 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
481 } elseif ($keycode ==
'fk_user') {
483 $sql .=
" ".((int) $user->id);
485 $sql .=
" ".((int)
GETPOST($keycode,
'int'));
487 } elseif ($keycode ==
'content') {
488 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
489 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position'))) {
490 $sql .= (int)
GETPOST($keycode,
'int');
492 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
497 $sql .=
" WHERE ".$db->escape($rowidcol).
" = ".((int) $rowid);
499 $sql .=
" AND fk_user = ".((int) $user->id);
504 $resql = $db->query($sql);
514 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
517 $sql =
"DELETE from ".$tabname[$id].
" WHERE ".$rowidcol.
" = ".((int) $rowid);
519 $sql .=
" AND fk_user = ".((int) $user->id);
522 $result = $db->query($sql);
524 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
525 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
533 if ($action == $acts[0] && $permissiontoadd) {
536 $sql =
"UPDATE ".$tabname[$id].
" SET active = 1 WHERE rowid = ".((int) $rowid);
538 $result = $db->query($sql);
545 if ($action == $acts[1] && $permissiontoadd) {
548 $sql =
"UPDATE ".$tabname[$id].
" SET active = 0 WHERE rowid = ".((int) $rowid);
550 $result = $db->query($sql);
562$form =
new Form($db);
570if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
571 $title = $langs->trans(
"EMailsSetup");
573 $title = $langs->trans(
"EMailTemplates");
578$sql =
"SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, defaultfortype, content_lines, content, enabled, active";
579$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_email_templates";
580$sql .=
" WHERE entity IN (".getEntity(
'email_template').
")";
582 $sql .=
" AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id).
"))";
583 $sql .=
" AND (active = 1 OR fk_user = ".((int) $user->id).
")";
586 $sql .=
" AND (lang = '".$db->escape($langs->defaultlang).
"' OR lang IS NULL OR lang = '')";
591if ($search_type_template !=
'' && $search_type_template !=
'-1') {
597if ($search_fk_user !=
'' && $search_fk_user !=
'-1') {
607if ($sortfield ==
'country') {
608 $sortfield =
'country_code';
610$sql .= $db->order($sortfield, $sortorder);
611$sql .= $db->plimit($listlimit + 1, $offset);
617llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'');
619$arrayofselected = is_array($toselect) ? $toselect : array();
623 $param .=
'&mode='.urlencode($mode);
625if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
626 $param .=
'&contextpage='.urlencode($contextpage);
628if ($limit > 0 && $limit != $conf->liste_limit) {
629 $param .=
'&limit='.((int) $limit);
631if (!empty($search) && is_array($search)) {
632 foreach ($search as $key => $val) {
633 if (is_array($search[$key]) && count($search[$key])) {
634 foreach ($search[$key] as $skey) {
636 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
639 } elseif ($search[$key] !=
'') {
640 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
644if ($optioncss !=
'') {
645 $param .=
'&optioncss='.urlencode($optioncss);
648include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
650$parameters = array();
651$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
652$param .= $hookmanager->resPrint;
656$titlepicto =
'title_setup';
659$url = DOL_URL_ROOT.
'/admin/mails_templates.php?action=create';
660$newcardbutton =
dolGetButtonTitle($langs->trans(
'NewEMailTemplate'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
663if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
669if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
674 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
681if ($action ==
'delete') {
682 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.((int) $rowid).
'&code='.urlencode($code).
'&id='.((int) $id), $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_delete',
'', 0, 1);
686$fieldlist = explode(
',', $tabfield[$id]);
688if ($action ==
'create') {
690 $obj =
new stdClass();
691 $obj->label =
GETPOST(
'label');
693 $obj->type_template =
GETPOST(
'type_template');
694 $obj->fk_user =
GETPOST(
'fk_user',
'int');
695 $obj->private =
GETPOST(
'private',
'int');
696 $obj->position =
GETPOST(
'position');
697 $obj->topic =
GETPOST(
'topic');
698 $obj->joinfiles =
GETPOST(
'joinfiles');
699 $obj->defaultfortype =
GETPOST(
'defaultfortype') ? 1 : 0;
700 $obj->content =
GETPOST(
'content',
'restricthtml');
703 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
704 print
'<input type="hidden" name="token" value="'.newToken().
'">';
705 print
'<input type="hidden" name="action" value="add">';
706 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
708 print
'<div class="div-table-responsive-no-min">';
709 print
'<table class="noborder centpercent">';
712 print
'<tr class="liste_titre">';
713 foreach ($fieldlist as $field => $value) {
716 $valuetoshow = ucfirst($fieldlist[$field]);
717 $valuetoshow = $langs->trans($valuetoshow);
719 if ($fieldlist[$field] ==
'module') {
720 $valuetoshow =
' ';
722 if ($fieldlist[$field] ==
'fk_user') {
723 $valuetoshow = $langs->trans(
"Owner");
725 if ($fieldlist[$field] ==
'lang') {
726 $valuetoshow = (!
getDolGlobalInt(
'MAIN_MULTILANGS') ?
' ' : $langs->trans(
"Language"));
728 if ($fieldlist[$field] ==
'type') {
729 $valuetoshow = $langs->trans(
"Type");
731 if ($fieldlist[$field] ==
'position') {
734 if ($fieldlist[$field] ==
'code') {
735 $valuetoshow = $langs->trans(
"Code");
737 if ($fieldlist[$field] ==
'label') {
738 $valuetoshow = $langs->trans(
"Code");
740 if ($fieldlist[$field] ==
'type_template') {
741 $valuetoshow = $langs->trans(
"TypeOfTemplate"); $css =
"center";
743 if (in_array($fieldlist[$field], array(
'private',
'private',
'defaultfortype'))) {
747 if ($fieldlist[$field] ==
'topic') {
750 if ($fieldlist[$field] ==
'joinfiles') {
753 if ($fieldlist[$field] ==
'content') {
756 if ($fieldlist[$field] ==
'content_lines') {
759 if ($valuetoshow !=
'') {
760 print
'<th class="'.$css.
'">';
761 if (!empty($tabhelp[$id][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[$id][$value])) {
762 print
'<a href="'.$tabhelp[$id][$value].
'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
763 } elseif (!empty($tabhelp[$id][$value])) {
764 if (in_array($value, array(
'topic'))) {
765 print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2, $value);
767 print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2);
776 print
'<input type="hidden" name="id" value="'.$id.
'">';
780 $tmpaction =
'create';
782 'fieldlist' => $fieldlist,
783 'tabname' => $tabname[$id]
785 $reshook = $hookmanager->executeHooks(
'createEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
786 $error = $hookmanager->error;
787 $errors = $hookmanager->errors;
791 print
'<tr class="oddeven">';
793 if (empty($reshook)) {
794 if ($action ==
'edit') {
795 fieldList($fieldlist, $obj, $tabname[$id],
'hide');
797 fieldList($fieldlist, $obj, $tabname[$id],
'add');
801 print
'<td class="right">';
805 print
'<tr class="impair nodrag nodrop nohover"><td colspan="9" class="nobottom">';
808 $fieldsforcontent = array(
'topic',
'joinfiles',
'content');
809 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
810 $fieldsforcontent = array(
'topic',
'joinfiles',
'content',
'content_lines');
812 foreach ($fieldsforcontent as $tmpfieldlist) {
814 if ($tmpfieldlist ==
'topic') {
815 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
817 if ($tmpfieldlist ==
'joinfiles') {
818 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
820 if ($tmpfieldlist ==
'content') {
821 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
823 if ($tmpfieldlist ==
'content_lines') {
824 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
828 if ($tmpfieldlist ==
'topic') {
829 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
830 } elseif ($tmpfieldlist ==
'joinfiles') {
831 print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, false, 0, 1);
833 $okforextended =
true;
834 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
835 $okforextended =
false;
837 $doleditor =
new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
''),
'', 400,
'dolibarr_mailings',
'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
838 print $doleditor->Create(1);
847 if ($action !=
'edit') {
849 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'"> ';
850 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
861$resql = $db->query($sql);
867$num = $db->num_rows($resql);
869print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
870print
'<input type="hidden" name="token" value="'.newToken().
'">';
871print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
873print
'<div class="div-table-responsive-no-min">';
874print
'<table class="noborder centpercent">';
878$param =
'&id='.((int) $id);
880 $param .=
'&search_label='.urlencode($search_label);
882if ($search_lang > 0) {
883 $param .=
'&search_lang='.urlencode($search_lang);
885if ($search_type_template !=
'-1') {
886 $param .=
'&search_type_template='.urlencode($search_type_template);
888if ($search_fk_user > 0) {
889 $param .=
'&search_fk_user='.urlencode($search_fk_user);
892 $param .=
'&search_module='.urlencode($search_module);
895 $param .=
'&search_topic='.urlencode($search_topic);
898$paramwithsearch = $param;
900 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
903 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
906 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
910if ($num > $listlimit) {
911 print
'<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).
'">';
912 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
918print
'<tr class="liste_titre">';
921 print
'<td class="liste_titre center" width="64">';
922 $searchpicto = $form->showFilterButtons();
926foreach ($fieldlist as $field => $value) {
927 if ($value ==
'module') {
928 print
'<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).
'"></td>';
929 } elseif ($value ==
'label') {
930 print
'<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).
'"></td>';
931 } elseif ($value ==
'lang') {
932 print
'<td class="liste_titre">';
933 print $formadmin->select_language($search_lang,
'search_lang', 0,
null, 1, 0, 0,
'maxwidth100');
935 } elseif ($value ==
'fk_user') {
936 print
'<td class="liste_titre">';
937 print $form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'), null, 0, 0, 0,
'', 0,
'',
'maxwidth100', 1);
939 } elseif ($value ==
'topic') {
940 print
'<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).
'"></td>';
941 } elseif ($value ==
'type_template') {
942 print
'<td class="liste_titre center">';
943 print $form->selectarray(
'search_type_template', $elementList, $search_type_template, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth125', 1,
'', 0, 1);
945 } elseif (!in_array($value, array(
'content',
'content_lines'))) {
946 print
'<td class="liste_titre"></td>';
956 print
'<td class="liste_titre center" width="64">';
957 $searchpicto = $form->showFilterButtons();
964print
'<tr class="liste_titre">';
969foreach ($fieldlist as $field => $value) {
982 $valuetoshow = ucfirst($fieldlist[$field]);
983 $valuetoshow = $langs->trans($valuetoshow);
984 if ($fieldlist[$field] ==
'module') {
985 $css =
'tdoverflowmax100';
987 if ($fieldlist[$field] ==
'fk_user') {
988 $valuetoshow = $langs->trans(
"Owner");
990 if ($fieldlist[$field] ==
'lang') {
991 $valuetoshow = $langs->trans(
"Language");
993 if ($fieldlist[$field] ==
'type') {
994 $valuetoshow = $langs->trans(
"Type");
996 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
997 $valuetoshow = $langs->trans(
"Code");
999 if ($fieldlist[$field] ==
'type_template') {
1001 $valuetoshow = $langs->trans(
"TypeOfTemplate");
1003 if ($fieldlist[$field] ==
'private') {
1006 if ($fieldlist[$field] ==
'position') {
1010 if ($fieldlist[$field] ==
'joinfiles') {
1011 $valuetoshow = $langs->trans(
"FilesAttachedToEmail");
1015 if ($fieldlist[$field] ==
'content') {
1016 $valuetoshow = $langs->trans(
"Content"); $showfield = 0;
1018 if ($fieldlist[$field] ==
'content_lines') {
1019 $valuetoshow = $langs->trans(
"ContentForLines"); $showfield = 0;
1024 if (!empty($tabhelp[$id][$value])) {
1025 if (in_array($value, array(
'topic'))) {
1026 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2,
'tooltip'.$value, $forcenowrap);
1028 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2,
'', $forcenowrap);
1031 $sortfieldtouse = ($sortable ? $fieldlist[$field] :
'');
1032 if ($sortfieldtouse ==
'type_template') {
1033 $sortfieldtouse.=
'type_template,lang,position,label';
1035 print
getTitleFieldOfList($valuetoshow, 0, $_SERVER[
"PHP_SELF"], $sortfieldtouse, ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $css.
' ');
1039print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
1051 $obj = $db->fetch_object($resql);
1054 if ($action ==
'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1055 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1057 $tmpaction =
'edit';
1058 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1059 $reshook = $hookmanager->executeHooks(
'editEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1060 $error = $hookmanager->error; $errors = $hookmanager->errors;
1064 print
'<td class="center">';
1065 print
'<input type="hidden" name="page" value="'.$page.
'">';
1066 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1067 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1068 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1069 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1073 if (empty($reshook)) {
1074 fieldList($fieldlist, $obj, $tabname[$id],
'edit');
1078 print
'<td class="center">';
1079 print
'<input type="hidden" name="page" value="'.$page.
'">';
1080 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1081 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1082 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1083 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1088 print
'<tr class="oddeven nohover'.(in_array($tmpfieldlist, array(
'topic',
'joinfiles')) ?
' nobottom' :
'').
'" id="tr-'.$tmpfieldlist.
'-'.$rowid.
'">';
1089 print
'<td colspan="10">';
1091 $fieldsforcontent = array(
'topic',
'joinfiles',
'content');
1092 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
1093 $fieldsforcontent[] =
'content_lines';
1095 foreach ($fieldsforcontent as $tmpfieldlist) {
1098 $valuetoshow = $obj->$tmpfieldlist;
1104 if ($tmpfieldlist ==
'topic') {
1105 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1106 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'">';
1109 if ($tmpfieldlist ==
'joinfiles') {
1110 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1111 print $form->selectyesno($tmpfieldlist.
'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, false, 0, 1);
1115 if ($tmpfieldlist ==
'content') {
1116 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1117 $okforextended =
true;
1118 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
1119 $okforextended =
false;
1121 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 500,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1122 print $doleditor->Create(1);
1124 if ($tmpfieldlist ==
'content_lines') {
1126 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1127 $okforextended =
true;
1128 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
1129 $okforextended =
false;
1131 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 140,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1132 print $doleditor->Create(1);
1146 $tempmodulekey = $obj->module;
1147 if (empty($conf->$tempmodulekey) || !isModEnabled($tempmodulekey)) {
1153 $keyforobj =
'type_template';
1154 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1159 if (!
dol_eval($obj->enabled, 1, 1,
'1')) {
1167 $iserasable = 1; $canbedisabled = 1; $canbemodified = 1;
1168 if (!$user->admin && $obj->fk_user != $user->id) {
1174 $url = $_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code :
'')).
'&code='.(!empty($obj->code) ?urlencode($obj->code) :
'');
1179 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1183 print
'<td class="center nowraponall" width="64">';
1184 if ($canbemodified) {
1185 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.newToken().
'">'.
img_edit().
'</a>';
1188 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.newToken().
'">'.
img_delete().
'</a>';
1194 $tmpaction =
'view';
1195 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1196 $reshook = $hookmanager->executeHooks(
'viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1198 $error = $hookmanager->error; $errors = $hookmanager->errors;
1200 if (empty($reshook)) {
1201 foreach ($fieldlist as $field => $value) {
1202 if (in_array($fieldlist[$field], array(
'content',
'content_lines'))) {
1209 $tmpvar = $fieldlist[$field];
1210 $valuetoshow = $obj->$tmpvar;
1211 if ($value ==
'label' || $value ==
'topic') {
1212 if ($langs->trans($valuetoshow) != $valuetoshow) {
1213 $valuetoshow = $langs->trans($valuetoshow);
1217 if ($value ==
'label') {
1218 $class .=
' tdoverflowmax100';
1220 if ($value ==
'topic') {
1221 $class .=
' tdoverflowmax200 small';
1223 if ($value ==
'type_template') {
1224 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1225 $css =
"center tdoverflowmax150";
1227 if ($value ==
'lang' && $valuetoshow) {
1228 $valuetoshow = $valuetoshow.
' - '.$langs->trans(
"Language_".$valuetoshow);
1229 $class .=
' tdoverflowmax100';
1231 if ($value ==
'fk_user') {
1232 if ($valuetoshow > 0) {
1233 $fuser =
new User($db);
1234 $fuser->fetch($valuetoshow);
1235 $valuetoshow = $fuser->getNomUrl(1);
1236 $class .=
' tdoverflowmax100';
1239 if ($value ==
'private') {
1242 $valuetoshow =
yn($valuetoshow);
1247 if ($value ==
'position') {
1250 if (in_array($value, array(
'joinfiles',
'defaultfortype'))) {
1254 $valuetoshow =
'<input type="checkbox" checked="checked" disabled>';
1265 print
'<!-- '.$fieldlist[$field].
' -->';
1266 print
'<td class="'.$class.
'"';
1267 if (in_array($value, array(
'code',
'label',
'topic'))) {
1268 print
' title="'.dol_escape_htmltag($valuetoshow).
'"';
1278 print
'<td class="center nowrap">';
1279 if ($canbedisabled) {
1280 print
'<a class="reposition" href="'.$url.
'&action='.$acts[$obj->active].
'&token='.newToken().
'">'.$actl[$obj->active].
'</a>';
1282 print
'<span class="opacitymedium">'.$actl[$obj->active].
'</span>';
1288 print
'<td class="center nowraponall" width="64">';
1289 if ($canbemodified) {
1290 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.newToken().
'">'.
img_edit().
'</a>';
1293 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.newToken().
'">'.
img_delete().
'</a>';
1308if ($nbqualified == 0) {
1310 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1319if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1338function fieldList($fieldlist, $obj =
'', $tabname =
'', $context =
'')
1340 global $langs, $user, $db;
1342 global $elementList;
1346 foreach ($fieldlist as $field => $value) {
1348 if ($value ==
'module') {
1350 } elseif ($value ==
'fk_user') {
1353 print $form->select_dolusers(empty($obj->$value) ?
'' : $obj->$value,
'fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'),
null, 0, 0, 0,
'', 0,
'',
'minwidth75 maxwidth100');
1355 if ($context ==
'add') {
1356 print $user->getNomUrl(1);
1357 $forcedvalue = $user->id;
1359 if ($obj && !empty($obj->$value) && $obj->$value > 0) {
1360 $fuser =
new User($db);
1361 $fuser->fetch($obj->$value);
1362 print $fuser->getNomUrl(1);
1363 $forcedvalue = $fuser->id;
1365 $forcedvalue = $obj->$value;
1369 print
'<input type="hidden" value="'.$forcedvalue.
'" name="'.$keyname.
'">';
1372 } elseif ($value ==
'lang') {
1375 $selectedlang = GETPOSTISSET(
'langcode') ?
GETPOST(
'langcode',
'aZ09') : $langs->defaultlang;
1376 if ($context ==
'edit') {
1377 $selectedlang = $obj->lang;
1379 print $formadmin->select_language($selectedlang,
'langcode', 0,
null, 1, 0, 0,
'maxwidth100');
1381 if (!empty($obj->lang)) {
1382 print $obj->lang.
' - '.$langs->trans(
'Language_'.$obj->lang);
1385 if ($keyname ==
'lang') {
1386 $keyname =
'langcode';
1388 print
'<input type="hidden" value="'.(empty($obj->lang) ?
'' : $obj->lang).
'" name="'.$keyname.
'">';
1391 } elseif ($value ==
'type_template') {
1393 print
'<td class="center">';
1394 if ($context ==
'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) {
1396 print
'<input type="hidden" name="type_template" value="'.$obj->type_template.
'">';
1397 print $obj->type_template;
1399 print $form->selectarray(
'type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template:
''), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth75 maxwidth125', 1,
'', 0, 1);
1402 } elseif ($context ==
'add' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1404 } elseif ($context ==
'edit' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1406 } elseif ($context ==
'hide' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1409 $size =
''; $class =
''; $classtd =
'';
1410 if ($value ==
'code') {
1411 $class =
'maxwidth100';
1413 if ($value ==
'label') {
1414 $class =
'maxwidth200';
1416 if ($value ==
'private') {
1417 $class =
'maxwidth50';
1418 $classtd =
'center';
1420 if ($value ==
'position') {
1421 $class =
'maxwidth50 center';
1422 $classtd =
'center';
1424 if ($value ==
'topic') {
1425 $class =
'quatrevingtpercent';
1427 if ($value ==
'defaultfortype') {
1428 $class =
'width25 center';
1429 $classtd =
'center';
1432 print
'<td'.($classtd ?
' class="'.$classtd.
'"' :
'').
'>';
1433 if ($value ==
'private') {
1434 if (empty($user->admin)) {
1435 print $form->selectyesno($value,
'1', 1);
1437 print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value :
''), 1);
1440 print
'<input type="text" '.$size.
'class="flat'.($class ?
' '.$class :
'').
'" value="'.(isset($obj->$value) ? $obj->$value :
'').
'" name="'. $value .
'">';
email_admin_prepare_head()
Return array head with list of tabs to view object informations.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage a WYSIWYG editor.
Class to manage Dolibarr users.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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 dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier 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='', $tabname='', $context='')
Show fields in insert/edit mode.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.