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";
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(
'adherent') && $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(
'project')) {
196 $elementList[
'project'] =
img_picto(
'',
'project',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToProject'));
198if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
199 $elementList[
'propal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendProposal'));
201if (isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')) {
202 $elementList[
'order_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendOrder'));
204if (isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire')) {
205 $elementList[
'facture_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendInvoice'));
207if (isModEnabled(
"expedition")) {
208 $elementList[
'shipping_send'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendShipment'));
210if (isModEnabled(
"reception")) {
211 $elementList[
'reception_send'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendReception'));
213if (isModEnabled(
'ficheinter')) {
214 $elementList[
'fichinter_send'] =
img_picto(
'',
'intervention',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendIntervention'));
216if (isModEnabled(
'supplier_proposal')) {
217 $elementList[
'supplier_proposal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierRequestForQuotation'));
219if (isModEnabled(
"supplier_order") && ($user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'read'))) {
220 $elementList[
'order_supplier_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierOrder'));
222if (isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
223 $elementList[
'invoice_supplier_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierInvoice'));
225if (isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire')) {
226 $elementList[
'contract'] =
img_picto(
'',
'contract',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendContract'));
228if (isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
229 $elementList[
'ticket_send'] =
img_picto(
'',
'ticket',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToTicket'));
231if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
232 $elementList[
'expensereport_send'] =
img_picto(
'',
'trip',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToExpenseReport'));
234if (isModEnabled(
'agenda')) {
235 $elementList[
'actioncomm_send'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventPush'));
237if (isModEnabled(
'eventorganization') && $user->hasRight(
'eventorganization',
'read')) {
238 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventOrganization'));
240if (isModEnabled(
'partnership') && $user->hasRight(
'partnership',
'read')) {
241 $elementList[
'partnership_send'] =
img_picto(
'',
'partnership',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToPartnership'));
244$parameters = array(
'elementList'=>$elementList);
245$reshook = $hookmanager->executeHooks(
'emailElementlist', $parameters);
247 foreach ($hookmanager->resArray as $item => $value) {
248 $elementList[$item] = $value;
257if (!empty($user->socid)) {
262$permissiontodelete = 1;
270if (
GETPOST(
'cancel',
'alpha')) {
274if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
278$parameters = array();
279$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
284if (empty($reshook)) {
286 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
289 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
292 $search_type_template =
'';
294 $search_fk_user =
'';
298 $search_array_options = array();
302 if ((
GETPOST(
'actionadd',
'alpha') ||
GETPOST(
'actionmodify',
'alpha')) && $permissiontoadd) {
303 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[$id]));
304 $listfieldinsert = explode(
',', $tabfieldinsert[$id]);
305 $listfieldmodify = explode(
',', $tabfieldinsert[$id]);
306 $listfieldvalue = explode(
',', $tabfieldvalue[$id]);
310 foreach ($listfield as $f => $value) {
312 if (in_array($value, [
'joinfiles',
'defaultfortype',
'content',
'content_lines',
'module'])) {
317 if (
GETPOST(
'actionmodify',
'alpha') && $value ==
'topic') {
318 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
321 if ((!GETPOSTISSET($value) ||
GETPOST($value) ==
'' ||
GETPOST($value) ==
'-1') && $value !=
'lang' && $value !=
'fk_user' && $value !=
'position') {
323 $fieldnamekey = $listfield[$f];
325 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
326 $fieldnamekey =
'Code';
328 if ($fieldnamekey ==
'code') {
329 $fieldnamekey =
'Code';
331 if ($fieldnamekey ==
'note') {
332 $fieldnamekey =
'Note';
334 if ($fieldnamekey ==
'type_template') {
335 $fieldnamekey =
'TypeOfTemplate';
337 if ($fieldnamekey ==
'fk_user') {
338 $fieldnamekey =
'Owner';
340 if ($fieldnamekey ==
'private') {
341 $fieldnamekey =
'Private';
343 if ($fieldnamekey ==
'position') {
344 $fieldnamekey =
'Position';
346 if ($fieldnamekey ==
'topic') {
347 $fieldnamekey =
'Topic';
350 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
356 if ($ok &&
GETPOST(
'actionadd')) {
358 $sql =
"INSERT INTO ".$tabname[$id].
" (";
360 $sql .= $tabfieldinsert[$id];
361 $sql .=
", active, enabled)";
366 foreach ($listfieldinsert as $f => $value) {
367 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
"";
368 if ($value ==
'lang') {
369 $keycode =
'langcode';
371 if (empty($keycode)) {
376 if ($value ==
'entity') {
377 $_POST[$keycode] = $conf->entity;
379 if ($value ==
'fk_user' && !($_POST[$keycode] > 0)) {
380 $_POST[$keycode] =
'';
382 if ($value ==
'private' && !is_numeric($_POST[$keycode])) {
383 $_POST[$keycode] =
'0';
385 if ($value ==
'position' && !is_numeric($_POST[$keycode])) {
386 $_POST[$keycode] =
'1';
388 if ($value ==
'defaultfortype' && !is_numeric($_POST[$keycode])) {
389 $_POST[$keycode] =
'0';
396 if (
GETPOST($keycode) ==
'' && $keycode !=
'langcode') {
398 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
400 } elseif ($keycode ==
'fk_user') {
402 $sql .=
" ".((int) $user->id);
404 $sql .=
" ".((int)
GETPOST($keycode,
'int'));
406 } elseif ($keycode ==
'content') {
407 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
408 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position',
'entity'))) {
409 $sql .= (int)
GETPOST($keycode,
'int');
411 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
418 $result = $db->query($sql);
421 $_POST = array(
'id'=>$id);
423 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
424 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
433 if ($ok &&
GETPOST(
'actionmodify')) {
437 $sql =
"UPDATE ".$tabname[$id].
" SET ";
440 foreach ($listfieldmodify as $field) {
441 if ($field ==
'entity') {
444 $_POST[$keycode] = $conf->entity;
446 $keycode = $listfieldvalue[$i];
449 if ($field ==
'lang') {
450 $keycode =
'langcode';
452 if (empty($keycode)) {
457 if ($field ==
'fk_user' && !(
GETPOST(
'fk_user',
'int') > 0)) {
458 $_POST[
'fk_user'] =
'';
460 if ($field ==
'topic') {
461 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
463 if ($field ==
'joinfiles') {
464 $_POST[
'joinfiles'] =
GETPOST(
'joinfiles-'.$rowid);
466 if ($field ==
'content') {
467 $_POST[
'content'] =
GETPOST(
'content-'.$rowid,
'restricthtml');
469 if ($field ==
'content_lines') {
470 $_POST[
'content_lines'] =
GETPOST(
'content_lines-'.$rowid,
'restricthtml');
478 if (
GETPOST($keycode) ==
'' || (!in_array($keycode, array(
'langcode',
'position',
'private',
'defaultfortype')) && !
GETPOST($keycode))) {
480 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
482 } elseif ($keycode ==
'fk_user') {
484 $sql .=
" ".((int) $user->id);
486 $sql .=
" ".((int)
GETPOST($keycode,
'int'));
488 } elseif ($keycode ==
'content') {
489 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
490 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position'))) {
491 $sql .= (int)
GETPOST($keycode,
'int');
493 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
498 $sql .=
" WHERE ".$db->escape($rowidcol).
" = ".((int) $rowid);
500 $sql .=
" AND fk_user = ".((int) $user->id);
505 $resql = $db->query($sql);
515 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
518 $sql =
"DELETE from ".$tabname[$id].
" WHERE ".$rowidcol.
" = ".((int) $rowid);
520 $sql .=
" AND fk_user = ".((int) $user->id);
523 $result = $db->query($sql);
525 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
526 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
534 if ($action == $acts[0] && $permissiontoadd) {
537 $sql =
"UPDATE ".$tabname[$id].
" SET active = 1 WHERE rowid = ".((int) $rowid);
539 $result = $db->query($sql);
546 if ($action == $acts[1] && $permissiontoadd) {
549 $sql =
"UPDATE ".$tabname[$id].
" SET active = 0 WHERE rowid = ".((int) $rowid);
551 $result = $db->query($sql);
563$form =
new Form($db);
571if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
572 $title = $langs->trans(
"EMailsSetup");
574 $title = $langs->trans(
"EMailTemplates");
579$sql =
"SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
580$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_email_templates";
581$sql .=
" WHERE entity IN (".getEntity(
'email_template').
")";
583 $sql .=
" AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id).
"))";
584 $sql .=
" AND (active = 1 OR fk_user = ".((int) $user->id).
")";
587 $sql .=
" AND (lang = '".$db->escape($langs->defaultlang).
"' OR lang IS NULL OR lang = '')";
592if ($search_type_template !=
'' && $search_type_template !=
'-1') {
598if ($search_fk_user !=
'' && $search_fk_user !=
'-1') {
608if ($sortfield ==
'country') {
609 $sortfield =
'country_code';
611$sql .= $db->order($sortfield, $sortorder);
612$sql .= $db->plimit($listlimit + 1, $offset);
618llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'');
620$arrayofselected = is_array($toselect) ? $toselect : array();
624 $param .=
'&mode='.urlencode($mode);
626if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
627 $param .=
'&contextpage='.urlencode($contextpage);
629if ($limit > 0 && $limit != $conf->liste_limit) {
630 $param .=
'&limit='.((int) $limit);
632if (!empty($search) && is_array($search)) {
633 foreach ($search as $key => $val) {
634 if (is_array($search[$key]) && count($search[$key])) {
635 foreach ($search[$key] as $skey) {
637 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
640 } elseif ($search[$key] !=
'') {
641 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
645if ($optioncss !=
'') {
646 $param .=
'&optioncss='.urlencode($optioncss);
649include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
651$parameters = array();
652$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
653$param .= $hookmanager->resPrint;
657$titlepicto =
'title_setup';
660$url = DOL_URL_ROOT.
'/admin/mails_templates.php?action=create';
662$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewEMailTemplate'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
665if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
671if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
676 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
683if ($action ==
'delete') {
684 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.((int) $rowid).
'&id='.((int) $id), $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_delete',
'', 0, 1);
688$fieldlist = explode(
',', $tabfield[$id]);
690if ($action ==
'create') {
693 $obj->label =
GETPOST(
'label');
695 $obj->type_template =
GETPOST(
'type_template');
696 $obj->fk_user =
GETPOST(
'fk_user',
'int');
697 $obj->private =
GETPOST(
'private',
'int');
698 $obj->position =
GETPOST(
'position');
699 $obj->topic =
GETPOST(
'topic');
700 $obj->joinfiles =
GETPOST(
'joinfiles');
701 $obj->defaultfortype =
GETPOST(
'defaultfortype') ? 1 : 0;
702 $obj->content =
GETPOST(
'content',
'restricthtml');
705 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
706 print
'<input type="hidden" name="token" value="'.newToken().
'">';
707 print
'<input type="hidden" name="action" value="add">';
708 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
710 print
'<div class="div-table-responsive-no-min">';
711 print
'<table class="noborder centpercent">';
714 print
'<tr class="liste_titre">';
715 foreach ($fieldlist as $field => $value) {
718 $valuetoshow = ucfirst($fieldlist[$field]);
719 $valuetoshow = $langs->trans($valuetoshow);
721 if ($fieldlist[$field] ==
'module') {
722 $valuetoshow =
' ';
724 if ($fieldlist[$field] ==
'fk_user') {
725 $valuetoshow = $langs->trans(
"Owner");
727 if ($fieldlist[$field] ==
'lang') {
728 $valuetoshow = (!
getDolGlobalInt(
'MAIN_MULTILANGS') ?
' ' : $langs->trans(
"Language"));
730 if ($fieldlist[$field] ==
'type') {
731 $valuetoshow = $langs->trans(
"Type");
733 if ($fieldlist[$field] ==
'position') {
736 if ($fieldlist[$field] ==
'code') {
737 $valuetoshow = $langs->trans(
"Code");
739 if ($fieldlist[$field] ==
'label') {
740 $valuetoshow = $langs->trans(
"Code");
742 if ($fieldlist[$field] ==
'type_template') {
743 $valuetoshow = $langs->trans(
"TypeOfTemplate");
746 if (in_array($fieldlist[$field], array(
'private',
'private',
'defaultfortype'))) {
750 if ($fieldlist[$field] ==
'topic') {
753 if ($fieldlist[$field] ==
'joinfiles') {
756 if ($fieldlist[$field] ==
'content') {
759 if ($fieldlist[$field] ==
'content_lines') {
762 if ($valuetoshow !=
'') {
763 print
'<th class="'.$css.
'">';
764 if (!empty($tabhelp[$id][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[$id][$value])) {
765 print
'<a href="'.$tabhelp[$id][$value].
'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
766 } elseif (!empty($tabhelp[$id][$value])) {
767 if (in_array($value, array(
'topic'))) {
768 print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2, $value);
770 print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2);
779 print
'<input type="hidden" name="id" value="'.$id.
'">';
783 $tmpaction =
'create';
785 'fieldlist' => $fieldlist,
786 'tabname' => $tabname[$id]
788 $reshook = $hookmanager->executeHooks(
'createEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
789 $error = $hookmanager->error;
790 $errors = $hookmanager->errors;
794 print
'<tr class="oddeven">';
796 if (empty($reshook)) {
797 if ($action ==
'edit') {
798 fieldList($fieldlist, $obj, $tabname[$id],
'hide');
800 fieldList($fieldlist, $obj, $tabname[$id],
'add');
804 print
'<td class="right">';
808 print
'<tr class="impair nodrag nodrop nohover"><td colspan="9" class="nobottom">';
811 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
813 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content',
'content_lines');
815 foreach ($fieldsforcontent as $tmpfieldlist) {
817 if ($tmpfieldlist ==
'topic') {
818 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
820 if ($tmpfieldlist ==
'email_from') {
821 print $form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist);
823 if ($tmpfieldlist ==
'joinfiles') {
824 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
826 if ($tmpfieldlist ==
'content') {
827 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
829 if ($tmpfieldlist ==
'content_lines') {
830 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
834 if ($tmpfieldlist ==
'topic') {
835 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
836 } elseif ($tmpfieldlist ==
'email_from') {
837 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
838 } elseif ($tmpfieldlist ==
'joinfiles') {
839 print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, false, 0, 1);
841 $okforextended =
true;
843 $okforextended =
false;
845 $doleditor =
new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
''),
'', 400,
'dolibarr_mailings',
'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
846 print $doleditor->Create(1);
855 if ($action !=
'edit') {
857 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'"> ';
858 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
869$resql = $db->query($sql);
875$num = $db->num_rows($resql);
877print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
878print
'<input type="hidden" name="token" value="'.newToken().
'">';
879print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
881print
'<div class="div-table-responsive-no-min">';
882print
'<table class="noborder centpercent">';
886$param =
'&id='.((int) $id);
888 $param .=
'&search_label='.urlencode($search_label);
890if ($search_lang > 0) {
891 $param .=
'&search_lang='.urlencode($search_lang);
893if ($search_type_template !=
'-1') {
894 $param .=
'&search_type_template='.urlencode($search_type_template);
896if ($search_fk_user > 0) {
897 $param .=
'&search_fk_user='.urlencode($search_fk_user);
900 $param .=
'&search_module='.urlencode($search_module);
903 $param .=
'&search_topic='.urlencode($search_topic);
906$paramwithsearch = $param;
908 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
911 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
914 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
918if ($num > $listlimit) {
919 print
'<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).
'">';
920 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
926print
'<tr class="liste_titre">';
929 print
'<td class="liste_titre center" width="64">';
930 $searchpicto = $form->showFilterButtons();
934foreach ($fieldlist as $field => $value) {
935 if ($value ==
'module') {
936 print
'<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).
'"></td>';
937 } elseif ($value ==
'label') {
938 print
'<td class="liste_titre"><input type="text" name="search_label" class="maxwidth75" value="'.dol_escape_htmltag($search_label).
'"></td>';
939 } elseif ($value ==
'lang') {
940 print
'<td class="liste_titre">';
941 print $formadmin->select_language($search_lang,
'search_lang', 0,
null, 1, 0, 0,
'maxwidth100');
943 } elseif ($value ==
'fk_user') {
944 print
'<td class="liste_titre">';
945 print $form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'), null, 0, 0, 0,
'', 0,
'',
'maxwidth100', 1);
947 } elseif ($value ==
'topic') {
948 print
'<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).
'"></td>';
949 } elseif ($value ==
'type_template') {
950 print
'<td class="liste_titre center">';
951 print $form->selectarray(
'search_type_template', $elementList, $search_type_template, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth125', 1,
'', 0, 1);
953 } elseif (!in_array($value, array(
'content',
'content_lines'))) {
954 print
'<td class="liste_titre"></td>';
964 print
'<td class="liste_titre center" width="64">';
965 $searchpicto = $form->showFilterButtons();
972print
'<tr class="liste_titre">';
977foreach ($fieldlist as $field => $value) {
990 $valuetoshow = ucfirst($fieldlist[$field]);
991 $valuetoshow = $langs->trans($valuetoshow);
992 if ($fieldlist[$field] ==
'module') {
993 $css =
'tdoverflowmax100';
995 if ($fieldlist[$field] ==
'fk_user') {
996 $valuetoshow = $langs->trans(
"Owner");
998 if ($fieldlist[$field] ==
'lang') {
999 $valuetoshow = $langs->trans(
"Language");
1001 if ($fieldlist[$field] ==
'type') {
1002 $valuetoshow = $langs->trans(
"Type");
1004 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
1005 $valuetoshow = $langs->trans(
"Code");
1007 if ($fieldlist[$field] ==
'type_template') {
1009 $valuetoshow = $langs->trans(
"TypeOfTemplate");
1011 if ($fieldlist[$field] ==
'private') {
1014 if ($fieldlist[$field] ==
'position') {
1018 if ($fieldlist[$field] ==
'joinfiles') {
1019 $valuetoshow = $langs->trans(
"FilesAttachedToEmail");
1023 if ($fieldlist[$field] ==
'content') {
1024 $valuetoshow = $langs->trans(
"Content");
1027 if ($fieldlist[$field] ==
'content_lines') {
1028 $valuetoshow = $langs->trans(
"ContentForLines");
1034 if (!empty($tabhelp[$id][$value])) {
1035 if (in_array($value, array(
'topic'))) {
1036 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2,
'tooltip'.$value, $forcenowrap);
1038 $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2,
'', $forcenowrap);
1041 $sortfieldtouse = ($sortable ? $fieldlist[$field] :
'');
1042 if ($sortfieldtouse ==
'type_template') {
1043 $sortfieldtouse .=
',lang,position,label';
1045 print
getTitleFieldOfList($valuetoshow, 0, $_SERVER[
"PHP_SELF"], $sortfieldtouse, ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $css.
' ');
1049print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
1061 $obj = $db->fetch_object($resql);
1064 if ($action ==
'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1065 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1067 $tmpaction =
'edit';
1068 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1069 $reshook = $hookmanager->executeHooks(
'editEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1070 $error = $hookmanager->error;
1071 $errors = $hookmanager->errors;
1075 print
'<td class="center">';
1076 print
'<input type="hidden" name="page" value="'.$page.
'">';
1077 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1078 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1079 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1080 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1084 if (empty($reshook)) {
1085 fieldList($fieldlist, $obj, $tabname[$id],
'edit');
1089 print
'<td class="center">';
1090 print
'<input type="hidden" name="page" value="'.$page.
'">';
1091 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1092 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1093 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1094 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1099 print
'<tr class="oddeven nohover" id="tr-aaa-'.$rowid.
'">';
1100 print
'<td colspan="10">';
1102 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
1104 $fieldsforcontent[] =
'content_lines';
1107 $parameters = array(
'fieldsforcontent' => &$fieldsforcontent,
'tabname' => $tabname[$id]);
1108 $hookmanager->executeHooks(
'editEmailTemplateFieldsForContent', $parameters, $obj, $tmpaction);
1110 foreach ($fieldsforcontent as $tmpfieldlist) {
1113 $valuetoshow = $obj->$tmpfieldlist;
1119 if ($tmpfieldlist ==
'topic') {
1120 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1121 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'">';
1124 if ($tmpfieldlist ==
'email_from') {
1125 print
'<strong>'.$form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1126 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'">';
1129 if ($tmpfieldlist ==
'joinfiles') {
1130 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1131 print $form->selectyesno($tmpfieldlist.
'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1, false, 0, 1);
1135 if ($tmpfieldlist ==
'content') {
1136 print $form->textwithpicto($langs->trans(
"Content"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1137 $okforextended =
true;
1139 $okforextended =
false;
1141 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 500,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1142 print $doleditor->Create(1);
1144 if ($tmpfieldlist ==
'content_lines') {
1146 print $form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1147 $okforextended =
true;
1149 $okforextended =
false;
1151 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 140,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1152 print $doleditor->Create(1);
1166 $tempmodulekey = $obj->module;
1167 if (empty($conf->$tempmodulekey) || !isModEnabled($tempmodulekey)) {
1173 $keyforobj =
'type_template';
1174 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1179 if (!
dol_eval($obj->enabled, 1, 1,
'1')) {
1190 if (!$user->admin && $obj->fk_user != $user->id) {
1196 $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) :
'');
1201 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1205 print
'<td class="center nowraponall" width="64">';
1206 if ($canbemodified) {
1207 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.newToken().
'">'.
img_edit().
'</a>';
1210 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.newToken().
'">'.
img_delete().
'</a>';
1216 $tmpaction =
'view';
1217 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1218 $reshook = $hookmanager->executeHooks(
'viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1220 $error = $hookmanager->error;
1221 $errors = $hookmanager->errors;
1223 if (empty($reshook)) {
1224 foreach ($fieldlist as $field => $value) {
1225 if (in_array($fieldlist[$field], array(
'content',
'content_lines'))) {
1232 $tmpvar = $fieldlist[$field];
1233 $valuetoshow = $obj->$tmpvar;
1234 if ($value ==
'label' || $value ==
'topic') {
1235 if ($langs->trans($valuetoshow) != $valuetoshow) {
1236 $valuetoshow = $langs->trans($valuetoshow);
1240 if ($value ==
'label') {
1241 $class .=
' tdoverflowmax200';
1243 if ($value ==
'topic') {
1244 $class .=
' tdoverflowmax200 small';
1246 if ($value ==
'type_template') {
1247 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1248 $css =
"center tdoverflowmax150";
1250 if ($value ==
'lang' && $valuetoshow) {
1251 $valuetoshow = $valuetoshow.
' - '.$langs->trans(
"Language_".$valuetoshow);
1252 $class .=
' tdoverflowmax100';
1254 if ($value ==
'fk_user') {
1255 if ($valuetoshow > 0) {
1256 $fuser =
new User($db);
1257 $fuser->fetch($valuetoshow);
1258 $valuetoshow = $fuser->getNomUrl(1);
1259 $class .=
' tdoverflowmax100';
1262 if ($value ==
'private') {
1265 $valuetoshow =
yn($valuetoshow);
1270 if ($value ==
'position') {
1273 if (in_array($value, array(
'joinfiles',
'defaultfortype'))) {
1277 $valuetoshow =
'<input type="checkbox" checked="checked" disabled>';
1288 print
'<!-- '.$fieldlist[$field].
' -->';
1289 print
'<td class="'.$class.
'"';
1290 if (in_array($value, array(
'code',
'label',
'topic'))) {
1291 print
' title="'.dol_escape_htmltag($valuetoshow).
'"';
1301 print
'<td class="center nowrap">';
1302 if ($canbedisabled) {
1303 print
'<a class="reposition" href="'.$url.
'&action='.$acts[$obj->active].
'&token='.newToken().
'">'.$actl[$obj->active].
'</a>';
1305 print
'<span class="opacitymedium">'.$actl[$obj->active].
'</span>';
1311 print
'<td class="center nowraponall" width="64">';
1312 if ($canbemodified) {
1313 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.newToken().
'">'.
img_edit().
'</a>';
1316 print
'<a class="reposition marginleftonly" href="'.$url.
'&action=delete&token='.newToken().
'">'.
img_delete().
'</a>';
1331if ($nbqualified == 0) {
1333 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1342if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1361function fieldList($fieldlist, $obj =
null, $tabname =
'', $context =
'')
1363 global $langs, $user, $db;
1365 global $elementList;
1369 foreach ($fieldlist as $field => $value) {
1371 if ($value ==
'module') {
1373 } elseif ($value ==
'fk_user') {
1376 print $form->select_dolusers(empty($obj->$value) ?
'' : $obj->$value,
'fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'),
null, 0, 0, 0,
'', 0,
'',
'minwidth75 maxwidth100');
1378 if ($context ==
'add') {
1379 print $user->getNomUrl(1);
1380 $forcedvalue = $user->id;
1382 if ($obj && !empty($obj->$value) && $obj->$value > 0) {
1383 $fuser =
new User($db);
1384 $fuser->fetch($obj->$value);
1385 print $fuser->getNomUrl(1);
1386 $forcedvalue = $fuser->id;
1388 $forcedvalue = $obj->$value;
1392 print
'<input type="hidden" value="'.$forcedvalue.
'" name="'.$keyname.
'">';
1395 } elseif ($value ==
'lang') {
1398 $selectedlang = GETPOSTISSET(
'langcode') ?
GETPOST(
'langcode',
'aZ09') : $langs->defaultlang;
1399 if ($context ==
'edit') {
1400 $selectedlang = $obj->lang;
1402 print $formadmin->select_language($selectedlang,
'langcode', 0,
null, 1, 0, 0,
'maxwidth100');
1404 if (!empty($obj->lang)) {
1405 print $obj->lang.
' - '.$langs->trans(
'Language_'.$obj->lang);
1408 if ($keyname ==
'lang') {
1409 $keyname =
'langcode';
1411 print
'<input type="hidden" value="'.(empty($obj->lang) ?
'' : $obj->lang).
'" name="'.$keyname.
'">';
1414 } elseif ($value ==
'type_template') {
1416 print
'<td class="center">';
1417 if ($context ==
'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) {
1419 print
'<input type="hidden" name="type_template" value="'.$obj->type_template.
'">';
1420 print $obj->type_template;
1422 print $form->selectarray(
'type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth75 maxwidth125', 1,
'', 0, 1);
1425 } elseif ($context ==
'add' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1427 } elseif ($context ==
'edit' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1429 } elseif ($context ==
'hide' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1435 if ($value ==
'code') {
1436 $class =
'maxwidth100';
1438 if ($value ==
'label') {
1439 $class =
'maxwidth200';
1441 if ($value ==
'private') {
1442 $class =
'maxwidth50';
1443 $classtd =
'center';
1445 if ($value ==
'position') {
1446 $class =
'maxwidth50 center';
1447 $classtd =
'center';
1449 if ($value ==
'topic') {
1450 $class =
'quatrevingtpercent';
1452 if ($value ==
'defaultfortype') {
1453 $class =
'width25 center';
1454 $classtd =
'center';
1457 print
'<td'.($classtd ?
' class="'.$classtd.
'"' :
'').
'>';
1458 if ($value ==
'private') {
1459 if (empty($user->admin)) {
1460 print $form->selectyesno($value,
'1', 1);
1462 print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value :
''), 1);
1465 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 a 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=null, $tabname='', $context='')
Show fields in insert/edit mode.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.