28require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/events.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/emailcollector/class/emailcollector.class.php';
49$langs->loadLangs(array(
"admin",
"other"));
51$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
52$massaction =
GETPOST(
'massaction',
'alpha');
54$confirm =
GETPOST(
'confirm',
'alpha');
55$cancel =
GETPOST(
'cancel',
'alpha');
56$toselect =
GETPOST(
'toselect',
'array:int');
58$backtopage =
GETPOST(
'backtopage',
'alpha');
59$optioncss =
GETPOST(
'optioncss',
'aZ');
61$groupby =
GETPOST(
'mode',
'aZ09');
67$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
68$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
70if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
74$offset = $limit * $page;
83$diroutputmassaction =
$conf->emailcollector->dir_output.
'/temp/massgeneration/'.$user->id;
84$hookmanager->initHooks(array(
'emailcollectorlist'));
87$extrafields->fetch_name_optionals_label(
$object->table_element);
89$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
101if ($user->socid > 0) {
108$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
110foreach (
$object->fields as $key => $val) {
111 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
112 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
114 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
121$fieldstosearchall = array();
122foreach (
$object->fields as $key => $val) {
123 if (!empty($val[
'searchall'])) {
124 $fieldstosearchall[
't.'.$key] = $val[
'label'];
130$arrayfields = array();
131foreach (
$object->fields as $key => $val) {
133 if (!empty($val[
'visible'])) {
134 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
135 $arrayfields[$tableprefix.
'.'.$key] = array(
136 'label' => $val[
'label'],
137 'checked' => (($visible < 0) ?
'0' :
'1'),
138 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
139 'position' => $val[
'position'],
140 'help' => isset($val[
'help']) ? $val[
'help'] :
''
146include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
148$parameters = array(
'arrayfields' => &$arrayfields);
149$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
154$permissiontoread = $user->admin;
155$permissiontoadd = $user->admin;
156$permissiontodelete = $user->admin;
172if (
GETPOST(
'cancel',
'alpha')) {
176if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
180$parameters = array(
'arrayfields' => &$arrayfields);
181$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
183 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
186if (empty($reshook)) {
189 $allowedext = trim((
string)
GETPOST(
'EMAILCOLLECTOR_ALLOWED_ATTACHMENT_EXTENSIONS',
'restricthtml'));
190 $result =
dolibarr_set_const($db,
'EMAILCOLLECTOR_ALLOWED_ATTACHMENT_EXTENSIONS', $allowedext,
'chaine', 0,
'',
$conf->entity);
192 $conf->global->EMAILCOLLECTOR_ALLOWED_ATTACHMENT_EXTENSIONS = $allowedext;
193 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
195 setEventMessages($langs->trans(
"Error"),
null,
'errors');
200 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
203 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
204 foreach (
$object->fields as $key => $val) {
206 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
207 $search[$key.
'_dtstart'] =
'';
208 $search[$key.
'_dtend'] =
'';
213 $search_array_options = array();
215 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
216 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
221 $objectclass =
'EmailCollector';
222 $objectlabel =
'EmailCollector';
223 $uploaddir =
$conf->emailcollector->dir_output;
226 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
235$form =
new Form($db);
239$help_url =
"EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector";
240$title = $langs->trans(
'EmailCollectors');
248$sql .=
" ".$object->getFieldList(
't');
250if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
251 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
252 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
256$parameters = array();
257$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
258$sql .= $hookmanager->resPrint;
259$sql = preg_replace(
'/,\s*$/',
'', $sql);
263$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
264if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
265 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
267if (
$object->ismultientitymanaged == 1) {
268 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
270 $sql .=
" WHERE 1 = 1";
272foreach ($search as $key => $val) {
273 if (array_key_exists($key,
$object->fields)) {
274 if ($key ==
'status' && $search[$key] == -1) {
277 $field_spec =
$object->fields[$key];
279 if ($field_spec ===
null) {
282 $mode_search = ((
$object->isInt($field_spec) ||
$object->isFloat($field_spec)) ? 1 : 0);
283 if ((strpos($field_spec[
'type'],
'integer:') === 0) || (strpos($field_spec[
'type'],
'sellist:') === 0) || !empty($field_spec[
'arrayofkeyval'])) {
284 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($field_spec[
'arrayofkeyval']) || !array_key_exists(
'0', $field_spec[
'arrayofkeyval'])))) {
289 if ($field_spec[
'type'] ===
'boolean') {
291 if ($search[$key] ==
'-1') {
295 if (empty($field_spec[
'searchmulti'])) {
296 if (!is_array($search[$key]) && $search[$key] !=
'') {
297 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
300 if (is_array($search[$key]) && !empty($search[$key])) {
301 $sql .=
natural_search(
"t.".$db->escape($key), implode(
',', $search[$key]), (($key ==
'status') ? 2 : $mode_search));
305 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
306 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
307 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
308 if (preg_match(
'/_dtstart$/', $key)) {
309 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
311 if (preg_match(
'/_dtend$/', $key)) {
312 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
319 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
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;
329$nbtotalofrecords =
'';
332 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
333 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
335 $resql = $db->query($sqlforcount);
337 $objforcount = $db->fetch_object($resql);
338 $nbtotalofrecords = $objforcount->nbtotalofrecords;
340 dol_print_error($db);
343 if (($page * $limit) > (
int) $nbtotalofrecords) {
351$sql .= $db->order($sortfield, $sortorder);
353 $sql .= $db->plimit($limit + 1, $offset);
356$resql = $db->query($sql);
358 dol_print_error($db);
362$num = $db->num_rows($resql);
365if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
366 $obj = $db->fetch_object($resql);
368 header(
"Location: ".DOL_URL_ROOT.
'/emailcollector/emailcollector_card.php?id='.$id);
376llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-user page-emailcollector_list');
379$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
386$head[$h][0] = DOL_URL_ROOT.
"/admin/emailcollector_list.php";
387$head[$h][1] = $langs->trans(
"Setup");
388$head[$h][2] =
'common';
395$arrayofselected = is_array($toselect) ? $toselect : array();
399 $param .=
'&mode='.urlencode($mode);
402 $param .=
'&contextpage='.urlencode($contextpage);
404if ($limit > 0 && $limit !=
$conf->liste_limit) {
405 $param .=
'&limit='.((int) $limit);
407if ($optioncss !=
'') {
408 $param .=
'&optioncss='.urlencode($optioncss);
411 $param .=
'&groupby='.urlencode($groupby);
413foreach ($search as $key => $val) {
414 if (is_array($search[$key])) {
415 foreach ($search[$key] as $skey) {
417 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
420 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
421 $param .=
'&search_'.$key.
'month='.
GETPOSTINT(
'search_'.$key.
'month');
422 $param .=
'&search_'.$key.
'day='.
GETPOSTINT(
'search_'.$key.
'day');
423 $param .=
'&search_'.$key.
'year='.
GETPOSTINT(
'search_'.$key.
'year');
424 } elseif ($search[$key] !=
'') {
425 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
429include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
431$parameters = array(
'param' => &$param);
432$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
433$param .= $hookmanager->resPrint;
436$arrayofmassactions = array(
440if (!empty($permissiontodelete)) {
441 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
443if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
444 $arrayofmassactions = array();
446$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
448print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" spellcheck="false">'.
"\n";
449if ($optioncss !=
'') {
450 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
452print
'<input type="hidden" name="token" value="'.newToken().
'">';
453print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
454print
'<input type="hidden" name="action" value="list">';
455print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
456print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
457print
'<input type="hidden" name="page" value="'.$page.
'">';
458print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
459print
'<input type="hidden" name="page_y" value="">';
460print
'<input type="hidden" name="mode" value="'.$mode.
'">';
463$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
465print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'email', 0, $newcardbutton,
'', $limit, 0, 0, 1);
472include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
479$parameters = array();
480$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
481if (empty($reshook)) {
482 $moreforfilter .= $hookmanager->resPrint;
484 $moreforfilter = $hookmanager->resPrint;
487 'arrayfields' => &$arrayfields,
490if (!empty($moreforfilter)) {
491 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
492 print $moreforfilter;
496$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
497$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
498$selectedfields = (($mode !=
'kanban' && $mode !=
'kanbangroupby') ? $htmlofselectarray :
'');
499$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
501print
'<div class="div-table-responsive">';
502print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
507print
'<tr class="liste_titre_filter">';
509if (
$conf->main_checkbox_left_column) {
510 print
'<td class="liste_titre center maxwidthsearch">';
511 $searchpicto = $form->showFilterButtons(
'left');
515foreach (
$object->fields as $key => $val) {
516 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
517 if ($key ==
'status') {
518 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
519 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
520 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
521 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
522 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
523 } 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'])) {
524 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
526 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
527 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
528 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
529 if (empty($val[
'searchmulti'])) {
530 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);
532 print $form->multiselectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] : array()), 0, 0,
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
534 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
535 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth125', 1);
536 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
537 print
'<div class="nowrap">';
538 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
540 print
'<div class="nowrap">';
541 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
543 } elseif ($key ==
'lang') {
544 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
546 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
547 } elseif ($val[
'type'] ===
'boolean') {
548 print $form->selectyesno(
'search_' . $key, $search[$key] ??
'', 1,
false, 1);
550 print
'<input type="text" class="flat maxwidth'.(in_array($val[
'type'], array(
'integer',
'price')) ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
556include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
559$parameters = array(
'arrayfields' => $arrayfields);
560$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
561print $hookmanager->resPrint;
563if (!
$conf->main_checkbox_left_column) {
564 print
'<td class="liste_titre center maxwidthsearch">';
565 $searchpicto = $form->showFilterButtons();
571$totalarray = array();
572$totalarray[
'nbfield'] = 0;
576print
'<tr class="liste_titre">';
578if (
$conf->main_checkbox_left_column) {
579 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
580 $totalarray[
'nbfield']++;
582foreach (
$object->fields as $key => $val) {
583 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
584 if ($key ==
'status') {
585 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
586 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
587 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
588 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
589 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
590 } 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'])) {
591 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
593 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
594 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
595 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";
596 $totalarray[
'nbfield']++;
600include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
602$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
603$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
604print $hookmanager->resPrint;
606if (!
$conf->main_checkbox_left_column) {
607 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
608 $totalarray[
'nbfield']++;
614$needToFetchEachLine = 0;
615if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
616 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
617 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
618 $needToFetchEachLine++;
627$savnbfield = $totalarray[
'nbfield'];
628$totalarray = array();
629$totalarray[
'nbfield'] = 0;
630$imaxinloop = ($limit ? min($num, $limit) : $num);
631while ($i < $imaxinloop) {
632 $obj = $db->fetch_object($resql);
638 $object->setVarsFromFetchObj($obj);
640 if ($mode ==
'kanban' || $mode ==
'kanbangroupby') {
642 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
643 print
'<div class="box-flex-container kanban">';
647 if ($massactionbutton || $massaction) {
649 if (in_array(
$object->id, $arrayofselected)) {
653 print
$object->getKanbanView(
'', array(
'selected' => $selected));
654 if ($i == ($imaxinloop - 1)) {
661 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
663 if (
$conf->main_checkbox_left_column) {
664 print
'<td class="nowrap center">';
665 if ($massactionbutton || $massaction) {
667 if (in_array(
$object->id, $arrayofselected)) {
670 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
674 $totalarray[
'nbfield']++;
678 foreach (
$object->fields as $key => $val) {
679 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
680 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
681 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
682 } elseif ($key ==
'status') {
683 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
686 if (in_array($val[
'type'], array(
'timestamp'))) {
687 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
688 } elseif ($key ==
'ref') {
689 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
692 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'])) {
693 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
697 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
698 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
699 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
700 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
703 if ($key ==
'status') {
704 print
$object->getLibStatut(5);
705 } elseif ($key ==
'rowid') {
706 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
708 if ($val[
'type'] ==
'html' || $key ==
'lastresult') {
709 print
'<div class="small lineheightsmall twolinesmax-normallineheight">';
711 print
$object->showOutputField($val, $key, (
string)
$object->$key,
'');
712 if ($val[
'type'] ==
'html' || $key ==
'lastresult') {
718 $totalarray[
'nbfield']++;
720 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
722 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
724 if (!isset($totalarray[
'val'])) {
725 $totalarray[
'val'] = array();
727 if (!isset($totalarray[
'val'][
't.'.$key])) {
728 $totalarray[
'val'][
't.'.$key] = 0;
730 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
735 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
737 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
738 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
739 print $hookmanager->resPrint;
741 if (!
$conf->main_checkbox_left_column) {
742 print
'<td class="nowrap center">';
743 if ($massactionbutton || $massaction) {
745 if (in_array(
$object->id, $arrayofselected)) {
748 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
752 $totalarray[
'nbfield']++;
763include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
769 foreach ($arrayfields as $key => $val) {
770 if (!empty($val[
'checked'])) {
774 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
780$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
781$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
782print $hookmanager->resPrint;
784print
'</table>'.
"\n";
790print
'<div class="div-table-responsive-no-min">';
791print
'<table class="noborder centpercent">';
793print
'<tr class="liste_titre">';
794print
'<td>'.$langs->trans(
"Parameter").
'</td>';
799print
'<tr class="oddeven"><td>';
801print $langs->trans(
"MAIN_IMAP_USE_PHPIMAP");
803print
'<td class="left">';
804if (
$conf->use_javascript_ajax) {
805 print ajax_constantonoff(
'MAIN_IMAP_USE_PHPIMAP');
807 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
808 print $form->selectarray(
"MAIN_IMAP_USE_PHPIMAP", $arrval,
getDolGlobalString(
"MAIN_IMAP_USE_PHPIMAP"));
814print
'<tr class="oddeven"><td>'.$form->textwithpicto($langs->trans(
"EmailCollectorHideMailHeaders"), $langs->transnoentitiesnoconv(
"EmailCollectorHideMailHeadersHelp")).
'</td>';
815print
'<td class="left">';
816if (
$conf->use_javascript_ajax) {
817 print ajax_constantonoff(
'MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER');
819 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
820 print $form->selectarray(
"MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER", $arrval,
getDolGlobalString(
'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND'));
826print
'<tr class="oddeven"><td>'.$form->textwithpicto($langs->trans(
"EmailCollectorIsNotAnswerUseReferences"), $langs->transnoentitiesnoconv(
"EmailCollectorIsNotAnswerUseReferencesHelp")).
'</td>';
827print
'<td class="left">';
828if (
$conf->use_javascript_ajax) {
829 print ajax_constantonoff(
'EMAILCOLLECTOR_ISNOTANSWER_USE_REFERENCES');
831 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
832 print $form->selectarray(
"EMAILCOLLECTOR_ISNOTANSWER_USE_REFERENCES", $arrval,
getDolGlobalInt(
'EMAILCOLLECTOR_ISNOTANSWER_USE_REFERENCES', 0));
838print
'<tr class="oddeven"><td>'.$form->textwithpicto($langs->trans(
"EmailCollectorAllowedAttachmentExtensions"), $langs->transnoentitiesnoconv(
"EmailCollectorAllowedAttachmentExtensionsHelp")).
'</td>';
839print
'<td class="left">';
840print
'<input class="minwidth300" type="text" name="EMAILCOLLECTOR_ALLOWED_ATTACHMENT_EXTENSIONS" value="'.dol_escape_htmltag(
getDolGlobalString(
'EMAILCOLLECTOR_ALLOWED_ATTACHMENT_EXTENSIONS')).
'">';
849print
'<div class="center">';
850print
'<button type="submit" class="button button-save" name="saveemailcollectorsettings" value="1">'.$langs->trans(
"Save").
'</button>';
855if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
856 $hidegeneratedfilelistifempty = 1;
857 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
858 $hidegeneratedfilelistifempty = 0;
861 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
865 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
866 $urlsource .= str_replace(
'&',
'&', $param);
868 $filedir = $diroutputmassaction;
869 $genallowed = $permissiontoread;
870 $delallowed = $permissiontoadd;
872 print $formfile->showdocuments(
'massfilesarea_emailcollector',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class for EmailCollector.
dol_now($mode='gmt')
Return date for now.
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...
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolDefaultContextPage($s)
Return the default context page string.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.