27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.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.
'/knowledgemanagement/class/knowledgerecord.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
37$langs->loadLangs(array(
"knowledgemanagement",
"other"));
39$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
40$massaction =
GETPOST(
'massaction',
'alpha');
42$confirm =
GETPOST(
'confirm',
'alpha');
43$cancel =
GETPOST(
'cancel',
'alpha');
44$toselect =
GETPOST(
'toselect',
'array');
45$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'knowledgerecordlist';
46$backtopage =
GETPOST(
'backtopage',
'alpha');
47$optioncss =
GETPOST(
'optioncss',
'aZ');
52$searchCategoryKnowledgemanagementList =
GETPOST(
'search_category_knowledgemanagement_list',
'array');
53$searchCategoryKnowledgemanagementOperator = 0;
54if (GETPOSTISSET(
'formfilteraction')) {
55 $searchCategoryKnowledgemanagementOperator =
GETPOSTINT(
'search_category_knowledgemanagement_operator');
57 $searchCategoryKnowledgemanagementOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
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->knowledgemanagement->dir_output.
'/temp/massgeneration/'.$user->id;
76$hookmanager->initHooks(array(
'knowledgerecordlist'));
79$extrafields->fetch_name_optionals_label(
$object->table_element);
82$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
87 $sortfield =
"t.".key(
$object->fields);
94$search_all =
GETPOST(
'search_all',
'alphanohtml');
96foreach (
$object->fields as $key => $val) {
98 $search[$key] =
GETPOST(
'search_'.$key,
'alpha') !=
'0' ?
GETPOST(
'search_'.$key,
'alpha') :
'';
100 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
103 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
110$fieldstosearchall = array();
111foreach (
$object->fields as $key => $val) {
112 if (!empty($val[
'searchall'])) {
113 $fieldstosearchall[
't.'.$key] = $val[
'label'];
118$arrayfields = array();
119foreach (
$object->fields as $key => $val) {
121 if (!empty($val[
'visible'])) {
122 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
123 $arrayfields[
't.'.$key] = array(
124 'label'=>$val[
'label'],
125 'checked'=>(($visible < 0) ? 0 : 1),
126 'enabled'=>(abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
127 'position'=>$val[
'position'],
128 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
133include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
138$permissiontoread = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'read');
139$permissiontoadd = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'write');
140$permissiontodelete = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'delete');
141$permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'knowledgemanagement',
'knowledgerecord_advance',
'validate')));
145if (empty($conf->knowledgemanagement->enabled)) {
149if ($user->socid > 0) {
153$result =
restrictedArea($user,
'knowledgemanagement', 0,
'',
'knowledgerecord');
162if (
GETPOST(
'cancel',
'alpha')) {
166if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
170$parameters = array();
171$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
176if (empty($reshook)) {
178 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
181 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
182 foreach (
$object->fields as $key => $val) {
184 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
185 $search[$key.
'_dtstart'] =
'';
186 $search[$key.
'_dtend'] =
'';
190 $search_array_options = array();
192 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
193 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
196 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
197 $searchCategoryKnowledgemanagementOperator = 0;
198 $searchCategoryKnowledgemanagementList = array();
202 $objectclass =
'KnowledgeRecord';
203 $objectlabel =
'KnowledgeRecord';
204 $uploaddir = $conf->knowledgemanagement->dir_output;
205 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
214$form =
new Form($db);
215$user_temp =
new User($db);
222$title = $langs->trans(
'KnowledgeRecords');
230$sql .=
$object->getFieldList(
't');
232if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
233 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
234 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
238$parameters = array();
239$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
240$sql .= $hookmanager->resPrint;
241$sql = preg_replace(
'/,\s*$/',
'', $sql);
245$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
246if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
247 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
250$parameters = array();
251$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
252$sql .= $hookmanager->resPrint;
253if (
$object->ismultientitymanaged == 1) {
254 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
256 $sql .=
" WHERE 1 = 1";
258foreach ($search as $key => $val) {
259 if (array_key_exists($key,
$object->fields)) {
260 if ($key ==
'status' && $search[$key] == -1) {
264 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
265 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
270 if ($search[$key] !=
'') {
271 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
274 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
275 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
276 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
277 if (preg_match(
'/_dtstart$/', $key)) {
278 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
280 if (preg_match(
'/_dtend$/', $key)) {
281 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
289if (!empty($searchCategoryKnowledgemanagementList)) {
290 $searchCategoryKnowledgemanagementSqlList = array();
291 $listofcategoryid =
'';
292 foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
293 if (intval($searchCategoryKnowledgemanagement) == -2) {
294 $searchCategoryKnowledgemanagementSqlList[] =
"NOT EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX.
"categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement)";
295 } elseif (intval($searchCategoryKnowledgemanagement) > 0) {
296 if (empty($searchCategoryKnowledgemanagementOperator)) {
297 $searchCategoryKnowledgemanagementSqlList[] =
" EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX.
"categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie = ".((int) $searchCategoryKnowledgemanagement).
")";
299 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryKnowledgemanagement);
303 if ($listofcategoryid) {
304 $searchCategoryKnowledgemanagementSqlList[] =
" EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX.
"categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
306 if ($searchCategoryKnowledgemanagementOperator == 1) {
307 if (!empty($searchCategoryKnowledgemanagementSqlList)) {
308 $sql .=
" AND (".implode(
' OR ', $searchCategoryKnowledgemanagementSqlList).
")";
311 if (!empty($searchCategoryKnowledgemanagementSqlList)) {
312 $sql .=
" AND (".implode(
' AND ', $searchCategoryKnowledgemanagementSqlList).
")";
318 $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;
345$nbtotalofrecords =
'';
348 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
349 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
350 $resql = $db->query($sqlforcount);
352 $objforcount = $db->fetch_object($resql);
353 $nbtotalofrecords = $objforcount->nbtotalofrecords;
358 if (($page * $limit) > $nbtotalofrecords) {
366$sql .= $db->order($sortfield, $sortorder);
368 $sql .= $db->plimit($limit + 1, $offset);
371$resql = $db->query($sql);
377$num = $db->num_rows($resql);
381if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
382 $obj = $db->fetch_object($resql);
384 header(
"Location: ".
dol_buildpath(
'/knowledgemanagement/knowledgerecord_card.php', 1).
'?id='.$id);
392llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-knowledgemanagement page-list bodyforlist');
395$arrayofselected = is_array($toselect) ? $toselect : array();
399 $param .=
'&mode='.urlencode($mode);
401if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
402 $param .=
'&contextpage='.urlencode($contextpage);
404if ($limit > 0 && $limit != $conf->liste_limit) {
405 $param .=
'&limit='.((int) $limit);
407foreach ($search as $key => $val) {
408 if (is_array($search[$key])) {
409 foreach ($search[$key] as $skey) {
411 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
414 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
415 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
416 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
417 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
418 } elseif ($search[$key] !=
'') {
419 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
422if ($optioncss !=
'') {
423 $param .=
'&optioncss='.urlencode($optioncss);
426include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
428$parameters = array(
'param' => &$param);
429$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
430$param .= $hookmanager->resPrint;
433$arrayofmassactions = array(
438if ($permissiontovalidate) {
439 $arrayofmassactions[
'validate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
441if (isModEnabled(
'category') && $permissiontoadd) {
442 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
444if (!empty($permissiontodelete)) {
445 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
447if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
448 $arrayofmassactions = array();
450$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
452print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
453if ($optioncss !=
'') {
454 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
456print
'<input type="hidden" name="token" value="'.newToken().
'">';
457print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
458print
'<input type="hidden" name="action" value="list">';
459print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
460print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
461print
'<input type="hidden" name="page" value="'.$page.
'">';
462print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
463print
'<input type="hidden" name="page_y" value="">';
464print
'<input type="hidden" name="mode" value="'.$mode.
'">';
467$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
468$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
470$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/knowledgemanagement/knowledgerecord_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
472print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
475$topicmail =
"SendKnowledgeRecordRef";
476$modelmail =
"knowledgerecord";
478$trackid =
'xxxx'.$object->id;
479include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
483 foreach ($fieldstosearchall as $key => $val) {
484 $fieldstosearchall[$key] = $langs->trans($val);
485 $setupstring .= $key.
"=".$val.
";";
487 print
'<!-- Search done like if KNOWLEDGEMANAGEMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
488 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
498if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
500 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_KNOWLEDGEMANAGEMENT, $searchCategoryKnowledgemanagementList,
'minwidth300', $searchCategoryKnowledgemanagementList ? $searchCategoryKnowledgemanagementList : 0);
512$parameters = array();
513$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
514if (empty($reshook)) {
515 $moreforfilter .= $hookmanager->resPrint;
517 $moreforfilter = $hookmanager->resPrint;
520if (!empty($moreforfilter)) {
521 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
522 print $moreforfilter;
526$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
527$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
528$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
530print
'<div class="div-table-responsive">';
531print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
536print
'<tr class="liste_titre_filter">';
539 print
'<td class="liste_titre maxwidthsearch center">';
540 $searchpicto = $form->showFilterButtons(
'left');
544foreach (
$object->fields as $key => $val) {
545 $searchkey = empty($search[$key]) ?
'' : $search[$key];
546 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
547 if ($key ==
'status') {
548 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
549 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
550 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
551 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
552 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
553 } 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'])) {
554 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
556 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
557 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
558 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
559 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
560 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:')=== 0)) {
561 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
562 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
563 print
'<div class="nowrap">';
564 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
566 print
'<div class="nowrap">';
567 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
569 } elseif ($key ==
'lang') {
570 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
572 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
574 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
580include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
583$parameters = array(
'arrayfields'=>$arrayfields);
584$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
585print $hookmanager->resPrint;
588 print
'<td class="liste_titre center maxwidthsearch">';
589 $searchpicto = $form->showFilterButtons();
595$totalarray = array();
596$totalarray[
'nbfield'] = 0;
600print
'<tr class="liste_titre">';
602 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
603 $totalarray[
'nbfield']++;
605foreach (
$object->fields as $key => $val) {
606 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
607 if ($key ==
'status') {
608 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
609 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
610 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
611 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
612 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
613 } 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'])) {
614 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
616 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
617 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
618 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";
619 $totalarray[
'nbfield']++;
623include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
625$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
626$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
627print $hookmanager->resPrint;
630 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
631 $totalarray[
'nbfield']++;
636$needToFetchEachLine = 0;
637if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
638 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
639 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
640 $needToFetchEachLine++;
649$savnbfield = $totalarray[
'nbfield'];
650$totalarray = array();
651$totalarray[
'nbfield'] = 0;
652$imaxinloop = ($limit ? min($num, $limit) : $num);
653while ($i < $imaxinloop) {
654 $obj = $db->fetch_object($resql);
660 $object->setVarsFromFetchObj($obj);
662 if ($mode ==
'kanban') {
664 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
665 print
'<div class="box-flex-container kanban">';
669 if ($massactionbutton || $massaction) {
671 if (in_array(
$object->id, $arrayofselected)) {
675 print
$object->getKanbanView(
'', array(
'selected' => $selected));
676 if ($i == ($imaxinloop - 1)) {
683 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
686 print
'<td class="nowrap center">';
687 if ($massactionbutton || $massaction) {
689 if (in_array(
$object->id, $arrayofselected)) {
692 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
696 $totalarray[
'nbfield']++;
699 foreach (
$object->fields as $key => $val) {
700 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
701 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
702 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
703 } elseif ($key ==
'status') {
704 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
707 if (in_array($val[
'type'], array(
'timestamp'))) {
708 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
709 } elseif ($key ==
'ref') {
710 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
713 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
714 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
717 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
718 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
719 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric(
$object->$key)) {
723 if ($key ==
'status') {
724 print
$object->getLibStatut(5);
725 } elseif ($key ==
'rowid') {
727 } elseif ($key ==
'fk_user_creat') {
728 if (
$object->fk_user_creat > 0) {
729 if (isset($conf->cache[
'user'][
$object->fk_user_creat])) {
730 $user_temp = $conf->cache[
'user'][
$object->fk_user_creat];
732 $user_temp =
new User($db);
733 $user_temp->fetch(
$object->fk_user_creat);
734 $conf->cache[
'user'][
$object->fk_user_creat] = $user_temp;
736 print $user_temp->getNomUrl(-1);
738 } elseif ($key ==
'fk_user_modif') {
739 if (
$object->fk_user_modif > 0) {
740 if (isset($conf->cache[
'user'][
$object->fk_user_modif])) {
741 $user_temp = $conf->cache[
'user'][
$object->fk_user_modif];
743 $user_temp =
new User($db);
744 $user_temp->fetch(
$object->fk_user_modif);
745 $conf->cache[
'user'][
$object->fk_user_modif] = $user_temp;
747 print $user_temp->getNomUrl(-1);
749 } elseif ($key ==
'fk_user_valid') {
750 if (
$object->fk_user_valid > 0) {
751 if (isset($conf->cache[
'user'][
$object->fk_user_valid])) {
752 $user_temp = $conf->cache[
'user'][
$object->fk_user_valid];
754 $user_temp =
new User($db);
755 $user_temp->fetch(
$object->fk_user_valid);
756 $conf->cache[
'user'][
$object->fk_user_valid] = $user_temp;
758 print $user_temp->getNomUrl(-1);
760 } elseif ($key ==
'lang') {
761 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
764 } elseif ($key ==
'question') {
771 $totalarray[
'nbfield']++;
773 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
775 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
777 if (!isset($totalarray[
'val'])) {
778 $totalarray[
'val'] = array();
780 if (!isset($totalarray[
'val'][
't.'.$key])) {
781 $totalarray[
'val'][
't.'.$key] = 0;
783 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
788 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
790 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
791 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
792 print $hookmanager->resPrint;
795 print
'<td class="nowrap center">';
796 if ($massactionbutton || $massaction) {
798 if (in_array(
$object->id, $arrayofselected)) {
801 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
805 $totalarray[
'nbfield']++;
815include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
820 foreach ($arrayfields as $key => $val) {
821 if (!empty($val[
'checked'])) {
825 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
831$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
832$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
833print $hookmanager->resPrint;
835print
'</table>'.
"\n";
840if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
841 $hidegeneratedfilelistifempty = 1;
842 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
843 $hidegeneratedfilelistifempty = 0;
846 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
850 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
851 $urlsource .= str_replace(
'&',
'&', $param);
853 $filedir = $diroutputmassaction;
854 $genallowed = $permissiontoread;
855 $delallowed = $permissiontoadd;
857 print $formfile->showdocuments(
'massfilesarea_knowledgemanagement',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 for KnowledgeRecord.
Class to manage Dolibarr users.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
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.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
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_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
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...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
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...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.