26require
'../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/product/inventory/class/inventory.class.php';
42$langs->loadLangs(array(
"stocks",
"other"));
44$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
45$massaction =
GETPOST(
'massaction',
'alpha');
47$confirm =
GETPOST(
'confirm',
'alpha');
48$cancel =
GETPOST(
'cancel',
'alpha');
49$toselect =
GETPOST(
'toselect',
'array');
50$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
51$backtopage =
GETPOST(
'backtopage',
'alpha');
52$optioncss =
GETPOST(
'optioncss',
'aZ');
59$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
60$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
62if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
66$offset = $limit * $page;
75$diroutputmassaction =
null;
76$hookmanager->initHooks(array(
'inventorylist'));
78$extrafields->fetch_name_optionals_label(
$object->table_element);
79$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
84 $sortfield =
"t.".key(
$object->fields);
91$search_all =
GETPOST(
'search_all',
'alphanohtml');
93foreach (
$object->fields as $key => $val) {
94 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
95 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
97 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
102$searchCategoryProductOperator = 0;
103if (GETPOSTISSET(
'formfilteraction')) {
104 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
108$searchCategoryProductList =
GETPOST(
'search_category_product_list',
'array');
111$fieldstosearchall = array();
112foreach (
$object->fields as $key => $val) {
113 if (!empty($val[
'searchall'])) {
114 $fieldstosearchall[
't.'.$key] = $val[
'label'];
119$arrayfields = array();
120foreach (
$object->fields as $key => $val) {
122 if (!empty($val[
'visible'])) {
123 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
124 $arrayfields[
't.'.$key] = array(
125 'label'=>$val[
'label'],
126 'checked'=>(($visible < 0) ? 0 : 1),
127 'enabled'=>(abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
128 'position'=>$val[
'position'],
129 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
134include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
139$permissiontoread = $user->hasRight(
'stock',
'lire');
140$permissiontoadd = $user->hasRight(
'stock',
'creer');
141$permissiontodelete = $user->hasRight(
'stock',
'supprimer');
145if ($user->socid > 0) {
152 $result =
restrictedArea($user,
'stock', 0,
'',
'inventory_advance');
160if (
GETPOST(
'cancel',
'alpha')) {
164if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
168$parameters = array();
169$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
174if (empty($reshook)) {
176 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
179 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
180 foreach (
$object->fields as $key => $val) {
182 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
183 $search[$key.
'_dtstart'] =
'';
184 $search[$key.
'_dtend'] =
'';
187 $searchCategoryProductList = array();
189 $search_array_options = array();
191 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
192 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
197 $objectclass =
'Inventory';
198 $objectlabel =
'Inventory';
199 $uploaddir =
$conf->stock->dir_output;
200 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
209$form =
new Form($db);
213$title = $langs->trans(
'Inventories');
223$sql .=
$object->getFieldList(
't');
225if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
226 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
227 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
231$parameters = array();
232$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
233$sql .= $hookmanager->resPrint;
234$sql = preg_replace(
'/,\s*$/',
'', $sql);
238$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
239if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
240 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
243$parameters = array();
244$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
245$sql .= $hookmanager->resPrint;
246if (
$object->ismultientitymanaged == 1) {
247 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
249 $sql .=
" WHERE 1 = 1";
251foreach ($search as $key => $val) {
252 if (array_key_exists($key,
$object->fields)) {
253 if ($key ==
'status' && $search[$key] == -1) {
257 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
258 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
263 if ($search[$key] !=
'') {
264 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
267 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
268 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
269 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
270 if (preg_match(
'/_dtstart$/', $key)) {
271 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
273 if (preg_match(
'/_dtend$/', $key)) {
274 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
282 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
285if (!empty($searchCategoryProductList)) {
286 $searchCategoryProductSqlList = array();
287 $listofcategoryid =
'';
288 foreach ($searchCategoryProductList as $searchCategoryProduct) {
289 if (intval($searchCategoryProduct) == -2) {
290 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product)";
291 } elseif (intval($searchCategoryProduct) > 0) {
292 if ($searchCategoryProductOperator == 0) {
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 = ".((int) $searchCategoryProduct).
")";
295 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
299 if ($listofcategoryid) {
300 $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).
"))";
302 if ($searchCategoryProductOperator == 1) {
303 if (!empty($searchCategoryProductSqlList)) {
304 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
307 if (!empty($searchCategoryProductSqlList)) {
308 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
313include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
315$parameters = array();
316$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
317$sql .= $hookmanager->resPrint;
338$nbtotalofrecords =
'';
341 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
342 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
343 $resql = $db->query($sqlforcount);
345 $objforcount = $db->fetch_object($resql);
346 $nbtotalofrecords = $objforcount->nbtotalofrecords;
351 if (($page * $limit) > $nbtotalofrecords) {
359$sql .= $db->order($sortfield, $sortorder);
361 $sql .= $db->plimit($limit + 1, $offset);
364$resql = $db->query($sql);
370$num = $db->num_rows($resql);
373if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
374 $obj = $db->fetch_object($resql);
376 header(
"Location: ".DOL_URL_ROOT.
'/inventory/card.php?id='.
$id);
384llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
386$arrayofselected = is_array($toselect) ? $toselect : array();
390 $param .=
'&mode='.urlencode($mode);
392if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
393 $param .=
'&contextpage='.urlencode($contextpage);
395if ($limit > 0 && $limit !=
$conf->liste_limit) {
396 $param .=
'&limit='.((int) $limit);
398foreach ($search as $key => $val) {
399 if (is_array($search[$key])) {
400 foreach ($search[$key] as $skey) {
402 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
405 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
406 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
407 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
408 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
409 } elseif ($search[$key] !=
'') {
410 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
413if ($optioncss !=
'') {
414 $param .=
'&optioncss='.urlencode($optioncss);
416foreach ($searchCategoryProductList as $searchCategoryProduct) {
417 $param .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
420include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
422$parameters = array(
'param' => &$param);
423$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
424$param .= $hookmanager->resPrint;
427$arrayofmassactions = array(
433if (!empty($permissiontodelete)) {
434 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
436if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
437 $arrayofmassactions = array();
439$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
441print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
442if ($optioncss !=
'') {
443 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
445print
'<input type="hidden" name="token" value="'.newToken().
'">';
446print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
447print
'<input type="hidden" name="action" value="list">';
448print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
449print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
450print
'<input type="hidden" name="page" value="'.$page.
'">';
451print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
452print
'<input type="hidden" name="page_y" value="">';
453print
'<input type="hidden" name="mode" value="'.$mode.
'">';
456$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'));
457$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'));
459$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/inventory/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
461print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
464$topicmail =
"Information";
465$modelmail =
"inventory";
467$trackid =
'stockinv'.$object->id;
468include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
472 foreach ($fieldstosearchall as $key => $val) {
473 $fieldstosearchall[$key] = $langs->trans($val);
474 $setupstring .= $key.
"=".$val.
";";
476 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
477 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
486if (
getDolGlobalString(
'MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS') && isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
488 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList,
'minwidth300', $searchCategoryProductList ? $searchCategoryProductList : 0);
502$parameters = array();
503$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
504if (empty($reshook)) {
505 $moreforfilter .= $hookmanager->resPrint;
507 $moreforfilter = $hookmanager->resPrint;
510if (!empty($moreforfilter)) {
511 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
512 print $moreforfilter;
513 $parameters = array();
514 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
515 print $hookmanager->resPrint;
519$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
520$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
521$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
522$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
524print
'<div class="div-table-responsive">';
525print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
530print
'<tr class="liste_titre_filter">';
533 print
'<td class="liste_titre center maxwidthsearch">';
534 $searchpicto = $form->showFilterButtons(
'left');
538foreach (
$object->fields as $key => $val) {
539 $searchkey = empty($search[$key]) ?
'' : $search[$key];
540 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
541 if ($key ==
'status') {
542 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
543 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
544 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
545 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
546 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
547 } 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'])) {
548 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
550 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
551 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
552 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
553 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);
554 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
555 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
556 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
557 print
'<div class="nowrap">';
558 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
560 print
'<div class="nowrap">';
561 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
563 } elseif ($key ==
'lang') {
564 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
566 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
568 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
574include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
577$parameters = array(
'arrayfields'=>$arrayfields);
578$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
579print $hookmanager->resPrint;
582 print
'<td class="liste_titre center maxwidthsearch">';
583 $searchpicto = $form->showFilterButtons();
589$totalarray = array();
590$totalarray[
'nbfield'] = 0;
594print
'<tr class="liste_titre">';
597 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
598 $totalarray[
'nbfield']++;
600foreach (
$object->fields as $key => $val) {
601 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
602 if ($key ==
'status') {
603 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
604 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
605 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
606 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
607 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
608 } 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'])) {
609 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
611 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
612 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
613 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";
614 $totalarray[
'nbfield']++;
618include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
620$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
621$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
622print $hookmanager->resPrint;
625 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
626 $totalarray[
'nbfield']++;
632$needToFetchEachLine = 0;
633if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
634 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
635 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
636 $needToFetchEachLine++;
644$savnbfield = $totalarray[
'nbfield'];
645$totalarray = array();
646$totalarray[
'nbfield'] = 0;
647$imaxinloop = ($limit ? min($num, $limit) : $num);
648while ($i < $imaxinloop) {
649 $obj = $db->fetch_object($resql);
655 $object->setVarsFromFetchObj($obj);
657 if ($mode ==
'kanban') {
659 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
660 print
'<div class="box-flex-container kanban">';
664 if ($massactionbutton || $massaction) {
666 if (in_array(
$object->id, $arrayofselected)) {
670 print
$object->getKanbanView(
'', array(
'selected' => $selected));
671 if ($i == ($imaxinloop - 1)) {
678 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
681 print
'<td class="nowrap center">';
682 if ($massactionbutton || $massaction) {
684 if (in_array(
$object->id, $arrayofselected)) {
687 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
691 $totalarray[
'nbfield']++;
694 foreach (
$object->fields as $key => $val) {
695 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
696 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
697 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
698 } elseif ($key ==
'status') {
699 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
702 if (in_array($val[
'type'], array(
'timestamp'))) {
703 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
704 } elseif ($key ==
'ref') {
705 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
708 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
709 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
712 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
713 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
714 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric(
$object->$key)) {
715 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
718 if ($key ==
'status') {
719 print
$object->getLibStatut(5);
720 } elseif ($key ==
'rowid') {
727 $totalarray[
'nbfield']++;
729 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
731 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
733 if (!isset($totalarray[
'val'])) {
734 $totalarray[
'val'] = array();
736 if (!isset($totalarray[
'val'][
't.'.$key])) {
737 $totalarray[
'val'][
't.'.$key] = 0;
739 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
744 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
746 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
747 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
748 print $hookmanager->resPrint;
751 print
'<td class="nowrap center">';
752 if ($massactionbutton || $massaction) {
754 if (in_array(
$object->id, $arrayofselected)) {
757 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
761 $totalarray[
'nbfield']++;
772include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
778 foreach ($arrayfields as $key => $val) {
779 if (!empty($val[
'checked'])) {
783 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
789$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
790$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
791print $hookmanager->resPrint;
793print
'</table>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.