26 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/knowledgemanagement/class/knowledgerecord.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43 $langs->loadLangs(array(
"knowledgemanagement",
"other"));
45 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
46 $massaction =
GETPOST(
'massaction',
'alpha');
47 $show_files =
GETPOST(
'show_files',
'int');
48 $confirm =
GETPOST(
'confirm',
'alpha');
49 $cancel =
GETPOST(
'cancel',
'alpha');
50 $toselect =
GETPOST(
'toselect',
'array');
51 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'knowledgerecordlist';
52 $backtopage =
GETPOST(
'backtopage',
'alpha');
53 $optioncss =
GETPOST(
'optioncss',
'aZ');
54 $mode =
GETPOST(
'mode',
'aZ09');
58 $searchCategoryKnowledgemanagementList =
GETPOST(
'search_category_knowledgemanagement_list',
'array');
59 $searchCategoryKnowledgemanagementOperator = 0;
61 $searchCategoryKnowledgemanagementOperator =
GETPOST(
'search_category_knowledgemanagement_operator',
'int');
62 } elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
63 $searchCategoryKnowledgemanagementOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
66 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
67 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
68 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
70 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
73 $offset = $limit * $page;
74 $pageprev = $page - 1;
75 $pagenext = $page + 1;
80 $diroutputmassaction = $conf->knowledgemanagement->dir_output.
'/temp/massgeneration/'.$user->id;
81 $hookmanager->initHooks(array(
'knowledgerecordlist'));
84 $extrafields->fetch_name_optionals_label($object->table_element);
87 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
91 reset($object->fields);
92 $sortfield =
"t.".key($object->fields);
99 $search_all =
GETPOST(
'search_all',
'alphanohtml');
101 foreach ($object->fields as $key => $val) {
102 if ($key ==
"lang") {
103 $search[$key] =
GETPOST(
'search_'.$key,
'alpha')!=
'0' ?
GETPOST(
'search_'.$key,
'alpha') :
'';
105 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
108 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
109 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
110 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
115 $fieldstosearchall = array();
116 foreach ($object->fields as $key => $val) {
117 if (!empty($val[
'searchall'])) {
118 $fieldstosearchall[
't.'.$key] = $val[
'label'];
123 $arrayfields = array();
124 foreach ($object->fields as $key => $val) {
126 if (!empty($val[
'visible'])) {
127 $visible = (int)
dol_eval($val[
'visible'], 1);
128 $arrayfields[
't.'.$key] = array(
129 'label'=>$val[
'label'],
130 'checked'=>(($visible < 0) ? 0 : 1),
131 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
132 'position'=>$val[
'position'],
133 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
138 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
143 $permissiontoread = $user->rights->knowledgemanagement->knowledgerecord->read;
144 $permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write;
145 $permissiontodelete = $user->rights->knowledgemanagement->knowledgerecord->delete;
148 if (empty($conf->knowledgemanagement->enabled)) {
152 if ($user->socid > 0) {
156 $result =
restrictedArea($user,
'knowledgemanagement', 0,
'',
'knowledgerecord');
165 if (
GETPOST(
'cancel',
'alpha')) {
169 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
173 $parameters = array();
174 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
179 if (empty($reshook)) {
181 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
184 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
185 foreach ($object->fields as $key => $val) {
187 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
188 $search[$key.
'_dtstart'] =
'';
189 $search[$key.
'_dtend'] =
'';
193 $search_array_options = array();
195 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
196 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
199 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
200 $searchCategoryKnowledgemanagementOperator = 0;
201 $searchCategoryKnowledgemanagementList = array();
205 $objectclass =
'KnowledgeRecord';
206 $objectlabel =
'KnowledgeRecord';
207 $uploaddir = $conf->knowledgemanagement->dir_output;
208 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
218 $user_temp =
new User($db);
225 $title = $langs->trans(
'KnowledgeRecords');
233 $sql .= $object->getFieldList(
't');
235 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
236 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
237 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
241 $parameters = array();
242 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
243 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
244 $sql = preg_replace(
'/,\s*$/',
'', $sql);
245 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
246 if (!empty($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;
253 if ($object->ismultientitymanaged == 1) {
254 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
256 $sql .=
" WHERE 1 = 1";
258 foreach ($search as $key => $val) {
259 if (array_key_exists($key, $object->fields)) {
260 if ($key ==
'status' && $search[$key] == -1) {
263 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
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($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]).
"'";
289 if (!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 ($searchCategoryKnowledgemanagementOperator == 0) {
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);
322 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
324 $parameters = array();
325 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
326 $sql .= $hookmanager->resPrint;
346 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
347 $resql = $db->query($sql);
358 $sql .= $db->order($sortfield, $sortorder);
360 $sql .= $db->plimit($limit + 1, $offset);
363 $resql = $db->query($sql);
369 $num = $db->num_rows(
$resql);
373 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
374 $obj = $db->fetch_object(
$resql);
376 header(
"Location: ".
dol_buildpath(
'/knowledgemanagement/knowledgerecord_card.php', 1).
'?id='.$id);
387 $arrayofselected = is_array($toselect) ? $toselect : array();
391 $param .=
'&mode='.urlencode($mode);
393 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
394 $param .=
'&contextpage='.urlencode($contextpage);
396 if ($limit > 0 && $limit != $conf->liste_limit) {
397 $param .=
'&limit='.urlencode($limit);
399 foreach ($search as $key => $val) {
400 if (is_array($search[$key]) && count($search[$key])) {
401 foreach ($search[$key] as $skey) {
403 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
406 } elseif ($search[$key] !=
'') {
407 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
410 if ($optioncss !=
'') {
411 $param .=
'&optioncss='.urlencode($optioncss);
414 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
416 $parameters = array();
417 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
418 $param .= $hookmanager->resPrint;
421 $arrayofmassactions = array(
422 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
427 if ($permissiontodelete) {
428 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
431 if (
isModEnabled(
'category') && $user->rights->knowledgemanagement->knowledgerecord->write) {
432 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
435 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
436 $arrayofmassactions = array();
438 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
440 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
441 if ($optioncss !=
'') {
442 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
444 print
'<input type="hidden" name="token" value="'.newToken().
'">';
445 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
446 print
'<input type="hidden" name="action" value="list">';
447 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
448 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
449 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
451 $newcardbutton =
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/knowledgemanagement/knowledgerecord_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
453 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
456 $topicmail =
"SendKnowledgeRecordRef";
457 $modelmail =
"knowledgerecord";
459 $trackid =
'xxxx'.$object->id;
460 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
464 foreach ($fieldstosearchall as $key => $val) {
465 $fieldstosearchall[$key] = $langs->trans($val);
466 $setupstring .= $key.
"=".$val.
";";
468 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
469 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
479 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
480 $moreforfilter .=
'<div class="divsearchfield">';
481 $moreforfilter .=
img_picto($langs->trans(
'Categories'),
'category',
'class="pictofixedwidth"');
482 $categoriesKnowledgeArr =
$form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT,
'',
'', 64, 0, 1);
483 $categoriesKnowledgeArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
484 $moreforfilter .=
Form::multiselectarray(
'search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0,
'minwidth300');
485 $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>';
486 $moreforfilter .=
'</div>';
489 $parameters = array();
490 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
491 if (empty($reshook)) {
492 $moreforfilter .= $hookmanager->resPrint;
494 $moreforfilter = $hookmanager->resPrint;
497 if (!empty($moreforfilter)) {
498 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
499 print $moreforfilter;
503 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
504 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
505 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
507 print
'<div class="div-table-responsive">';
508 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
513 print
'<tr class="liste_titre">';
515 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
516 print
'<td class="liste_titre maxwidthsearch">';
517 $searchpicto =
$form->showFilterButtons(
'left');
521 foreach ($object->fields as $key => $val) {
522 $searchkey = empty($search[$key]) ?
'' : $search[$key];
523 $cssforfield = (empty($val[
'css']) ?
'' : $val[
'css']);
524 if ($key ==
'status') {
525 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
526 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
527 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
528 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
529 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
530 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
531 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
533 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
534 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
536 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
537 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
538 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:')=== 0)) {
539 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
540 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
541 print
'<div class="nowrap">';
542 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
544 print
'<div class="nowrap">';
545 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
547 } elseif ($key ==
'lang') {
548 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
550 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
552 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
558 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
561 $parameters = array(
'arrayfields'=>$arrayfields);
562 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
563 print $hookmanager->resPrint;
565 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
566 print
'<td class="liste_titre maxwidthsearch">';
567 $searchpicto =
$form->showFilterButtons();
573 $totalarray = array();
574 $totalarray[
'nbfield'] = 0;
578 print
'<tr class="liste_titre">';
579 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
580 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
582 foreach ($object->fields as $key => $val) {
583 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
584 if ($key ==
'status') {
585 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
586 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
587 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
588 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
589 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
590 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
591 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
593 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
594 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
595 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
596 $totalarray[
'nbfield']++;
600 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
602 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
603 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
604 print $hookmanager->resPrint;
606 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
607 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
609 $totalarray[
'nbfield']++;
614 $needToFetchEachLine = 0;
615 if (!empty($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
616 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
617 if (preg_match(
'/\$object/', $val)) {
618 $needToFetchEachLine++;
627 $savnbfield = $totalarray[
'nbfield'];
628 $totalarray[
'nbfield'] = 0;
629 $imaxinloop = ($limit ? min($num, $limit) : $num);
630 while ($i < $imaxinloop) {
631 $obj = $db->fetch_object(
$resql);
637 $object->setVarsFromFetchObj($obj);
641 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
643 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
644 print
'<td class="nowrap center">';
645 if ($massactionbutton || $massaction) {
647 if (in_array($object->id, $arrayofselected)) {
650 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
654 foreach ($object->fields as $key => $val) {
655 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
656 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
657 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
658 } elseif ($key ==
'status') {
659 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
662 if (in_array($val[
'type'], array(
'timestamp'))) {
663 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
664 } elseif ($key ==
'ref') {
665 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
668 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
669 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
672 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
673 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'');
674 if (preg_match(
'/tdoverflow/', $cssforfield)) {
675 print
' title="'.dol_escape_htmltag($object->$key).
'"';
678 if ($key ==
'status') {
679 print $object->getLibStatut(5);
680 } elseif ($key ==
'rowid') {
681 print $object->showOutputField($val, $key, $object->id,
'');
682 } elseif ($key ==
'fk_user_creat') {
683 if ($object->fk_user_creat > 0) {
684 if (isset($conf->cache[
'user'][$object->fk_user_creat])) {
685 $user_temp = $conf->cache[
'user'][$object->fk_user_creat];
687 $user_temp =
new User($db);
688 $user_temp->fetch($object->fk_user_creat);
689 $conf->cache[
'user'][$object->fk_user_creat] = $user_temp;
691 print $user_temp->getNomUrl(-1);
693 } elseif ($key ==
'fk_user_modif') {
694 if ($object->fk_user_modif > 0) {
695 if (isset($conf->cache[
'user'][$object->fk_user_modif])) {
696 $user_temp = $conf->cache[
'user'][$object->fk_user_modif];
698 $user_temp =
new User($db);
699 $user_temp->fetch($object->fk_user_modif);
700 $conf->cache[
'user'][$object->fk_user_modif] = $user_temp;
702 print $user_temp->getNomUrl(-1);
704 } elseif ($key ==
'fk_user_valid') {
705 if ($object->fk_user_valid > 0) {
706 if (isset($conf->cache[
'user'][$object->fk_user_valid])) {
707 $user_temp = $conf->cache[
'user'][$object->fk_user_valid];
709 $user_temp =
new User($db);
710 $user_temp->fetch($object->fk_user_valid);
711 $conf->cache[
'user'][$object->fk_user_valid] = $user_temp;
713 print $user_temp->getNomUrl(-1);
715 } elseif ($key ==
'lang') {
716 $labellang = ($object->lang ? $langs->trans(
'Language_'.$object->lang) :
'');
717 print
picto_from_langcode($object->lang,
'class="paddingrightonly saturatemedium opacitylow"');
720 print $object->showOutputField($val, $key, $object->$key,
'');
724 $totalarray[
'nbfield']++;
726 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
728 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
730 if (!isset($totalarray[
'val'])) {
731 $totalarray[
'val'] = array();
733 if (!isset($totalarray[
'val'][
't.'.$key])) {
734 $totalarray[
'val'][
't.'.$key] = 0;
736 $totalarray[
'val'][
't.'.$key] += $object->$key;
741 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
743 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
744 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
745 print $hookmanager->resPrint;
747 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
748 print
'<td class="nowrap center">';
749 if ($massactionbutton || $massaction) {
751 if (in_array($object->id, $arrayofselected)) {
754 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
759 $totalarray[
'nbfield']++;
768 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
773 foreach ($arrayfields as $key => $val) {
774 if (!empty($val[
'checked'])) {
778 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
784 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
785 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
786 print $hookmanager->resPrint;
788 print
'</table>'.
"\n";
791 print
'</form>'.
"\n";
794 $hidegeneratedfilelistifempty = 1;
795 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
796 $hidegeneratedfilelistifempty = 0;
799 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
803 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
804 $urlsource .= str_replace(
'&',
'&', $param);
806 $filedir = $diroutputmassaction;
807 $genallowed = $permissiontoread;
808 $delallowed = $permissiontoadd;
810 print $formfile->showdocuments(
'massfilesarea_knowledgemanagement',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_now($mode='auto')
Return date for now.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
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.
$nbtotalofrecords
Count total nb of records.
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.