28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/emailsenderprofile.class.php';
44$langs->loadLangs(array(
"errors",
"admin",
"mails",
"languages"));
46$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
47$massaction =
GETPOST(
'massaction',
'alpha');
49$confirm =
GETPOST(
'confirm',
'alpha');
50$cancel =
GETPOST(
'cancel',
'alpha');
51$toselect =
GETPOST(
'toselect',
'array');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'emailsenderprofilelist';
53$backtopage =
GETPOST(
'backtopage',
'alpha');
54$optioncss =
GETPOST(
'optioncss',
'aZ');
61$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
62$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
64if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
68$offset = $limit * $page;
75$diroutputmassaction =
$conf->admin->dir_output.
'/temp/massgeneration/'.$user->id;
76$hookmanager->initHooks(array(
'emailsenderprofilelist'));
79$extrafields->fetch_name_optionals_label(
$object->table_element);
81$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
86 $sortfield =
"t.position";
93$search_all = trim(
GETPOST(
"search_all",
'alphanohtml'));
95foreach (
$object->fields as $key => $val) {
96 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
97 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
99 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
105$fieldstosearchall = array();
107foreach (
$object->fields as $key => $val) {
108 if (!empty($val[
'searchall'])) {
109 $fieldstosearchall[
't.'.$key] = $val[
'label'];
114$arrayfields = array();
115foreach (
$object->fields as $key => $val) {
117 if (!empty($val[
'visible'])) {
118 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
119 $arrayfields[
't.'.$key] = array(
120 'label' => $val[
'label'],
121 'checked' => (($visible < 0) ? 0 : 1),
122 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
123 'position' => $val[
'position'],
124 'help' => isset($val[
'help']) ? $val[
'help'] :
''
129if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label']) > 0) {
130 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
131 if (!empty($extrafields->attributes[
$object->table_element][
'list'][$key])) {
132 $arrayfields[
"ef.".$key] = array(
133 'label' => $extrafields->attributes[
$object->table_element][
'label'][$key],
134 'checked' => (($extrafields->attributes[
$object->table_element][
'list'][$key] < 0) ? 0 : 1),
135 'position' => $extrafields->attributes[
$object->table_element][
'pos'][$key],
136 'enabled' => (abs($extrafields->attributes[
$object->table_element][
'list'][$key]) != 3 && $extrafields->attributes[
$object->table_element][
'perms'][$key])
144$permissiontoread = $user->admin;
145$permissiontoadd = $user->admin;
146$permissiontodelete = $user->admin;
154if ($user->socid > 0) {
169if (
GETPOST(
'cancel',
'alpha')) {
173if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
177$parameters = array();
178$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
183if (empty($reshook)) {
185 $backurlforlist = $_SERVER[
"PHP_SELF"];
186 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
189 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
192 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
193 foreach (
$object->fields as $key => $val) {
195 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
196 $search[$key.
'_dtstart'] =
'';
197 $search[$key.
'_dtend'] =
'';
201 $search_array_options = array();
203 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
204 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
209 $objectclass =
'EmailSenderProfile';
210 $objectlabel =
'EmailSenderProfile';
211 $uploaddir =
$conf->admin->dir_output.
'/senderprofiles';
212 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
214 if ($action ==
'delete') {
215 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"c_email_senderprofile WHERE rowid = ".
GETPOSTINT(
'id');
216 $resql = $db->query($sql);
220 setEventMessages($langs->trans(
"Error").
' '.$db->lasterror(),
null,
'errors');
231$form =
new Form($db);
237$title = $langs->trans(
"EMailsSetup");
239llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-mails_senderprofile_list');
242$titlepicto =
'title_setup';
250print
'<span class="opacitymedium">'.$langs->trans(
"EMailsSenderProfileDesc").
"</span><br>\n";
256$sql .=
$object->getFieldList(
't');
258if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
259 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
260 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
264$parameters = array();
265$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
266$sql .= $hookmanager->resPrint;
267$sql = preg_replace(
'/,\s*$/',
'', $sql);
271$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
272if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
273 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
276$parameters = array();
277$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
278$sql .= $hookmanager->resPrint;
279if (
$object->ismultientitymanaged == 1) {
280 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
282 $sql .=
" WHERE 1 = 1";
284foreach ($search as $key => $val) {
285 if (array_key_exists($key,
$object->fields)) {
286 if ($key ==
'status' && $search[$key] == -1) {
290 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
291 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
296 if ($search[$key] !=
'') {
297 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
300 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
301 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
302 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
303 if (preg_match(
'/_dtstart$/', $key)) {
304 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
306 if (preg_match(
'/_dtend$/', $key)) {
307 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
314 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
317if (empty($user->admin)) {
318 $sql .=
" AND private = ".((int) $user->id);
322include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
324$parameters = array();
325$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
326$sql .= $hookmanager->resPrint;
347$nbtotalofrecords =
'';
350 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
351 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
353 $resql = $db->query($sqlforcount);
355 $objforcount = $db->fetch_object($resql);
356 $nbtotalofrecords = $objforcount->nbtotalofrecords;
361 if (($page * $limit) > $nbtotalofrecords) {
369$sql .= $db->order($sortfield, $sortorder);
371 $sql .= $db->plimit($limit + 1, $offset);
374$resql = $db->query($sql);
380$num = $db->num_rows($resql);
386$arrayofselected = is_array($toselect) ? $toselect : array();
390 $param .=
'&mode='.urlencode($mode);
392if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
393 $param .=
'&contextpage='.urlencode($contextpage);
395if ($limit > 0 && $limit !=
$conf->liste_limit) {
396 $param .=
'&limit='.((int) $limit);
398if ($optioncss !=
'') {
399 $param .=
'&optioncss='.urlencode($optioncss);
401foreach ($search as $key => $val) {
402 if (is_array($search[$key])) {
403 foreach ($search[$key] as $skey) {
405 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
408 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
409 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
410 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
411 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
412 } elseif ($search[$key] !=
'') {
413 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
417include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
419$parameters = array();
420$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
421$param .= $hookmanager->resPrint;
424$arrayofmassactions = array(
430$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
432print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
433if ($optioncss !=
'') {
434 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
436print
'<input type="hidden" name="token" value="'.newToken().
'">';
437print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
438print
'<input type="hidden" name="action" value="'.($action ==
'create' ?
'add' : ($action ==
'edit' ?
'update' :
'list')).
'">';
439print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
440print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
441print
'<input type="hidden" name="page" value="'.$page.
'">';
442print
'<input type="hidden" name="id" value="'.$id.
'">';
443print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
444print
'<input type="hidden" name="page_y" value="">';
445print
'<input type="hidden" name="mode" value="'.$mode.
'">';
449if ($action !=
'create') {
450 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create',
'', $permissiontoadd);
452 if ($action ==
'edit') {
453 print
'<table class="border centpercent tableforfield">';
454 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" name="label" class="width300" value="'.(GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alphanohtml') :
$object->label).
'"></td></tr>';
455 print
'<tr><td>'.$langs->trans(
"Email").
'</td><td>';
456 print
img_picto(
'',
'email',
'class="pictofixedwidth"');
457 print
'<input type="text" name="email" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alphanohtml') :
$object->
email).
'"></td></tr>';
458 print
'<tr><td>'.$langs->trans(
"Signature").
'</td><td>';
459 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
460 $doleditor =
new DolEditor(
'signature', (GETPOSTISSET(
'signature') ?
GETPOST(
'signature',
'restricthtml') :
$object->signature),
'', 138,
'dolibarr_notes',
'In', true, true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
461 print $doleditor->Create(1);
463 print
'<tr><td>'.$langs->trans(
"User").
'</td><td>';
464 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
465 print $form->select_dolusers((GETPOSTISSET(
'private') ?
GETPOSTINT(
'private') :
$object->private),
'private', 1, null, 0, ($user->admin ?
'' : $user->id));
467 print
'<tr><td>'.$langs->trans(
"Position").
'</td><td><input type="text" name="position" class="maxwidth50" value="'.(GETPOSTISSET(
'position') ?
GETPOSTINT(
'position') :
$object->
position).
'"></td></tr>';
468 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
469 print $form->selectarray(
'active',
$object->fields[
'active'][
'arrayofkeyval'], (GETPOSTISSET(
'active') ?
GETPOSTINT(
'active') :
$object->active), 0, 0, 0,
'', 1);
473 print $form->buttonsSaveCancel();
485 print
'<table class="border centpercent tableforfield">';
486 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" name="label" class="width300" value="'.
GETPOST(
'label',
'alphanohtml').
'" autofocus></td></tr>';
487 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Email").
'</td><td>';
488 print
img_picto(
'',
'email',
'class="pictofixedwidth"');
489 print
'<input type="text" name="email" class="width300" value="'.GETPOST(
'email',
'alphanohtml').
'"></td></tr>';
490 print
'<tr><td>'.$langs->trans(
"Signature").
'</td><td>';
491 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
492 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature'),
'', 138,
'dolibarr_notes',
'In',
true,
true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
493 print $doleditor->Create(1);
495 print
'<tr><td>'.$langs->trans(
"User").
'</td><td>';
496 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
497 print $form->select_dolusers((GETPOSTISSET(
'private') ?
GETPOSTINT(
'private') : -1),
'private', 1, null, 0, ($user->admin ?
'' : $user->id));
499 print
'<tr><td>'.$langs->trans(
"Position").
'</td><td><input type="text" name="position" class="maxwidth50" value="'.
GETPOSTINT(
'position').
'"></td></tr>';
500 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
501 print $form->selectarray(
'active',
$object->fields[
'active'][
'arrayofkeyval'],
GETPOSTINT(
'active'), 0);
505 print $form->buttonsSaveCancel();
509print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_companies', 0, $newcardbutton,
'', $limit);
512$topicmail =
"Information";
516include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
519 foreach ($fieldstosearchall as $key => $val) {
520 $fieldstosearchall[$key] = $langs->trans($val);
522 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
530$parameters = array();
531$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
532if (empty($reshook)) {
533 $moreforfilter .= $hookmanager->resPrint;
535 $moreforfilter = $hookmanager->resPrint;
538if (!empty($moreforfilter)) {
539 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
540 print $moreforfilter;
544$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
545$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
546$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
547$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
549print
'<div class="div-table-responsive">';
550print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
555print
'<tr class="liste_titre">';
558 print
'<td class="liste_titre center maxwidthsearch">';
559 $searchpicto = $form->showFilterButtons(
'left');
563foreach (
$object->fields as $key => $val) {
564 $searchkey = empty($search[$key]) ?
'' : $search[$key];
565 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
566 if ($key ==
'status') {
567 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
568 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
569 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
570 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
571 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
572 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
573 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
575 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
576 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
577 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
578 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
579 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
580 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
581 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
582 print
'<div class="nowrap">';
583 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
585 print
'<div class="nowrap">';
586 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
588 } elseif ($key ==
'lang') {
589 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
591 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
593 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
599include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
601$parameters = array(
'arrayfields' => $arrayfields);
602$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
603print $hookmanager->resPrint;
606 print
'<td class="liste_titre center maxwidthsearch">';
607 $searchpicto = $form->showFilterButtons();
613$totalarray = array();
614$totalarray[
'nbfield'] = 0;
618print
'<tr class="liste_titre">';
621 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
622 $totalarray[
'nbfield']++;
624foreach (
$object->fields as $key => $val) {
625 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
626 if ($key ==
'status') {
627 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
628 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
629 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
630 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
631 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
632 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
633 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
635 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
636 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
637 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
''), 0, (empty($val[
'helplist']) ?
'' : $val[
'helplist'])).
"\n";
638 $totalarray[
'nbfield']++;
642include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
645$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
646$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
647print $hookmanager->resPrint;
650 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
651 $totalarray[
'nbfield']++;
657$needToFetchEachLine = 0;
658if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
659 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
660 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
661 $needToFetchEachLine++;
670$savnbfield = $totalarray[
'nbfield'];
671$totalarray = array();
672$totalarray[
'nbfield'] = 0;
673$imaxinloop = ($limit ? min($num, $limit) : $num);
674while ($i < $imaxinloop) {
675 $obj = $db->fetch_object($resql);
681 $object->setVarsFromFetchObj($obj);
683 if ($mode ==
'kanban') {
685 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
686 print
'<div class="box-flex-container kanban">';
690 if ($massactionbutton || $massaction) {
692 if (in_array(
$object->id, $arrayofselected)) {
697 print
$object->getKanbanView(
'', array(
'selected' => $selected));
698 if ($i == ($imaxinloop - 1)) {
705 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
709 print
'<td class="nowrap center">';
711 $url = $_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid;
713 $url .=
'&limit='.((int) $limit);
716 $url .=
'&page='.urlencode((
string) ($page));
719 $url .=
'&sortfield='.urlencode($sortfield);
722 $url .=
'&page='.urlencode($sortorder);
724 print
'<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.
'&action=edit&token='.
newToken().
'&rowid='.$obj->rowid.
'">'.
img_edit().
'</a>';
726 print
'<a class=" marginrightonly marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a> ';
727 if ($massactionbutton || $massaction) {
729 if (in_array(
$object->id, $arrayofselected)) {
732 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
736 $totalarray[
'nbfield']++;
740 foreach (
$object->fields as $key => $val) {
741 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
742 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
743 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
744 } elseif ($key ==
'status') {
745 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
748 if (in_array($val[
'type'], array(
'timestamp'))) {
749 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
750 } elseif ($key ==
'ref') {
751 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
754 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && empty($val[
'arrayofkeyval'])) {
755 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
759 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
760 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
761 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
762 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
765 if ($key ==
'status') {
766 print
$object->getLibStatut(5);
767 } elseif ($key ==
'rowid') {
774 $totalarray[
'nbfield']++;
776 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
778 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
780 if (!isset($totalarray[
'val'])) {
781 $totalarray[
'val'] = array();
783 if (!isset($totalarray[
'val'][
't.'.$key])) {
784 $totalarray[
'val'][
't.'.$key] = 0;
786 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
791 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
793 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
794 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
795 print $hookmanager->resPrint;
799 print
'<td class="nowrap center">';
801 $url = $_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid;
803 $url .=
'&limit='.((int) $limit);
806 $url .=
'&page='.urlencode((
string) $page);
808 $url .=
'&sortfield='.urlencode((
string) $sortfield);
809 $url .=
'&page='.urlencode((
string) $sortorder);
811 print
'<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.
'&action=edit&token='.
newToken().
'&rowid='.$obj->rowid.
'">'.
img_edit().
'</a>';
813 print
'<a class=" marginrightonly marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a> ';
814 if ($massactionbutton || $massaction) {
816 if (in_array(
$object->id, $arrayofselected)) {
819 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
823 $totalarray[
'nbfield']++;
834include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
840 foreach ($arrayfields as $key => $val) {
841 if (!empty($val[
'checked'])) {
845 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
851$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
852$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
853print $hookmanager->resPrint;
855print
'</table>'.
"\n";
860if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
861 $hidegeneratedfilelistifempty = 1;
862 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
863 $hidegeneratedfilelistifempty = 0;
866 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
870 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
871 $urlsource .= str_replace(
'&',
'&', $param);
873 $filedir = $diroutputmassaction;
874 $genallowed = $permissiontoread;
875 $delallowed = $permissiontoadd;
877 print $formfile->showdocuments(
'massfilesarea_emailsenderprofile',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
email_admin_prepare_head()
Return array head with list of tabs to view object information.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Class for EmailSenderProfile.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.