28require
'../main.inc.php';
38include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
39include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40include_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
42include_once __DIR__.
'/class/memo.class.php';
47$langs->loadLangs(array(
"quickmemo",
"other"));
50$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
51$massaction =
GETPOST(
'massaction',
'alpha');
53$confirm =
GETPOST(
'confirm',
'alpha');
54$cancel =
GETPOST(
'cancel',
'alpha');
55$toselect =
GETPOST(
'toselect',
'array:int');
57$backtopage =
GETPOST(
'backtopage',
'alpha');
58$optioncss =
GETPOST(
'optioncss',
'aZ');
60$groupby =
GETPOST(
'groupby',
'aZ09');
67$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
68$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
70if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
74$offset = $limit * $page;
80$diroutputmassaction =
$conf->quickmemo->dir_output.
'/temp/massgeneration/'.$user->id;
81$hookmanager->initHooks(array($contextpage));
84$extrafields->fetch_name_optionals_label(
$object->table_element);
86$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
91 $sortfield =
"t.".key(
$object->fields);
98$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
100foreach (
$object->fields as $key => $val) {
101 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
102 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
104 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
111$fieldstosearchall = array();
127$arrayfields = array();
128foreach (
$object->fields as $key => $val) {
130 if (!empty($val[
'visible'])) {
131 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
132 $arrayfields[$tableprefix.
'.'.$key] = array(
133 'label' => $val[
'label'],
134 'checked' => (($visible < 0) ?
'0' :
'1'),
135 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
136 'position' => $val[
'position'],
137 'help' => isset($val[
'help']) ? $val[
'help'] :
''
143include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
145$parameters = array(
'arrayfields' => &$arrayfields);
146$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
157$permissiontoread = $user->hasRight(
'quickmemo',
'memo',
'read');
158$permissiontoadd = $user->hasRight(
'quickmemo',
'memo',
'write');
159$permissiontodelete = $user->hasRight(
'quickmemo',
'memo',
'delete');
163if ($user->socid > 0) {
173if (!$permissiontoread) {
182if (
GETPOST(
'cancel',
'alpha')) {
186if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
190$parameters = array(
'arrayfields' => &$arrayfields);
191$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
193 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
196if (empty($reshook)) {
198 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
201 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
202 foreach (
$object->fields as $key => $val) {
204 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
205 $search[$key.
'_dtstart'] =
'';
206 $search[$key.
'_dtend'] =
'';
211 $search_array_options = array();
213 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
214 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
219 $objectclass =
'Memo';
220 $objectlabel =
'Memo';
221 $uploaddir =
$conf->quickmemo->dir_output;
224 if (($massaction ==
'delete' || ($action ==
'delete' && $confirm ==
'yes')) && $permissiontodelete && !empty($toselect)) {
225 foreach ($toselect as $key => $idMemo) {
226 $tmpMemo =
new Memo($db);
227 if ($tmpMemo->fetch($idMemo) <= 0) {
228 unset($toselect[$key]);
231 $isPrivate = ($tmpMemo->status == Memo::STATUS_TPL ? $tmpMemo->private_tpl : $tmpMemo->private);
232 if ($isPrivate && $user->id != $tmpMemo->fk_user_creat) {
233 setEventMessage($langs->trans($tmpMemo->status == Memo::STATUS_TPL ?
'QuickMemoCantDeleteThisPrivateModel' :
'QuickMemoCantDeleteThisPrivateNote').
' : '.((int) $idMemo),
'errors');
234 unset($toselect[$key]);
240 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
245 if ($massaction ===
'unarchive' && $permissiontoadd) {
246 if (!empty($toselect)) {
247 $countUnarchived = 0;
248 foreach ($toselect as $idMemo) {
250 $selectdModel =
new Memo($db);
251 if ($selectdModel->fetch($idMemo) <= 0 || !$selectdModel->isInCurrentEntity()) {
252 $idMemo = (int) $idMemo;
253 setEventMessage($langs->trans(
'QuickMemoLoadMemosError').
' : '. (
int) $idMemo,
'errors');
257 if ($selectdModel->status !== Memo::STATUS_ARCHIVED) {
258 setEventMessage($langs->trans(
'QuickMemoCantChangeThisPrivateNote').
' : '. (
int) $idMemo,
'errors');
262 if ($user->id != $selectdModel->fk_user_creat && $selectdModel->private) {
263 setEventMessage($langs->trans(
'QuickMemoCantChangeThisPrivateNote').
' : '. (
int) $idMemo,
'errors');
267 if ($selectdModel->setUnArchived($user) <= 0) {
268 setEventMessage($langs->trans(
'QuickMemoUnArchiveError').
' : '. (
int) $idMemo,
'errors');
275 if ($countUnarchived > 0) {
276 setEventMessage($langs->trans($countUnarchived > 1 ?
'QuickMemoUnArchiveCount' :
'QuickMemoUnArchived', $countUnarchived));
279 setEventMessage($langs->trans(
'PleaseSelectAtLeastOneRow'),
'warnings');
290$form =
new Form($db);
294$title = $langs->trans(
"Memos");
299 'quickmemo/css/memo.css'
306$sql .=
" ".$object->getFieldList(
't');
308if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
309 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
310 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
314$parameters = array();
315$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
316$sql .= $hookmanager->resPrint;
317$sql = preg_replace(
'/,\s*$/',
'', $sql);
321$sql .=
" FROM ".$db->prefix().$object->table_element.
" as t";
323if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
324 $sql .=
" LEFT JOIN ".$db->prefix().$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
327$parameters = array();
328$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
329$sql .= $hookmanager->resPrint;
331if (!empty(
$object->ismultientitymanaged) && (
int)
$object->ismultientitymanaged == 1) {
334 $sql .=
" WHERE t.entity IN (".getEntity($entityElementKey, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
335} elseif (preg_match(
'/^\w+@\w+$/', (
string)
$object->ismultientitymanaged)) {
336 $tmparray = explode(
'@', (
string)
$object->ismultientitymanaged);
337 $sql .=
" LEFT JOIN ".$object->db->prefix().$db->sanitize($tmparray[1]).
" as pt ON t.".$db->sanitize($tmparray[0]).
" = pt.rowid";
338 $sql .=
" WHERE pt.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
340 $sql .=
" WHERE 1 = 1";
343$sql .=
' AND ('.implode(
' OR ', [
344 '( t.status = '.Memo::STATUS_ARCHIVED.
' AND t.private = 0 OR t.fk_user_creat = '.(
int) $user->id.
' )',
345 '( t.status = '.Memo::STATUS_VALIDATED.
' AND t.private = 0 OR t.fk_user_creat = '.(
int) $user->id.
' )',
346 '( t.status = '.Memo::STATUS_TPL.
' AND t.private_tpl = 0 OR t.fk_user_creat = '.(
int) $user->id.
' )',
352foreach ($search as $key => $val) {
353 if (array_key_exists($key,
$object->fields)) {
354 if ($key ==
'status' && $search[$key] == -1) {
358 if (empty(
$object->fields[$key])) {
362 $field_spec =
$object->fields[$key];
363 $mode_search = ((
$object->isInt($field_spec) ||
$object->isFloat($field_spec)) ? 1 : 0);
364 if ((strpos($field_spec[
'type'],
'integer:') === 0) || (strpos($field_spec[
'type'],
'sellist:') === 0) || !empty($field_spec[
'arrayofkeyval'])) {
365 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($field_spec[
'arrayofkeyval']) || !array_key_exists(
'0', $field_spec[
'arrayofkeyval'])))) {
370 if ($field_spec[
'type'] ===
'boolean') {
372 if ($search[$key] ==
'-1') {
376 if (empty($field_spec[
'searchmulti'])) {
377 if (!is_array($search[$key]) && $search[$key] !=
'') {
378 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
381 if (is_array($search[$key]) && !empty($search[$key])) {
382 $sql .=
natural_search(
"t.".$db->escape($key), implode(
',', $search[$key]), (($key ==
'status') ? 2 : $mode_search));
386 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
387 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
388 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
389 if (preg_match(
'/_dtstart$/', $key)) {
390 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
392 if (preg_match(
'/_dtend$/', $key)) {
393 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
400 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
423include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
425$parameters = array();
426$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
427$sql .= $hookmanager->resPrint;
464$nbtotalofrecords =
'';
467 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
468 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
470 $resql = $db->query($sqlforcount);
472 $objforcount = $db->fetch_object($resql);
473 $nbtotalofrecords = $objforcount->nbtotalofrecords;
475 dol_print_error($db);
478 if (($page * $limit) > (
int) $nbtotalofrecords) {
486$sql .= $db->order($sortfield, $sortorder);
488 $sql .= $db->plimit($limit + 1, $offset);
491$resql = $db->query($sql);
493 dol_print_error($db);
497$num = $db->num_rows($resql);
501if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
502 $obj = $db->fetch_object($resql);
504 header(
"Location: ".
dol_buildpath(
'/quickmemo/memo_card.php', 1).
'?id='.((
int) $id));
512llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-quickmemo page-list bodyforlist');
514$arrayofselected = is_array($toselect) ? $toselect : array();
518 $param .=
'&mode='.urlencode($mode);
521 $param .=
'&contextpage='.urlencode($contextpage);
523if ($limit > 0 && $limit !=
$conf->liste_limit) {
524 $param .=
'&limit='.((int) $limit);
526if ($optioncss !=
'') {
527 $param .=
'&optioncss='.urlencode($optioncss);
530 $param .=
'&groupby='.urlencode($groupby);
532foreach ($search as $key => $val) {
533 if (is_array($search[$key])) {
534 foreach ($search[$key] as $skey) {
536 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
539 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
540 $param .=
'&search_'.$key.
'month='.
GETPOSTINT(
'search_'.$key.
'month');
541 $param .=
'&search_'.$key.
'day='.
GETPOSTINT(
'search_'.$key.
'day');
542 $param .=
'&search_'.$key.
'year='.
GETPOSTINT(
'search_'.$key.
'year');
543 } elseif ($search[$key] !=
'') {
544 $param .=
'&search_'.$key.
'='.urlencode((
string) $search[$key]);
548include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
550$parameters = array(
'param' => &$param);
551$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
552$param .= $hookmanager->resPrint;
555$arrayofmassactions = array(
556 'unarchive' => $langs->trans(
"UnarchiveMemo"),
561if (!empty($permissiontodelete)) {
562 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
564if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
565 $arrayofmassactions = array();
567$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
569print
'<form method="POST" id="searchFormList" spellcheck="false" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
570if ($optioncss !=
'') {
571 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
573print
'<input type="hidden" name="token" value="'.newToken().
'">';
574print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
575print
'<input type="hidden" name="action" value="list">';
576print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
577print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
578print
'<input type="hidden" name="page" value="'.$page.
'">';
579print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
580print
'<input type="hidden" name="page_y" value="">';
581print
'<input type="hidden" name="mode" value="'.$mode.
'">';
585$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
586$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
592print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
595$topicmail =
"SendMemoRef";
597$objecttmp =
new Memo($db);
598$trackid =
'xxxx'.$object->id;
599include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
604 foreach ($fieldstosearchall as $key => $val) {
605 $fieldstosearchall[$key] = $langs->trans($val);
606 $setupstring .= $key.
"=".$val.
";";
608 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
609 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
617$parameters = array();
618$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
619if (empty($reshook)) {
620 $moreforfilter .= $hookmanager->resPrint;
622 $moreforfilter = $hookmanager->resPrint;
625 'arrayfields' => &$arrayfields,
628if (!empty($moreforfilter)) {
629 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
630 print $moreforfilter;
634$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
635$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
636$selectedfields = (($mode !=
'kanban' && $mode !=
'kanbangroupby') ? $htmlofselectarray :
'');
637$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
639print
'<div class="div-table-responsive">';
640print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
644print
'<tr class="liste_titre_filter">';
646if (
$conf->main_checkbox_left_column) {
647 print
'<td class="liste_titre center maxwidthsearch">';
648 $searchpicto = $form->showFilterButtons(
'left');
652foreach (
$object->fields as $key => $val) {
654 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
655 if ($key ==
'status') {
656 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
657 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
658 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
659 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
660 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
661 } 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'])) {
662 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
664 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
665 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
666 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
667 if (empty($val[
'searchmulti'])) {
668 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);
670 print $form->multiselectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 0, 0,
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
672 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
673 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
674 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
675 print
'<div class="nowrap">';
676 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
678 print
'<div class="nowrap">';
679 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
681 } elseif ($key ==
'lang') {
682 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
684 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
685 } elseif ($val[
'type'] ===
'boolean') {
686 print $form->selectyesno(
'search_' . $key, $search[$key] ??
'', 1,
false, 1);
688 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] :
'').
'">';
694include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
697$parameters = array(
'arrayfields' => $arrayfields);
698$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
699print $hookmanager->resPrint;
704if (!
$conf->main_checkbox_left_column) {
705 print
'<td class="liste_titre center maxwidthsearch">';
706 $searchpicto = $form->showFilterButtons();
712$totalarray = array();
713$totalarray[
'nbfield'] = 0;
717print
'<tr class="liste_titre">';
719if (
$conf->main_checkbox_left_column) {
720 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
721 $totalarray[
'nbfield']++;
723foreach (
$object->fields as $key => $val) {
724 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
725 if ($key ==
'status') {
726 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
727 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
728 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
729 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
730 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
731 } 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'])) {
732 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
734 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
735 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
736 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";
737 $totalarray[
'nbfield']++;
741include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
743$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
744$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
745print $hookmanager->resPrint;
751if (!
$conf->main_checkbox_left_column) {
752 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
753 $totalarray[
'nbfield']++;
758$needToFetchEachLine = 0;
759if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
760 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
761 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
762 $needToFetchEachLine++;
771$savnbfield = $totalarray[
'nbfield'];
772$totalarray = array();
773$totalarray[
'nbfield'] = 0;
774$imaxinloop = ($limit ? min($num, $limit) : $num);
775while ($i < $imaxinloop) {
776 $obj = $db->fetch_object($resql);
782 $object->setVarsFromFetchObj($obj);
798 if ($mode ==
'kanban' || $mode ==
'kanbangroupby') {
800 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
801 print
'<div class="box-flex-container kanban">';
805 if ($massactionbutton || $massaction) {
807 if (in_array(
$object->id, $arrayofselected)) {
812 print
$object->getKanbanView(
'', array(
'selected' => $selected));
813 if ($i == ($imaxinloop - 1)) {
820 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
823 if (
$conf->main_checkbox_left_column) {
824 print
'<td class="nowrap center">';
825 if ($massactionbutton || $massaction) {
827 if (in_array(
$object->id, $arrayofselected)) {
830 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
834 $totalarray[
'nbfield']++;
838 foreach (
$object->fields as $key => $val) {
839 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
840 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
841 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
842 } elseif ($key ==
'status') {
843 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
846 if (in_array($val[
'type'], array(
'timestamp'))) {
847 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
848 } elseif ($key ==
'ref') {
849 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
852 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'])) {
853 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
857 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
858 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
859 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
860 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
863 if ($key ==
'status') {
864 print
$object->getLibStatut(5);
865 } elseif ($key ==
'rowid') {
866 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
868 if ($val[
'type'] ==
'html') {
869 print
'<div class="small lineheightsmall twolinesmax-normallineheight">';
871 print
$object->showOutputField($val, $key, (
string)
$object->$key,
'');
872 if ($val[
'type'] ==
'html') {
878 $totalarray[
'nbfield']++;
880 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
882 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
884 if (!isset($totalarray[
'val'])) {
885 $totalarray[
'val'] = array();
887 if (!isset($totalarray[
'val'][
't.'.$key])) {
888 $totalarray[
'val'][
't.'.$key] = 0;
890 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
895 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
897 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
898 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
899 print $hookmanager->resPrint;
906 if (empty(
$conf->main_checkbox_left_column)) {
907 print
'<td class="nowrap center">';
908 if ($massactionbutton || $massaction) {
910 if (in_array(
$object->id, $arrayofselected)) {
913 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
917 $totalarray[
'nbfield']++;
928include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
933 foreach ($arrayfields as $key => $val) {
934 if (!empty($val[
'checked'])) {
938 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
944$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
945$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
946print $hookmanager->resPrint;
948print
'</table>'.
"\n";
953if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
954 $hidegeneratedfilelistifempty = 1;
955 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
956 $hidegeneratedfilelistifempty = 0;
959 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
963 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
964 $urlsource .= str_replace(
'&',
'&', $param);
966 $filedir = $diroutputmassaction;
967 $genallowed = $permissiontoread;
968 $delallowed = $permissiontoadd;
970 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $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
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:
static getEntityElementKey($element_type)
Element key to use with getEntity() for memos of an element type.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
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.