27require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/knowledgemanagement/class/knowledgerecord.class.php';
38if (isModEnabled(
'categorie')) {
39 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
44$langs->loadLangs(array(
"knowledgemanagement",
"other"));
46$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
47$massaction =
GETPOST(
'massaction',
'alpha');
48$show_files =
GETPOST(
'show_files',
'int');
49$confirm =
GETPOST(
'confirm',
'alpha');
50$cancel =
GETPOST(
'cancel',
'alpha');
51$toselect =
GETPOST(
'toselect',
'array');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'knowledgerecordlist';
53$backtopage =
GETPOST(
'backtopage',
'alpha');
54$optioncss =
GETPOST(
'optioncss',
'aZ');
59$searchCategoryKnowledgemanagementList =
GETPOST(
'search_category_knowledgemanagement_list',
'array');
60$searchCategoryKnowledgemanagementOperator = 0;
61if (GETPOSTISSET(
'formfilteraction')) {
62 $searchCategoryKnowledgemanagementOperator =
GETPOST(
'search_category_knowledgemanagement_operator',
'int');
64 $searchCategoryKnowledgemanagementOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
67$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
68$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
69$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
70$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
71if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
75$offset = $limit * $page;
82$diroutputmassaction = $conf->knowledgemanagement->dir_output.
'/temp/massgeneration/'.$user->id;
83$hookmanager->initHooks(array(
'knowledgerecordlist'));
86$extrafields->fetch_name_optionals_label($object->table_element);
89$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
93 reset($object->fields);
94 $sortfield =
"t.".key($object->fields);
101$search_all =
GETPOST(
'search_all',
'alphanohtml');
103foreach ($object->fields as $key => $val) {
104 if ($key ==
"lang") {
105 $search[$key] =
GETPOST(
'search_'.$key,
'alpha') !=
'0' ?
GETPOST(
'search_'.$key,
'alpha') :
'';
107 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
110 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
111 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
112 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
117$fieldstosearchall = array();
118foreach ($object->fields as $key => $val) {
119 if (!empty($val[
'searchall'])) {
120 $fieldstosearchall[
't.'.$key] = $val[
'label'];
125$arrayfields = array();
126foreach ($object->fields as $key => $val) {
128 if (!empty($val[
'visible'])) {
129 $visible = (int)
dol_eval($val[
'visible'], 1);
130 $arrayfields[
't.'.$key] = array(
131 'label'=>$val[
'label'],
132 'checked'=>(($visible < 0) ? 0 : 1),
133 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
134 'position'=>$val[
'position'],
135 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
140include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
145$permissiontoread = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'read');
146$permissiontoadd = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'write');
147$permissiontodelete = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'delete');
150if (empty($conf->knowledgemanagement->enabled)) {
154if ($user->socid > 0) {
158$result =
restrictedArea($user,
'knowledgemanagement', 0,
'',
'knowledgerecord');
167if (
GETPOST(
'cancel',
'alpha')) {
171if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
175$parameters = array();
176$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
181if (empty($reshook)) {
183 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
186 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
187 foreach ($object->fields as $key => $val) {
189 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
190 $search[$key.
'_dtstart'] =
'';
191 $search[$key.
'_dtend'] =
'';
195 $search_array_options = array();
197 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
198 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
201 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
202 $searchCategoryKnowledgemanagementOperator = 0;
203 $searchCategoryKnowledgemanagementList = array();
207 $objectclass =
'KnowledgeRecord';
208 $objectlabel =
'KnowledgeRecord';
209 $uploaddir = $conf->knowledgemanagement->dir_output;
210 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
219$form =
new Form($db);
220$user_temp =
new User($db);
227$title = $langs->trans(
'KnowledgeRecords');
235$sql .= $object->getFieldList(
't');
237if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
238 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
239 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
243$parameters = array();
244$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
245$sql .= $hookmanager->resPrint;
246$sql = preg_replace(
'/,\s*$/',
'', $sql);
250$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
251if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
252 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
255$parameters = array();
256$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
257$sql .= $hookmanager->resPrint;
258if ($object->ismultientitymanaged == 1) {
259 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
261 $sql .=
" WHERE 1 = 1";
263foreach ($search as $key => $val) {
264 if (array_key_exists($key, $object->fields)) {
265 if ($key ==
'status' && $search[$key] == -1) {
268 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
269 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
270 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
275 if ($search[$key] !=
'') {
276 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
279 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
280 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
281 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
282 if (preg_match(
'/_dtstart$/', $key)) {
283 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
285 if (preg_match(
'/_dtend$/', $key)) {
286 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
294if (!empty($searchCategoryKnowledgemanagementList)) {
295 $searchCategoryKnowledgemanagementSqlList = array();
296 $listofcategoryid =
'';
297 foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
298 if (intval($searchCategoryKnowledgemanagement) == -2) {
299 $searchCategoryKnowledgemanagementSqlList[] =
"NOT EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX.
"categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement)";
300 } elseif (intval($searchCategoryKnowledgemanagement) > 0) {
301 if (empty($searchCategoryKnowledgemanagementOperator)) {
302 $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).
")";
304 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryKnowledgemanagement);
308 if ($listofcategoryid) {
309 $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).
"))";
311 if ($searchCategoryKnowledgemanagementOperator == 1) {
312 if (!empty($searchCategoryKnowledgemanagementSqlList)) {
313 $sql .=
" AND (".implode(
' OR ', $searchCategoryKnowledgemanagementSqlList).
")";
316 if (!empty($searchCategoryKnowledgemanagementSqlList)) {
317 $sql .=
" AND (".implode(
' AND ', $searchCategoryKnowledgemanagementSqlList).
")";
323 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
327include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
329$parameters = array();
330$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
331$sql .= $hookmanager->resPrint;
350$nbtotalofrecords =
'';
353 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
354 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
355 $resql = $db->query($sqlforcount);
357 $objforcount = $db->fetch_object($resql);
358 $nbtotalofrecords = $objforcount->nbtotalofrecords;
363 if (($page * $limit) > $nbtotalofrecords) {
371$sql .= $db->order($sortfield, $sortorder);
373 $sql .= $db->plimit($limit + 1, $offset);
376$resql = $db->query($sql);
382$num = $db->num_rows($resql);
386if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
387 $obj = $db->fetch_object($resql);
389 header(
"Location: ".
dol_buildpath(
'/knowledgemanagement/knowledgerecord_card.php', 1).
'?id='.$id);
397llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
400$arrayofselected = is_array($toselect) ? $toselect : array();
404 $param .=
'&mode='.urlencode($mode);
406if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
407 $param .=
'&contextpage='.urlencode($contextpage);
409if ($limit > 0 && $limit != $conf->liste_limit) {
410 $param .=
'&limit='.((int) $limit);
412foreach ($search as $key => $val) {
413 if (is_array($search[$key])) {
414 foreach ($search[$key] as $skey) {
416 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
419 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
420 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
421 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
422 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
423 } elseif ($search[$key] !=
'') {
424 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
427if ($optioncss !=
'') {
428 $param .=
'&optioncss='.urlencode($optioncss);
431include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
433$parameters = array(
'param' => &$param);
434$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
435$param .= $hookmanager->resPrint;
438$arrayofmassactions = array(
439 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
444if (isModEnabled(
'category') && $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'write')) {
445 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
447if (!empty($permissiontodelete)) {
448 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
450if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
451 $arrayofmassactions = array();
453$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
455print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
456if ($optioncss !=
'') {
457 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
459print
'<input type="hidden" name="token" value="'.newToken().
'">';
460print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
461print
'<input type="hidden" name="action" value="list">';
462print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
463print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
464print
'<input type="hidden" name="page" value="'.$page.
'">';
465print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
466print
'<input type="hidden" name="page_y" value="">';
467print
'<input type="hidden" name="mode" value="'.$mode.
'">';
470$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'));
471$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'));
473$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/knowledgemanagement/knowledgerecord_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
475print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
478$topicmail =
"SendKnowledgeRecordRef";
479$modelmail =
"knowledgerecord";
481$trackid =
'xxxx'.$object->id;
482include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
486 foreach ($fieldstosearchall as $key => $val) {
487 $fieldstosearchall[$key] = $langs->trans($val);
488 $setupstring .= $key.
"=".$val.
";";
490 print
'<!-- Search done like if KNOWLEDGEMANAGEMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
491 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
501if (isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
502 $moreforfilter .=
'<div class="divsearchfield">';
503 $moreforfilter .=
img_picto($langs->trans(
'Categories'),
'category',
'class="pictofixedwidth"');
504 $categoriesKnowledgeArr = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT,
'',
'', 64, 0, 1);
505 $categoriesKnowledgeArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
506 $moreforfilter .=
Form::multiselectarray(
'search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0,
'minwidth300');
507 $moreforfilter .=
' <input type="checkbox" class="valignmiddle" id="search_category_knowledgemanagement_operator" name="search_category_knowledgemanagement_operator" value="1"'.($searchCategoryKnowledgemanagementOperator == 1 ?
' checked="checked"' :
'').
'/><label class="none valignmiddle" for="search_category_knowledgemanagement_operator">'.$langs->trans(
'UseOrOperatorForCategories').
'</label>';
508 $moreforfilter .=
'</div>';
511$parameters = array();
512$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
513if (empty($reshook)) {
514 $moreforfilter .= $hookmanager->resPrint;
516 $moreforfilter = $hookmanager->resPrint;
519if (!empty($moreforfilter)) {
520 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
521 print $moreforfilter;
522 $parameters = array();
523 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
524 print $hookmanager->resPrint;
528$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
529$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
530$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
532print
'<div class="div-table-responsive">';
533print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
538print
'<tr class="liste_titre_filter">';
541 print
'<td class="liste_titre maxwidthsearch center">';
542 $searchpicto = $form->showFilterButtons(
'left');
546foreach ($object->fields as $key => $val) {
547 $searchkey = empty($search[$key]) ?
'' : $search[$key];
548 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
549 if ($key ==
'status') {
550 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
551 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
552 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
553 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
554 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
555 } 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'])) {
556 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
558 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
559 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
560 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
561 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);
562 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:')=== 0)) {
563 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
564 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
565 print
'<div class="nowrap">';
566 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
568 print
'<div class="nowrap">';
569 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
571 } elseif ($key ==
'lang') {
572 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
574 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
576 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
582include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
585$parameters = array(
'arrayfields'=>$arrayfields);
586$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
587print $hookmanager->resPrint;
590 print
'<td class="liste_titre center maxwidthsearch">';
591 $searchpicto = $form->showFilterButtons();
597$totalarray = array();
598$totalarray[
'nbfield'] = 0;
602print
'<tr class="liste_titre">';
604 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
605 $totalarray[
'nbfield']++;
607foreach ($object->fields as $key => $val) {
608 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
609 if ($key ==
'status') {
610 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
611 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
612 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
613 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
614 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
615 } 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'])) {
616 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
618 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
619 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
620 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";
621 $totalarray[
'nbfield']++;
625include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
627$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
628$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
629print $hookmanager->resPrint;
632 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
633 $totalarray[
'nbfield']++;
638$needToFetchEachLine = 0;
639if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
640 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
641 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
642 $needToFetchEachLine++;
651$savnbfield = $totalarray[
'nbfield'];
652$totalarray = array();
653$totalarray[
'nbfield'] = 0;
654$imaxinloop = ($limit ? min($num, $limit) : $num);
655while ($i < $imaxinloop) {
656 $obj = $db->fetch_object($resql);
662 $object->setVarsFromFetchObj($obj);
664 if ($mode ==
'kanban') {
666 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
667 print
'<div class="box-flex-container kanban">';
671 if ($massactionbutton || $massaction) {
673 if (in_array($object->id, $arrayofselected)) {
677 print $object->getKanbanView(
'', array(
'selected' => $selected));
678 if ($i == ($imaxinloop - 1)) {
685 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
688 print
'<td class="nowrap center">';
689 if ($massactionbutton || $massaction) {
691 if (in_array($object->id, $arrayofselected)) {
694 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
698 $totalarray[
'nbfield']++;
701 foreach ($object->fields as $key => $val) {
702 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
703 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
704 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
705 } elseif ($key ==
'status') {
706 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
709 if (in_array($val[
'type'], array(
'timestamp'))) {
710 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
711 } elseif ($key ==
'ref') {
712 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
715 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
716 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
719 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
720 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
721 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
722 print
' title="'.dol_escape_htmltag(
dol_nl2br($object->$key, 1)).
'"';
725 if ($key ==
'status') {
726 print $object->getLibStatut(5);
727 } elseif ($key ==
'rowid') {
728 print $object->showOutputField($val, $key, $object->id,
'');
729 } elseif ($key ==
'fk_user_creat') {
730 if ($object->fk_user_creat > 0) {
731 if (isset($conf->cache[
'user'][$object->fk_user_creat])) {
732 $user_temp = $conf->cache[
'user'][$object->fk_user_creat];
734 $user_temp =
new User($db);
735 $user_temp->fetch($object->fk_user_creat);
736 $conf->cache[
'user'][$object->fk_user_creat] = $user_temp;
738 print $user_temp->getNomUrl(-1);
740 } elseif ($key ==
'fk_user_modif') {
741 if ($object->fk_user_modif > 0) {
742 if (isset($conf->cache[
'user'][$object->fk_user_modif])) {
743 $user_temp = $conf->cache[
'user'][$object->fk_user_modif];
745 $user_temp =
new User($db);
746 $user_temp->fetch($object->fk_user_modif);
747 $conf->cache[
'user'][$object->fk_user_modif] = $user_temp;
749 print $user_temp->getNomUrl(-1);
751 } elseif ($key ==
'fk_user_valid') {
752 if ($object->fk_user_valid > 0) {
753 if (isset($conf->cache[
'user'][$object->fk_user_valid])) {
754 $user_temp = $conf->cache[
'user'][$object->fk_user_valid];
756 $user_temp =
new User($db);
757 $user_temp->fetch($object->fk_user_valid);
758 $conf->cache[
'user'][$object->fk_user_valid] = $user_temp;
760 print $user_temp->getNomUrl(-1);
762 } elseif ($key ==
'lang') {
763 $labellang = ($object->lang ? $langs->trans(
'Language_'.$object->lang) :
'');
764 print
picto_from_langcode($object->lang,
'class="paddingrightonly saturatemedium opacitylow"');
766 } elseif ($key ==
'question') {
769 print $object->showOutputField($val, $key, $object->$key,
'');
773 $totalarray[
'nbfield']++;
775 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
777 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
779 if (!isset($totalarray[
'val'])) {
780 $totalarray[
'val'] = array();
782 if (!isset($totalarray[
'val'][
't.'.$key])) {
783 $totalarray[
'val'][
't.'.$key] = 0;
785 $totalarray[
'val'][
't.'.$key] += $object->$key;
790 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
792 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
793 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
794 print $hookmanager->resPrint;
797 print
'<td class="nowrap center">';
798 if ($massactionbutton || $massaction) {
800 if (in_array($object->id, $arrayofselected)) {
803 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
807 $totalarray[
'nbfield']++;
817include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
822 foreach ($arrayfields as $key => $val) {
823 if (!empty($val[
'checked'])) {
827 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
833$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
834$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
835print $hookmanager->resPrint;
837print
'</table>'.
"\n";
842if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
843 $hidegeneratedfilelistifempty = 1;
844 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
845 $hidegeneratedfilelistifempty = 0;
848 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
852 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
853 $urlsource .= str_replace(
'&',
'&', $param);
855 $filedir = $diroutputmassaction;
856 $genallowed = $permissiontoread;
857 $delallowed = $permissiontoadd;
859 print $formfile->showdocuments(
'massfilesarea_knowledgemanagement',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
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 informations (by default a local PHP server timestamp) Re...
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return 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.