37 require
'../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47 $langsArray=array(
"errors",
"admin",
"mails",
"languages");
50 $langsArray[]=
'members';
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');
62 $mode =
GETPOST(
'mode',
'aZ09');
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');
76 $acts[0] =
"activate";
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');
88 if (empty($page) || $page == -1) {
91 $offset = $listlimit * $page;
92 $pageprev = $page - 1;
93 $pagenext = $page + 1;
95 if (empty($sortfield)) {
96 $sortfield =
'type_template, lang, position, label';
98 if (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,content";
113 if (!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,content";
120 if (!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,content";
127 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
128 $tabfieldinsert[25] .=
',content_lines';
130 $tabfieldinsert[25] .=
',entity';
138 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
140 if (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>';
165 $tabhelp[25] = array(
166 'label'=>$langs->trans(
'EnterAnyCode'),
167 'topic'=>
'<span class="small">'.$helpsubstit.
'</span>',
168 'joinfiles'=>$langs->trans(
'AttachMainDocByDefault'),
169 'content'=>
'<span class="small">'.$helpsubstit.
'</span>',
170 'content_lines'=>
'<span class="small">'.$helpsubstitforlines.
'</span>',
171 'type_template'=>$langs->trans(
"TemplateForElement"),
172 'private'=>$langs->trans(
"TemplateIsVisibleByOwnerOnly"),
173 'position'=>$langs->trans(
"PositionIntoComboList")
178 $elementList = array();
181 $elementList[
'all'] =
'-- '.dol_escape_htmltag($langs->trans(
"All")).
' --';
182 $elementList[
'none'] =
'-- '.dol_escape_htmltag($langs->trans(
"None")).
' --';
183 $elementList[
'user'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToUser'));
184 if (
isModEnabled(
'adherent') && !empty($user->rights->adherent->lire)) {
185 $elementList[
'member'] =
img_picto(
'',
'object_member',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToMember'));
187 if (
isModEnabled(
'recruitment') && !empty($user->rights->recruitment->recruitmentjobposition->read)) {
188 $elementList[
'recruitmentcandidature_send'] =
img_picto(
'',
'recruitmentcandidature',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'RecruitmentCandidatures'));
190 if (
isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
191 $elementList[
'thirdparty'] =
img_picto(
'',
'company',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToThirdparty'));
194 $elementList[
'project'] =
img_picto(
'',
'project',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToProject'));
196 if (
isModEnabled(
"propal") && !empty($user->rights->propal->lire)) {
197 $elementList[
'propal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendProposal'));
199 if (
isModEnabled(
'commande') && !empty($user->rights->commande->lire)) {
200 $elementList[
'order_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendOrder'));
202 if (
isModEnabled(
'facture') && !empty($user->rights->facture->lire)) {
203 $elementList[
'facture_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendInvoice'));
206 $elementList[
'shipping_send'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendShipment'));
209 $elementList[
'reception_send'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendReception'));
212 $elementList[
'fichinter_send'] =
img_picto(
'',
'intervention',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendIntervention'));
215 $elementList[
'supplier_proposal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierRequestForQuotation'));
217 if ((
isModEnabled(
"fournisseur") && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (
isModEnabled(
"supplier_order") && !empty($user->rights->supplier_order->lire))) {
218 $elementList[
'order_supplier_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierOrder'));
220 if ((
isModEnabled(
"fournisseur") && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (
isModEnabled(
"supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) {
221 $elementList[
'invoice_supplier_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierInvoice'));
223 if (
isModEnabled(
'contrat') && !empty($user->rights->contrat->lire)) {
224 $elementList[
'contract'] =
img_picto(
'',
'contract',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendContract'));
226 if (
isModEnabled(
'ticket') && !empty($user->rights->ticket->read)) {
227 $elementList[
'ticket_send'] =
img_picto(
'',
'ticket',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToTicket'));
229 if (
isModEnabled(
'expensereport') && !empty($user->rights->expensereport->lire)) {
230 $elementList[
'expensereport_send'] =
img_picto(
'',
'trip',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToExpenseReport'));
233 $elementList[
'actioncomm_send'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventPush'));
235 if (
isModEnabled(
'eventorganization') && !empty($user->rights->eventorganization->read)) {
236 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventOrganization'));
238 if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) {
239 $elementList[
'partnership_send'] =
img_picto(
'',
'partnership',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToPartnership'));
242 $parameters = array(
'elementList'=>$elementList);
243 $reshook = $hookmanager->executeHooks(
'emailElementlist', $parameters);
245 foreach ($hookmanager->resArray as $item => $value) {
246 $elementList[$item] = $value;
255 if (!empty($user->socid)) {
259 $permissiontoadd = 1;
260 $permissiontodelete = 1;
268 if (
GETPOST(
'cancel',
'alpha')) {
272 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
276 $parameters = array();
277 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
282 if (empty($reshook)) {
284 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
287 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
290 $search_type_template =
'';
292 $search_fk_user =
'';
296 $search_array_options = array();
300 if ((
GETPOST(
'actionadd',
'alpha') ||
GETPOST(
'actionmodify',
'alpha')) && $permissiontoadd) {
301 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[$id]));
302 $listfieldinsert = explode(
',', $tabfieldinsert[$id]);
303 $listfieldmodify = explode(
',', $tabfieldinsert[$id]);
304 $listfieldvalue = explode(
',', $tabfieldvalue[$id]);
308 foreach ($listfield as $f => $value) {
310 if ($value ==
'joinfiles') {
313 if ($value ==
'content') {
316 if ($value ==
'content_lines') {
321 if (
GETPOST(
'actionmodify',
'alpha') && $value ==
'topic') {
322 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
325 if ((!
GETPOSTISSET($value) ||
GETPOST($value) ==
'' ||
GETPOST($value) ==
'-1') && $value !=
'lang' && $value !=
'fk_user' && $value !=
'position') {
327 $fieldnamekey = $listfield[$f];
329 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
330 $fieldnamekey =
'Code';
332 if ($fieldnamekey ==
'code') {
333 $fieldnamekey =
'Code';
335 if ($fieldnamekey ==
'note') {
336 $fieldnamekey =
'Note';
338 if ($fieldnamekey ==
'type_template') {
339 $fieldnamekey =
'TypeOfTemplate';
341 if ($fieldnamekey ==
'fk_user') {
342 $fieldnamekey =
'Owner';
344 if ($fieldnamekey ==
'private') {
345 $fieldnamekey =
'Private';
347 if ($fieldnamekey ==
'position') {
348 $fieldnamekey =
'Position';
350 if ($fieldnamekey ==
'topic') {
351 $fieldnamekey =
'Topic';
354 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
360 if ($ok &&
GETPOST(
'actionadd')) {
362 $sql =
"INSERT INTO ".$tabname[$id].
" (";
364 $sql .= $tabfieldinsert[$id];
365 $sql .=
", active, enabled)";
370 foreach ($listfieldinsert as $f => $value) {
371 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
"";
372 if ($value ==
'lang') {
373 $keycode =
'langcode';
375 if (empty($keycode)) {
380 if ($value ==
'entity') {
381 $_POST[$keycode] = $conf->entity;
383 if ($value ==
'fk_user' && !($_POST[$keycode] > 0)) {
384 $_POST[$keycode] =
'';
386 if ($value ==
'private' && !is_numeric($_POST[$keycode])) {
387 $_POST[$keycode] =
'0';
389 if ($value ==
'position' && !is_numeric($_POST[$keycode])) {
390 $_POST[$keycode] =
'1';
397 if (
GETPOST($keycode) ==
'' && $keycode !=
'langcode') {
399 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
401 } elseif ($keycode ==
'fk_user') {
403 $sql .=
" ".((int) $user->id);
405 $sql .=
" ".((int)
GETPOST($keycode,
'int'));
407 } elseif ($keycode ==
'content') {
408 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
409 } elseif (in_array($keycode, array(
'joinfiles',
'private',
'position',
'entity'))) {
410 $sql .= (int)
GETPOST($keycode,
'int');
412 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
419 $result = $db->query($sql);
422 $_POST = array(
'id'=>$id);
424 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
425 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
434 if ($ok &&
GETPOST(
'actionmodify')) {
438 $sql =
"UPDATE ".$tabname[$id].
" SET ";
441 foreach ($listfieldmodify as $field) {
442 if ($field ==
'entity') {
445 $_POST[$keycode] = $conf->entity;
447 $keycode = $listfieldvalue[$i];
450 if ($field ==
'lang') {
451 $keycode =
'langcode';
453 if (empty($keycode)) {
458 if ($field ==
'fk_user' && !($_POST[
'fk_user'] > 0)) {
459 $_POST[
'fk_user'] =
'';
461 if ($field ==
'topic') {
462 $_POST[
'topic'] = $_POST[
'topic-'.$rowid];
464 if ($field ==
'joinfiles') {
465 $_POST[
'joinfiles'] = $_POST[
'joinfiles-'.$rowid];
467 if ($field ==
'content') {
468 $_POST[
'content'] = $_POST[
'content-'.$rowid];
470 if ($field ==
'content_lines') {
471 $_POST[
'content_lines'] = $_POST[
'content_lines-'.$rowid];
479 if (
GETPOST($keycode) ==
'' || ($keycode !=
'langcode' && $keycode !=
'position' && $keycode !=
'private' && !
GETPOST($keycode))) {
481 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
483 } elseif ($keycode ==
'fk_user') {
485 $sql .=
" ".((int) $user->id);
487 $sql .=
" ".((int)
GETPOST($keycode,
'int'));
489 } elseif ($keycode ==
'content') {
490 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
491 } elseif (in_array($keycode, array(
'joinfiles',
'private',
'position'))) {
492 $sql .= (int)
GETPOST($keycode,
'int');
494 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
500 $sql .=
" WHERE ".$rowidcol.
" = ".((int) $rowid);
502 $sql .=
" AND fk_user = ".((int) $user->id);
507 $resql = $db->query($sql);
517 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
520 $sql =
"DELETE from ".$tabname[$id].
" WHERE ".$rowidcol.
" = ".((int) $rowid);
522 $sql .=
" AND fk_user = ".((int) $user->id);
525 $result = $db->query($sql);
527 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
528 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
536 if ($action == $acts[0] && $permissiontoadd) {
539 $sql =
"UPDATE ".$tabname[$id].
" SET active = 1 WHERE rowid = ".((int) $rowid);
541 $result = $db->query($sql);
548 if ($action == $acts[1] && $permissiontoadd) {
551 $sql =
"UPDATE ".$tabname[$id].
" SET active = 0 WHERE rowid = ".((int) $rowid);
553 $result = $db->query($sql);
573 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
574 $title = $langs->trans(
"EMailsSetup");
576 $title = $langs->trans(
"EMailTemplates");
581 $sql =
"SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active";
582 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_email_templates";
583 $sql .=
" WHERE entity IN (".getEntity(
'email_template').
")";
585 $sql .=
" AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id).
"))";
586 $sql .=
" AND (active = 1 OR fk_user = ".((int) $user->id).
")";
589 $sql .=
" AND (lang = '".$db->escape($langs->defaultlang).
"' OR lang IS NULL OR lang = '')";
594 if ($search_type_template !=
'' && $search_type_template !=
'-1') {
600 if ($search_fk_user !=
'' && $search_fk_user !=
'-1') {
603 if ($search_module) {
610 if ($sortfield ==
'country') {
611 $sortfield =
'country_code';
613 $sql .= $db->order($sortfield, $sortorder);
614 $sql .= $db->plimit($listlimit + 1, $offset);
622 $arrayofselected = is_array($toselect) ? $toselect : array();
626 $param .=
'&mode='.urlencode($mode);
628 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
629 $param .=
'&contextpage='.urlencode($contextpage);
631 if ($limit > 0 && $limit != $conf->liste_limit) {
632 $param .=
'&limit='.urlencode($limit);
634 if (!empty($search) && is_array($search)) {
635 foreach ($search as $key => $val) {
636 if (is_array($search[$key]) && count($search[$key])) {
637 foreach ($search[$key] as $skey) {
639 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
642 } elseif ($search[$key] !=
'') {
643 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
647 if ($optioncss !=
'') {
648 $param .=
'&optioncss='.urlencode($optioncss);
651 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
653 $parameters = array();
654 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
655 $param .= $hookmanager->resPrint;
659 $titlepicto =
'title_setup';
662 $url = DOL_URL_ROOT.
'/admin/mails_templates.php?action=create';
663 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewEMailTemplate'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
666 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
672 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
677 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
684 if ($action ==
'delete') {
685 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.$rowid.
'&code='.$code.
'&id='.$id, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_delete',
'', 0, 1);
691 $fieldlist = explode(
',', $tabfield[$id]);
693 if ($action ==
'create') {
695 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
696 print
'<input type="hidden" name="token" value="'.newToken().
'">';
697 print
'<input type="hidden" name="action" value="add">';
698 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
700 print
'<div class="div-table-responsive-no-min">';
701 print
'<table class="noborder centpercent">';
704 print
'<tr class="liste_titre">';
705 foreach ($fieldlist as $field => $value) {
708 $valuetoshow = ucfirst($fieldlist[$field]);
709 $valuetoshow = $langs->trans($valuetoshow);
711 if ($fieldlist[$field] ==
'module') {
714 if ($fieldlist[$field] ==
'fk_user') {
715 $valuetoshow = $langs->trans(
"Owner");
717 if ($fieldlist[$field] ==
'lang') {
718 $valuetoshow = (!
getDolGlobalInt(
'MAIN_MULTILANGS') ?
' ' : $langs->trans(
"Language"));
720 if ($fieldlist[$field] ==
'type') {
721 $valuetoshow = $langs->trans(
"Type");
723 if ($fieldlist[$field] ==
'code') {
724 $valuetoshow = $langs->trans(
"Code");
726 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
727 $valuetoshow = $langs->trans(
"Code");
729 if ($fieldlist[$field] ==
'type_template') {
730 $valuetoshow = $langs->trans(
"TypeOfTemplate"); $align =
"center";
732 if ($fieldlist[$field] ==
'private') {
735 if ($fieldlist[$field] ==
'position') {
739 if ($fieldlist[$field] ==
'topic') {
742 if ($fieldlist[$field] ==
'joinfiles') {
745 if ($fieldlist[$field] ==
'content') {
748 if ($fieldlist[$field] ==
'content_lines') {
751 if ($valuetoshow !=
'') {
752 print
'<th class="'.$align.
'">';
753 if (!empty($tabhelp[$id][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[$id][$value])) {
754 print
'<a href="'.$tabhelp[$id][$value].
'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
755 } elseif (!empty($tabhelp[$id][$value])) {
756 if (in_array($value, array(
'topic'))) {
757 print
$form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2, $value);
759 print
$form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2);
768 print
'<input type="hidden" name="id" value="'.$id.
'">';
772 $obj =
new stdClass();
775 foreach ($fieldlist as $key => $val) {
782 $tmpaction =
'create';
784 'fieldlist' => $fieldlist,
785 'tabname' => $tabname[$id]
787 $reshook = $hookmanager->executeHooks(
'createEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
788 $error = $hookmanager->error;
789 $errors = $hookmanager->errors;
793 print
'<tr class="oddeven">';
795 if (empty($reshook)) {
796 if ($action ==
'edit') {
797 fieldList($fieldlist, $obj, $tabname[$id],
'hide');
799 fieldList($fieldlist, $obj, $tabname[$id],
'add');
803 print
'<td class="right">';
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) {
813 print
'<tr class="impair nodrag nodrop nohover"><td colspan="8" class="nobottom">';
816 if ($tmpfieldlist ==
'topic') {
817 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
819 if ($tmpfieldlist ==
'joinfiles') {
820 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
822 if ($tmpfieldlist ==
'content') {
823 print
$form->textwithpicto($langs->trans(
"Content"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
825 if ($tmpfieldlist ==
'content_lines') {
826 print
$form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
830 if ($tmpfieldlist ==
'topic') {
831 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
832 } elseif ($tmpfieldlist ==
'joinfiles') {
833 print
$form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1,
false, 0, 1);
835 $okforextended =
true;
836 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
837 $okforextended =
false;
840 $doleditor =
new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
''),
'', 180,
'dolibarr_mailings',
'In',
false, $acceptlocallinktomedia, $okforextended, ROWS_4,
'90%');
841 print $doleditor->Create(1);
849 if ($action !=
'edit') {
851 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'"> ';
852 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
863 $resql = $db->query($sql);
869 $num = $db->num_rows(
$resql);
871 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
872 print
'<input type="hidden" name="token" value="'.newToken().
'">';
873 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
875 print
'<div class="div-table-responsive-no-min">';
876 print
'<table class="noborder centpercent">';
882 $param .=
'&search_label='.urlencode($search_label);
884 if ($search_lang > 0) {
885 $param .=
'&search_lang='.urlencode($search_lang);
887 if ($search_type_template !=
'-1') {
888 $param .=
'&search_type_template='.urlencode($search_type_template);
890 if ($search_fk_user > 0) {
891 $param .=
'&search_fk_user='.urlencode($search_fk_user);
893 if ($search_module) {
894 $param .=
'&search_module='.urlencode($search_module);
897 $param .=
'&search_topic='.urlencode($search_topic);
900 $paramwithsearch = $param;
902 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
905 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
907 if (
GETPOST(
'from',
'alpha')) {
908 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
912 if ($num > $listlimit) {
913 print
'<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).
'">';
914 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
920 print
'<tr class="liste_titre">';
922 foreach ($fieldlist as $field => $value) {
923 if ($value ==
'module') {
924 print
'<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).
'"></td>';
925 } elseif ($value ==
'label') {
926 print
'<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).
'"></td>';
927 } elseif ($value ==
'lang') {
928 print
'<td class="liste_titre">';
929 print $formadmin->select_language($search_lang,
'search_lang', 0,
null, 1, 0, 0,
'maxwidth100');
931 } elseif ($value ==
'fk_user') {
932 print
'<td class="liste_titre">';
933 print
$form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'),
null, 0, 0, 0,
'', 0,
'',
'maxwidth100', 1);
935 } elseif ($value ==
'topic') {
936 print
'<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).
'"></td>';
937 } elseif ($value ==
'type_template') {
938 print
'<td class="liste_titre center">';
939 print
$form->selectarray(
'search_type_template', $elementList, $search_type_template, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth125', 1,
'', 0, 1);
941 } elseif (!in_array($value, array(
'content',
'content_lines'))) {
942 print
'<td class="liste_titre"></td>';
946 if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
947 print
'<td class="liste_titre"></td>';
951 print
'<td class="liste_titre right" width="64">';
952 $searchpicto =
$form->showFilterButtons();
958 print
'<tr class="liste_titre">';
959 foreach ($fieldlist as $field => $value) {
972 $valuetoshow = ucfirst($fieldlist[$field]);
973 $valuetoshow = $langs->trans($valuetoshow);
974 if ($fieldlist[$field] ==
'module') {
975 $align =
'tdoverflowmax100';
977 if ($fieldlist[$field] ==
'fk_user') {
978 $valuetoshow = $langs->trans(
"Owner");
980 if ($fieldlist[$field] ==
'lang') {
981 $valuetoshow = $langs->trans(
"Language");
983 if ($fieldlist[$field] ==
'type') {
984 $valuetoshow = $langs->trans(
"Type");
986 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
987 $valuetoshow = $langs->trans(
"Code");
989 if ($fieldlist[$field] ==
'type_template') {
991 $valuetoshow = $langs->trans(
"TypeOfTemplate");
993 if ($fieldlist[$field] ==
'private') {
996 if ($fieldlist[$field] ==
'position') {
1000 if ($fieldlist[$field] ==
'joinfiles') {
1001 $valuetoshow = $langs->trans(
"FilesAttachedToEmail"); $align =
'center'; $forcenowrap = 0;
1003 if ($fieldlist[$field] ==
'content') {
1004 $valuetoshow = $langs->trans(
"Content"); $showfield = 0;
1006 if ($fieldlist[$field] ==
'content_lines') {
1007 $valuetoshow = $langs->trans(
"ContentForLines"); $showfield = 0;
1012 if (!empty($tabhelp[$id][$value])) {
1013 if (in_array($value, array(
'topic'))) {
1014 $valuetoshow =
$form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2,
'tooltip'.$value, $forcenowrap);
1016 $valuetoshow =
$form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2,
'', $forcenowrap);
1019 $sortfieldtouse = ($sortable ? $fieldlist[$field] :
'');
1020 if ($sortfieldtouse ==
'type_template') {
1021 $sortfieldtouse.=
',label';
1023 print
getTitleFieldOfList($valuetoshow, 0, $_SERVER[
"PHP_SELF"], $sortfieldtouse, ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $align.
' ');
1027 print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
1036 $obj = $db->fetch_object(
$resql);
1039 if ($action ==
'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1040 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1042 $tmpaction =
'edit';
1043 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1044 $reshook = $hookmanager->executeHooks(
'editEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1045 $error = $hookmanager->error; $errors = $hookmanager->errors;
1048 if (empty($reshook)) {
1049 fieldList($fieldlist, $obj, $tabname[$id],
'edit');
1052 print
'<td></td><td></td><td></td>';
1053 print
'<td class="center">';
1054 print
'<input type="hidden" name="page" value="'.$page.
'">';
1055 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1056 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1057 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1058 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1061 $fieldsforcontent = array(
'topic',
'joinfiles',
'content');
1062 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
1063 $fieldsforcontent = array(
'topic',
'joinfiles',
'content',
'content_lines');
1065 foreach ($fieldsforcontent as $tmpfieldlist) {
1068 $valuetoshow = $obj->$tmpfieldlist;
1074 print
'</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.
'-'.$rowid.
' ">';
1075 print
'<td colspan="9">';
1076 if ($tmpfieldlist ==
'topic') {
1077 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1078 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'">';
1080 if ($tmpfieldlist ==
'joinfiles') {
1081 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1082 print
$form->selectyesno($tmpfieldlist.
'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1,
false, 0, 1);
1085 if ($tmpfieldlist ==
'content') {
1086 print
$form->textwithpicto($langs->trans(
"Content"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1087 $okforextended =
true;
1088 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
1089 $okforextended =
false;
1091 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 500,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1092 print $doleditor->Create(1);
1094 if ($tmpfieldlist ==
'content_lines') {
1095 print
$form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1096 $okforextended =
true;
1097 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
1098 $okforextended =
false;
1100 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 140,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1101 print $doleditor->Create(1);
1115 $tempmodulekey = $obj->module;
1116 if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
1122 $keyforobj =
'type_template';
1123 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1128 if (!
dol_eval($obj->enabled, 1, 1,
'1')) {
1135 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1137 $tmpaction =
'view';
1138 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1139 $reshook = $hookmanager->executeHooks(
'viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1141 $error = $hookmanager->error; $errors = $hookmanager->errors;
1143 if (empty($reshook)) {
1144 foreach ($fieldlist as $field => $value) {
1145 if (in_array($fieldlist[$field], array(
'content',
'content_lines'))) {
1152 $tmpvar = $fieldlist[$field];
1153 $valuetoshow = $obj->$tmpvar;
1154 if ($value ==
'label' || $value ==
'topic') {
1155 if ($langs->trans($valuetoshow) != $valuetoshow) {
1156 $valuetoshow = $langs->trans($valuetoshow);
1160 if ($value ==
'label') {
1161 $class .=
' tdoverflowmax100';
1163 if ($value ==
'topic') {
1164 $class .=
' tdoverflowmax200 small';
1166 if ($value ==
'type_template') {
1167 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1170 if ($value ==
'lang' && $valuetoshow) {
1171 $valuetoshow = $valuetoshow.
' - '.$langs->trans(
"Language_".$valuetoshow);
1173 if ($value ==
'fk_user') {
1174 if ($valuetoshow > 0) {
1175 $fuser =
new User($db);
1176 $fuser->fetch($valuetoshow);
1177 $valuetoshow = $fuser->getNomUrl(1);
1180 if ($value ==
'private') {
1183 $valuetoshow =
yn($valuetoshow);
1188 if ($value ==
'position') {
1191 if ($value ==
'joinfiles') {
1194 $valuetoshow =
yn(1);
1200 $class .=
' '.$align;
1205 print
'<!-- '.$fieldlist[$field].
' -->';
1206 print
'<td class="'.$class.
'"';
1207 if (in_array($value, array(
'code',
'label',
'topic'))) {
1208 print
' title="'.dol_escape_htmltag($valuetoshow).
'"';
1218 $iserasable = 1; $canbedisabled = 1; $canbemodified = 1;
1219 if (!$user->admin && $obj->fk_user != $user->id) {
1225 $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) :
'');
1231 print
'<td class="center nowrap">';
1232 if ($canbedisabled) {
1233 print
'<a class="reposition" href="'.$url.
'&action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
1235 print
'<span class="opacitymedium">'.$actl[$obj->active].
'</span>';
1240 print
'<td class="center nowraponall" width="64">';
1241 if ($canbemodified) {
1242 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1245 print
'<a class="marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
1259 if ($nbqualified == 0) {
1261 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1270 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1289 function fieldList($fieldlist, $obj =
'', $tabname =
'', $context =
'')
1291 global $langs, $user, $db;
1293 global $elementList;
1297 foreach ($fieldlist as $field => $value) {
1298 if ($value ==
'module') {
1300 } elseif ($value ==
'fk_user') {
1303 print
$form->select_dolusers(empty($obj->$value) ?
'' : $obj->$value,
'fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'),
null, 0, 0, 0,
'', 0,
'',
'minwidth75 maxwidth100');
1305 if ($context ==
'add') {
1306 print $user->getNomUrl(1);
1307 $forcedvalue = $user->id;
1309 if ($obj && !empty($obj->$value) && $obj->$value > 0) {
1310 $fuser =
new User($db);
1311 $fuser->fetch($obj->$value);
1312 print $fuser->getNomUrl(1);
1313 $forcedvalue = $fuser->id;
1315 $forcedvalue = $obj->$value;
1319 print
'<input type="hidden" value="'.$forcedvalue.
'" name="'.$keyname.
'">';
1322 } elseif ($value ==
'lang') {
1325 $selectedlang =
GETPOSTISSET(
'langcode') ?
GETPOST(
'langcode',
'aZ09') : $langs->defaultlang;
1326 if ($context ==
'edit') {
1327 $selectedlang = $obj->lang;
1329 print $formadmin->select_language($selectedlang,
'langcode', 0,
null, 1, 0, 0,
'maxwidth100');
1331 if (!empty($obj->lang)) {
1332 print $obj->lang.
' - '.$langs->trans(
'Language_'.$obj->lang);
1335 if ($keyname ==
'lang') {
1336 $keyname =
'langcode';
1338 print
'<input type="hidden" value="'.(empty($obj->lang) ?
'' : $obj->lang).
'" name="'.$keyname.
'">';
1341 } elseif ($value ==
'type_template') {
1343 print
'<td class="center">';
1344 if ($context ==
'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) {
1346 print
'<input type="hidden" name="type_template" value="'.$obj->type_template.
'">';
1347 print $obj->type_template;
1349 print
$form->selectarray(
'type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template:
''), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth75 maxwidth125', 1,
'', 0, 1);
1352 } elseif ($context ==
'add' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1354 } elseif ($context ==
'edit' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1356 } elseif ($context ==
'hide' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1359 $size =
''; $class =
''; $classtd =
'';
1360 if ($value ==
'code') {
1361 $class =
'maxwidth100';
1363 if ($value ==
'label') {
1364 $class =
'maxwidth200';
1366 if ($value ==
'private') {
1367 $class =
'maxwidth50'; $classtd =
'center';
1369 if ($value ==
'position') {
1370 $class =
'maxwidth50 center'; $classtd =
'center';
1372 if ($value ==
'libelle') {
1373 $class =
'quatrevingtpercent';
1375 if ($value ==
'topic') {
1376 $class =
'quatrevingtpercent';
1378 if ($value ==
'sortorder' || $value ==
'sens' || $value ==
'category_type') {
1379 $size =
'size="2" ';
1382 print
'<td'.($classtd ?
' class="'.$classtd.
'"' :
'').
'>';
1383 if ($value ==
'private') {
1384 if (empty($user->admin)) {
1385 print
$form->selectyesno($value,
'1', 1);
1387 print
$form->selectyesno($value, (isset($obj->{$value}) ? $obj->{$value}:
''), 1);
1390 print
'<input type="text" '.$size.
'class="flat'.($class ?
' '.$class :
'').
'" value="'.(isset($obj->{$value}) ? $obj->{$value}:
'').
'" name="'. $value .
'">';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0, $hideselectlimit=0, $beforearrows='')
Function to show navigation arrows into lists.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
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.
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.