25require
'../../main.inc.php';
26require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/product/inventory/class/inventory.class.php';
30if (isModEnabled(
'categorie')) {
31 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
35$langs->loadLangs(array(
"stocks",
"other"));
37$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
38$massaction =
GETPOST(
'massaction',
'alpha');
39$show_files =
GETPOST(
'show_files',
'int');
40$confirm =
GETPOST(
'confirm',
'alpha');
41$cancel =
GETPOST(
'cancel',
'alpha');
42$toselect =
GETPOST(
'toselect',
'array');
43$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
44$backtopage =
GETPOST(
'backtopage',
'alpha');
45$optioncss =
GETPOST(
'optioncss',
'aZ');
51$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
52$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
53$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
55if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
59$offset = $limit * $page;
68$diroutputmassaction =
null;
69$hookmanager->initHooks(array(
'inventorylist'));
71$extrafields->fetch_name_optionals_label($object->table_element);
72$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
76 reset($object->fields);
77 $sortfield =
"t.".key($object->fields);
84$search_all =
GETPOST(
'search_all',
'alphanohtml');
86foreach ($object->fields as $key => $val) {
87 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
88 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
90 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
91 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
92 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
95$searchCategoryProductOperator = 0;
96if (GETPOSTISSET(
'formfilteraction')) {
97 $searchCategoryProductOperator =
GETPOST(
'search_category_product_operator',
'int');
99 $searchCategoryProductOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
101$searchCategoryProductList =
GETPOST(
'search_category_product_list',
'array');
104$fieldstosearchall = array();
105foreach ($object->fields as $key => $val) {
106 if (!empty($val[
'searchall'])) {
107 $fieldstosearchall[
't.'.$key] = $val[
'label'];
112$arrayfields = array();
113foreach ($object->fields as $key => $val) {
115 if (!empty($val[
'visible'])) {
116 $visible = (int)
dol_eval($val[
'visible'], 1);
117 $arrayfields[
't.'.$key] = array(
118 'label'=>$val[
'label'],
119 'checked'=>(($visible < 0) ? 0 : 1),
120 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
121 'position'=>$val[
'position'],
122 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
127include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
132$permissiontoread = $user->rights->stock->lire;
133$permissiontoadd = $user->rights->stock->creer;
134$permissiontodelete = $user->rights->stock->supprimer;
138if ($user->socid > 0) {
145 $result =
restrictedArea($user,
'stock', 0,
'',
'inventory_advance');
153if (
GETPOST(
'cancel',
'alpha')) {
157if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
161$parameters = array();
162$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
167if (empty($reshook)) {
169 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
172 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
173 foreach ($object->fields as $key => $val) {
175 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
176 $search[$key.
'_dtstart'] =
'';
177 $search[$key.
'_dtend'] =
'';
180 $searchCategoryProductList = array();
182 $search_array_options = array();
184 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
185 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
190 $objectclass =
'Inventory';
191 $objectlabel =
'Inventory';
192 $uploaddir = $conf->stock->dir_output;
193 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
202$form =
new Form($db);
206$title = $langs->trans(
'Inventories');
216$sql .= $object->getFieldList(
't');
218if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
219 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
220 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
224$parameters = array();
225$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
226$sql .= $hookmanager->resPrint;
227$sql = preg_replace(
'/,\s*$/',
'', $sql);
231$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
232if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
233 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
236$parameters = array();
237$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
238$sql .= $hookmanager->resPrint;
239if ($object->ismultientitymanaged == 1) {
240 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
242 $sql .=
" WHERE 1 = 1";
244foreach ($search as $key => $val) {
245 if (array_key_exists($key, $object->fields)) {
246 if ($key ==
'status' && $search[$key] == -1) {
249 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
250 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
251 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
256 if ($search[$key] !=
'') {
257 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
260 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
261 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
262 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
263 if (preg_match(
'/_dtstart$/', $key)) {
264 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
266 if (preg_match(
'/_dtend$/', $key)) {
267 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
275 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
278if (!empty($searchCategoryProductList)) {
279 $searchCategoryProductSqlList = array();
280 $listofcategoryid =
'';
281 foreach ($searchCategoryProductList as $searchCategoryProduct) {
282 if (intval($searchCategoryProduct) == -2) {
283 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product)";
284 } elseif (intval($searchCategoryProduct) > 0) {
285 if ($searchCategoryProductOperator == 0) {
286 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
288 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
292 if ($listofcategoryid) {
293 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
295 if ($searchCategoryProductOperator == 1) {
296 if (!empty($searchCategoryProductSqlList)) {
297 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
300 if (!empty($searchCategoryProductSqlList)) {
301 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
306include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
308$parameters = array();
309$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
310$sql .= $hookmanager->resPrint;
331$nbtotalofrecords =
'';
334 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
335 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
336 $resql = $db->query($sqlforcount);
338 $objforcount = $db->fetch_object($resql);
339 $nbtotalofrecords = $objforcount->nbtotalofrecords;
344 if (($page * $limit) > $nbtotalofrecords) {
352$sql .= $db->order($sortfield, $sortorder);
354 $sql .= $db->plimit($limit + 1, $offset);
357$resql = $db->query($sql);
363$num = $db->num_rows($resql);
366if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
367 $obj = $db->fetch_object($resql);
369 header(
"Location: ".DOL_URL_ROOT.
'/inventory/card.php?id='.$id);
377llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
379$arrayofselected = is_array($toselect) ? $toselect : array();
383 $param .=
'&mode='.urlencode($mode);
385if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
386 $param .=
'&contextpage='.urlencode($contextpage);
388if ($limit > 0 && $limit != $conf->liste_limit) {
389 $param .=
'&limit='.((int) $limit);
391foreach ($search as $key => $val) {
392 if (is_array($search[$key])) {
393 foreach ($search[$key] as $skey) {
395 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
398 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
399 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
400 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
401 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
402 } elseif ($search[$key] !=
'') {
403 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
406if ($optioncss !=
'') {
407 $param .=
'&optioncss='.urlencode($optioncss);
409foreach ($searchCategoryProductList as $searchCategoryProduct) {
410 $param .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
413include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
415$parameters = array(
'param' => &$param);
416$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
417$param .= $hookmanager->resPrint;
420$arrayofmassactions = array(
426if (!empty($permissiontodelete)) {
427 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
429if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
430 $arrayofmassactions = array();
432$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
434print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
435if ($optioncss !=
'') {
436 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
438print
'<input type="hidden" name="token" value="'.newToken().
'">';
439print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
440print
'<input type="hidden" name="action" value="list">';
441print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
442print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
443print
'<input type="hidden" name="page" value="'.$page.
'">';
444print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
445print
'<input type="hidden" name="page_y" value="">';
446print
'<input type="hidden" name="mode" value="'.$mode.
'">';
449$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'));
450$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'));
452$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/inventory/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
454print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
457$topicmail =
"Information";
458$modelmail =
"inventory";
460$trackid =
'stockinv'.$object->id;
461include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
465 foreach ($fieldstosearchall as $key => $val) {
466 $fieldstosearchall[$key] = $langs->trans($val);
467 $setupstring .= $key.
"=".$val.
";";
469 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
470 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
479if (
getDolGlobalString(
'MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS') && isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
480 $moreforfilter .=
'<div class="divsearchfield">';
481 $tmptitle = $langs->transnoentities(
'ProductsCategoriesShort');
482 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
483 $categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'', 64, 0, 1);
484 $categoriesProductArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
485 $moreforfilter .=
Form::multiselectarray(
'search_category_product_list', $categoriesProductArr, $searchCategoryProductList, 0, 0,
'minwidth300', 0, 0,
'',
'category', $tmptitle);
486 $moreforfilter .=
' <input type="checkbox" class="valignmiddle" id="search_category_product_operator" name="search_category_product_operator" value="1"'.($searchCategoryProductOperator == 1 ?
' checked="checked"' :
'').
'/>';
487 $moreforfilter .= $form->textwithpicto(
'', $langs->trans(
'UseOrOperatorForCategories') .
' : ' . $tmptitle, 1,
'help',
'', 0, 2,
'tooltip_cat_pro');
488 $moreforfilter .=
'</div>';
491$parameters = array();
492$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
493if (empty($reshook)) {
494 $moreforfilter .= $hookmanager->resPrint;
496 $moreforfilter = $hookmanager->resPrint;
499if (!empty($moreforfilter)) {
500 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
501 print $moreforfilter;
502 $parameters = array();
503 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
504 print $hookmanager->resPrint;
508$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
509$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
510$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
512print
'<div class="div-table-responsive">';
513print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
518print
'<tr class="liste_titre_filter">';
521 print
'<td class="liste_titre center maxwidthsearch">';
522 $searchpicto = $form->showFilterButtons(
'left');
526foreach ($object->fields as $key => $val) {
527 $searchkey = empty($search[$key]) ?
'' : $search[$key];
528 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
529 if ($key ==
'status') {
530 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
531 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
532 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
533 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
534 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
535 } 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'])) {
536 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
538 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
539 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
540 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
541 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);
542 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
543 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
544 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
545 print
'<div class="nowrap">';
546 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
548 print
'<div class="nowrap">';
549 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
551 } elseif ($key ==
'lang') {
552 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
554 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
556 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
562include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
565$parameters = array(
'arrayfields'=>$arrayfields);
566$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
567print $hookmanager->resPrint;
570 print
'<td class="liste_titre center maxwidthsearch">';
571 $searchpicto = $form->showFilterButtons();
577$totalarray = array();
578$totalarray[
'nbfield'] = 0;
582print
'<tr class="liste_titre">';
585 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
586 $totalarray[
'nbfield']++;
588foreach ($object->fields as $key => $val) {
589 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
590 if ($key ==
'status') {
591 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
592 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
593 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
594 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
595 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
596 } 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'])) {
597 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
599 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
600 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
601 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";
602 $totalarray[
'nbfield']++;
606include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
608$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
609$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
610print $hookmanager->resPrint;
613 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
614 $totalarray[
'nbfield']++;
620$needToFetchEachLine = 0;
621if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
622 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
623 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
624 $needToFetchEachLine++;
632$savnbfield = $totalarray[
'nbfield'];
633$totalarray = array();
634$totalarray[
'nbfield'] = 0;
635$imaxinloop = ($limit ? min($num, $limit) : $num);
636while ($i < $imaxinloop) {
637 $obj = $db->fetch_object($resql);
643 $object->setVarsFromFetchObj($obj);
645 if ($mode ==
'kanban') {
647 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
648 print
'<div class="box-flex-container kanban">';
652 if ($massactionbutton || $massaction) {
654 if (in_array($object->id, $arrayofselected)) {
658 print $object->getKanbanView(
'', array(
'selected' => $selected));
659 if ($i == ($imaxinloop - 1)) {
666 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
669 print
'<td class="nowrap center">';
670 if ($massactionbutton || $massaction) {
672 if (in_array($object->id, $arrayofselected)) {
675 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
679 $totalarray[
'nbfield']++;
682 foreach ($object->fields as $key => $val) {
683 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
684 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
685 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
686 } elseif ($key ==
'status') {
687 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
690 if (in_array($val[
'type'], array(
'timestamp'))) {
691 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
692 } elseif ($key ==
'ref') {
693 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
696 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
697 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
700 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
701 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
702 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
703 print
' title="'.dol_escape_htmltag($object->$key).
'"';
706 if ($key ==
'status') {
707 print $object->getLibStatut(5);
708 } elseif ($key ==
'rowid') {
709 print $object->showOutputField($val, $key, $object->id,
'');
711 print $object->showOutputField($val, $key, $object->$key,
'');
715 $totalarray[
'nbfield']++;
717 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
719 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
721 if (!isset($totalarray[
'val'])) {
722 $totalarray[
'val'] = array();
724 if (!isset($totalarray[
'val'][
't.'.$key])) {
725 $totalarray[
'val'][
't.'.$key] = 0;
727 $totalarray[
'val'][
't.'.$key] += $object->$key;
732 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
734 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
735 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
736 print $hookmanager->resPrint;
739 print
'<td class="nowrap center">';
740 if ($massactionbutton || $massaction) {
742 if (in_array($object->id, $arrayofselected)) {
745 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
749 $totalarray[
'nbfield']++;
760include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
766 foreach ($arrayfields as $key => $val) {
767 if (!empty($val[
'checked'])) {
771 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
777$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
778$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
779print $hookmanager->resPrint;
781print
'</table>'.
"\n";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
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...
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...
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.
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.