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';
34$langs->loadLangs(array(
"stocks",
"other"));
36$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
37$massaction =
GETPOST(
'massaction',
'alpha');
39$confirm =
GETPOST(
'confirm',
'alpha');
40$cancel =
GETPOST(
'cancel',
'alpha');
41$toselect =
GETPOST(
'toselect',
'array');
42$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
43$backtopage =
GETPOST(
'backtopage',
'alpha');
44$optioncss =
GETPOST(
'optioncss',
'aZ');
51$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
52$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
58$offset = $limit * $page;
67$diroutputmassaction =
null;
68$hookmanager->initHooks(array(
'inventorylist'));
70$extrafields->fetch_name_optionals_label(
$object->table_element);
71$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
76 $sortfield =
"t.".key(
$object->fields);
83$search_all =
GETPOST(
'search_all',
'alphanohtml');
85foreach (
$object->fields as $key => $val) {
86 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
87 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
89 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
94$searchCategoryProductOperator = 0;
95if (GETPOSTISSET(
'formfilteraction')) {
96 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
100$searchCategoryProductList =
GETPOST(
'search_category_product_list',
'array');
103$fieldstosearchall = array();
104foreach (
$object->fields as $key => $val) {
105 if (!empty($val[
'searchall'])) {
106 $fieldstosearchall[
't.'.$key] = $val[
'label'];
111$arrayfields = array();
112foreach (
$object->fields as $key => $val) {
114 if (!empty($val[
'visible'])) {
115 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
116 $arrayfields[
't.'.$key] = array(
117 'label'=>$val[
'label'],
118 'checked'=>(($visible < 0) ? 0 : 1),
119 'enabled'=>(abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
120 'position'=>$val[
'position'],
121 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
126include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
131$permissiontoread = $user->hasRight(
'stock',
'lire');
132$permissiontoadd = $user->hasRight(
'stock',
'creer');
133$permissiontodelete = $user->hasRight(
'stock',
'supprimer');
137if ($user->socid > 0) {
144 $result =
restrictedArea($user,
'stock', 0,
'',
'inventory_advance');
152if (
GETPOST(
'cancel',
'alpha')) {
156if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
160$parameters = array();
161$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
166if (empty($reshook)) {
168 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
171 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
172 foreach (
$object->fields as $key => $val) {
174 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
175 $search[$key.
'_dtstart'] =
'';
176 $search[$key.
'_dtend'] =
'';
179 $searchCategoryProductList = array();
181 $search_array_options = array();
183 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
184 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
189 $objectclass =
'Inventory';
190 $objectlabel =
'Inventory';
191 $uploaddir = $conf->stock->dir_output;
192 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
201$form =
new Form($db);
205$title = $langs->trans(
'Inventories');
215$sql .=
$object->getFieldList(
't');
217if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
218 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
219 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
223$parameters = array();
224$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
225$sql .= $hookmanager->resPrint;
226$sql = preg_replace(
'/,\s*$/',
'', $sql);
230$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
231if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
232 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
235$parameters = array();
236$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
237$sql .= $hookmanager->resPrint;
238if (
$object->ismultientitymanaged == 1) {
239 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
241 $sql .=
" WHERE 1 = 1";
243foreach ($search as $key => $val) {
244 if (array_key_exists($key,
$object->fields)) {
245 if ($key ==
'status' && $search[$key] == -1) {
249 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
250 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
255 if ($search[$key] !=
'') {
256 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
259 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
260 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
261 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
262 if (preg_match(
'/_dtstart$/', $key)) {
263 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
265 if (preg_match(
'/_dtend$/', $key)) {
266 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
274 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
277if (!empty($searchCategoryProductList)) {
278 $searchCategoryProductSqlList = array();
279 $listofcategoryid =
'';
280 foreach ($searchCategoryProductList as $searchCategoryProduct) {
281 if (intval($searchCategoryProduct) == -2) {
282 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product)";
283 } elseif (intval($searchCategoryProduct) > 0) {
284 if ($searchCategoryProductOperator == 0) {
285 $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).
")";
287 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
291 if ($listofcategoryid) {
292 $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).
"))";
294 if ($searchCategoryProductOperator == 1) {
295 if (!empty($searchCategoryProductSqlList)) {
296 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
299 if (!empty($searchCategoryProductSqlList)) {
300 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
305include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
307$parameters = array();
308$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
309$sql .= $hookmanager->resPrint;
330$nbtotalofrecords =
'';
333 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
334 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
335 $resql = $db->query($sqlforcount);
337 $objforcount = $db->fetch_object($resql);
338 $nbtotalofrecords = $objforcount->nbtotalofrecords;
343 if (($page * $limit) > $nbtotalofrecords) {
351$sql .= $db->order($sortfield, $sortorder);
353 $sql .= $db->plimit($limit + 1, $offset);
356$resql = $db->query($sql);
362$num = $db->num_rows($resql);
365if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
366 $obj = $db->fetch_object($resql);
368 header(
"Location: ".DOL_URL_ROOT.
'/inventory/card.php?id='.
$id);
376llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
378$arrayofselected = is_array($toselect) ? $toselect : array();
382 $param .=
'&mode='.urlencode($mode);
384if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
385 $param .=
'&contextpage='.urlencode($contextpage);
387if ($limit > 0 && $limit != $conf->liste_limit) {
388 $param .=
'&limit='.((int) $limit);
390foreach ($search as $key => $val) {
391 if (is_array($search[$key])) {
392 foreach ($search[$key] as $skey) {
394 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
397 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
398 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
399 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
400 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
401 } elseif ($search[$key] !=
'') {
402 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
405if ($optioncss !=
'') {
406 $param .=
'&optioncss='.urlencode($optioncss);
408foreach ($searchCategoryProductList as $searchCategoryProduct) {
409 $param .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
412include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
414$parameters = array(
'param' => &$param);
415$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
416$param .= $hookmanager->resPrint;
419$arrayofmassactions = array(
425if (!empty($permissiontodelete)) {
426 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
428if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
429 $arrayofmassactions = array();
431$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
433print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
434if ($optioncss !=
'') {
435 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
437print
'<input type="hidden" name="token" value="'.newToken().
'">';
438print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
439print
'<input type="hidden" name="action" value="list">';
440print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
441print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
442print
'<input type="hidden" name="page" value="'.$page.
'">';
443print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
444print
'<input type="hidden" name="page_y" value="">';
445print
'<input type="hidden" name="mode" value="'.$mode.
'">';
448$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'));
449$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'));
451$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/inventory/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
453print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
456$topicmail =
"Information";
457$modelmail =
"inventory";
459$trackid =
'stockinv'.$object->id;
460include 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 MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
469 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
478if (
getDolGlobalString(
'MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS') && isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
480 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList,
'minwidth300', $searchCategoryProductList ? $searchCategoryProductList : 0);
494$parameters = array();
495$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
496if (empty($reshook)) {
497 $moreforfilter .= $hookmanager->resPrint;
499 $moreforfilter = $hookmanager->resPrint;
502if (!empty($moreforfilter)) {
503 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
504 print $moreforfilter;
505 $parameters = array();
506 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
507 print $hookmanager->resPrint;
511$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
512$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
513$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
514$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
516print
'<div class="div-table-responsive">';
517print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
522print
'<tr class="liste_titre_filter">';
525 print
'<td class="liste_titre center maxwidthsearch">';
526 $searchpicto = $form->showFilterButtons(
'left');
530foreach (
$object->fields as $key => $val) {
531 $searchkey = empty($search[$key]) ?
'' : $search[$key];
532 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
533 if ($key ==
'status') {
534 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
535 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
536 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
537 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
538 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
539 } 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'])) {
540 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
542 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
543 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
544 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
545 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);
546 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
547 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
548 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
549 print
'<div class="nowrap">';
550 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
552 print
'<div class="nowrap">';
553 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
555 } elseif ($key ==
'lang') {
556 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
558 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
560 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
566include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
569$parameters = array(
'arrayfields'=>$arrayfields);
570$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
571print $hookmanager->resPrint;
574 print
'<td class="liste_titre center maxwidthsearch">';
575 $searchpicto = $form->showFilterButtons();
581$totalarray = array();
582$totalarray[
'nbfield'] = 0;
586print
'<tr class="liste_titre">';
589 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
590 $totalarray[
'nbfield']++;
592foreach (
$object->fields as $key => $val) {
593 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
594 if ($key ==
'status') {
595 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
596 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
597 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
598 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
599 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
600 } 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'])) {
601 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
603 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
604 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
605 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";
606 $totalarray[
'nbfield']++;
610include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
612$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
613$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
614print $hookmanager->resPrint;
617 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
618 $totalarray[
'nbfield']++;
624$needToFetchEachLine = 0;
625if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
626 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
627 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
628 $needToFetchEachLine++;
636$savnbfield = $totalarray[
'nbfield'];
637$totalarray = array();
638$totalarray[
'nbfield'] = 0;
639$imaxinloop = ($limit ? min($num, $limit) : $num);
640while ($i < $imaxinloop) {
641 $obj = $db->fetch_object($resql);
647 $object->setVarsFromFetchObj($obj);
649 if ($mode ==
'kanban') {
651 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
652 print
'<div class="box-flex-container kanban">';
656 if ($massactionbutton || $massaction) {
658 if (in_array(
$object->id, $arrayofselected)) {
662 print
$object->getKanbanView(
'', array(
'selected' => $selected));
663 if ($i == ($imaxinloop - 1)) {
670 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
673 print
'<td class="nowrap center">';
674 if ($massactionbutton || $massaction) {
676 if (in_array(
$object->id, $arrayofselected)) {
679 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
683 $totalarray[
'nbfield']++;
686 foreach (
$object->fields as $key => $val) {
687 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
688 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
689 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
690 } elseif ($key ==
'status') {
691 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
694 if (in_array($val[
'type'], array(
'timestamp'))) {
695 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
696 } elseif ($key ==
'ref') {
697 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
700 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
701 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
704 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
705 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
706 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric(
$object->$key)) {
707 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
710 if ($key ==
'status') {
711 print
$object->getLibStatut(5);
712 } elseif ($key ==
'rowid') {
719 $totalarray[
'nbfield']++;
721 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
723 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
725 if (!isset($totalarray[
'val'])) {
726 $totalarray[
'val'] = array();
728 if (!isset($totalarray[
'val'][
't.'.$key])) {
729 $totalarray[
'val'][
't.'.$key] = 0;
731 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
736 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
738 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
739 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
740 print $hookmanager->resPrint;
743 print
'<td class="nowrap center">';
744 if ($massactionbutton || $massaction) {
746 if (in_array(
$object->id, $arrayofselected)) {
749 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
753 $totalarray[
'nbfield']++;
764include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
770 foreach ($arrayfields as $key => $val) {
771 if (!empty($val[
'checked'])) {
775 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
781$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
782$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
783print $hookmanager->resPrint;
785print
'</table>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
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.
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.