25 require
'../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/product/inventory/class/inventory.class.php';
33 $langs->loadLangs(array(
"stocks",
"other"));
35 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
36 $massaction =
GETPOST(
'massaction',
'alpha');
38 $confirm =
GETPOST(
'confirm',
'alpha');
39 $cancel =
GETPOST(
'cancel',
'alpha');
40 $toselect =
GETPOST(
'toselect',
'array');
41 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
42 $backtopage =
GETPOST(
'backtopage',
'alpha');
43 $optioncss =
GETPOST(
'optioncss',
'aZ');
50 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
51 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
53 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
57 $offset = $limit * $page;
58 $pageprev = $page - 1;
59 $pagenext = $page + 1;
66 $diroutputmassaction =
null;
67 $hookmanager->initHooks(array(
'inventorylist'));
69 $extrafields->fetch_name_optionals_label(
$object->table_element);
70 $search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
75 $sortfield =
"t.".key(
$object->fields);
82 $search_all =
GETPOST(
'search_all',
'alphanohtml');
84 foreach (
$object->fields as $key => $val) {
85 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
86 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
88 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
93 $searchCategoryProductOperator = 0;
95 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
99 $searchCategoryProductList =
GETPOST(
'search_category_product_list',
'array');
102 $fieldstosearchall = array();
103 foreach (
$object->fields as $key => $val) {
104 if (!empty($val[
'searchall'])) {
105 $fieldstosearchall[
't.'.$key] = $val[
'label'];
110 $arrayfields = array();
111 foreach (
$object->fields as $key => $val) {
113 if (!empty($val[
'visible'])) {
114 $visible = (int)
dol_eval($val[
'visible'], 1);
115 $arrayfields[
't.'.$key] = array(
116 'label'=>$val[
'label'],
117 'checked'=>(($visible < 0) ? 0 : 1),
118 'enabled'=>(abs($visible) != 3 && (
int)
dol_eval($val[
'enabled'], 1)),
119 'position'=>$val[
'position'],
120 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
125 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
130 $permissiontoread = $user->hasRight(
'stock',
'lire');
131 $permissiontoadd = $user->hasRight(
'stock',
'creer');
132 $permissiontodelete = $user->hasRight(
'stock',
'supprimer');
136 if ($user->socid > 0) {
143 $result =
restrictedArea($user,
'stock', 0,
'',
'inventory_advance');
151 if (
GETPOST(
'cancel',
'alpha')) {
155 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
159 $parameters = array();
160 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
165 if (empty($reshook)) {
167 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
170 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
171 foreach (
$object->fields as $key => $val) {
173 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
174 $search[$key.
'_dtstart'] =
'';
175 $search[$key.
'_dtend'] =
'';
178 $searchCategoryProductList = array();
180 $search_array_options = array();
182 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
183 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
188 $objectclass =
'Inventory';
189 $objectlabel =
'Inventory';
190 $uploaddir = $conf->stock->dir_output;
191 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
200 $form =
new Form($db);
204 $title = $langs->trans(
'Inventories');
216 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
217 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
218 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
222 $parameters = array();
223 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
224 $sql .= $hookmanager->resPrint;
225 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
229 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
230 if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
231 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
234 $parameters = array();
235 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object, $action);
236 $sql .= $hookmanager->resPrint;
237 if (
$object->ismultientitymanaged == 1) {
238 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
240 $sql .=
" WHERE 1 = 1";
242 foreach ($search as $key => $val) {
243 if (array_key_exists($key,
$object->fields)) {
244 if ($key ==
'status' && $search[$key] == -1) {
248 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
249 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
254 if ($search[$key] !=
'') {
255 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
258 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
259 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
260 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
261 if (preg_match(
'/_dtstart$/', $key)) {
262 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
264 if (preg_match(
'/_dtend$/', $key)) {
265 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
276 if (!empty($searchCategoryProductList)) {
277 $searchCategoryProductSqlList = array();
278 $listofcategoryid =
'';
279 foreach ($searchCategoryProductList as $searchCategoryProduct) {
280 if (intval($searchCategoryProduct) == -2) {
281 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product)";
282 } elseif (intval($searchCategoryProduct) > 0) {
283 if ($searchCategoryProductOperator == 0) {
284 $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).
")";
286 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
290 if ($listofcategoryid) {
291 $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).
"))";
293 if ($searchCategoryProductOperator == 1) {
294 if (!empty($searchCategoryProductSqlList)) {
295 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
298 if (!empty($searchCategoryProductSqlList)) {
299 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
304 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
306 $parameters = array();
307 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
308 $sql .= $hookmanager->resPrint;
329 $nbtotalofrecords =
'';
332 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
333 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
334 $resql = $db->query($sqlforcount);
336 $objforcount = $db->fetch_object($resql);
337 $nbtotalofrecords = $objforcount->nbtotalofrecords;
342 if (($page * $limit) > $nbtotalofrecords) {
350 $sql .= $db->order($sortfield, $sortorder);
352 $sql .= $db->plimit($limit + 1, $offset);
355 $resql = $db->query(
$sql);
361 $num = $db->num_rows($resql);
364 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
365 $obj = $db->fetch_object($resql);
367 header(
"Location: ".DOL_URL_ROOT.
'/inventory/card.php?id='.$id);
375 llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
377 $arrayofselected = is_array($toselect) ? $toselect : array();
381 $param .=
'&mode='.urlencode($mode);
383 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
384 $param .=
'&contextpage='.urlencode($contextpage);
386 if ($limit > 0 && $limit != $conf->liste_limit) {
387 $param .=
'&limit='.((int) $limit);
389 foreach ($search as $key => $val) {
390 if (is_array($search[$key])) {
391 foreach ($search[$key] as $skey) {
393 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
396 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
397 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
398 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
399 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
400 } elseif ($search[$key] !=
'') {
401 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
404 if ($optioncss !=
'') {
405 $param .=
'&optioncss='.urlencode($optioncss);
407 foreach ($searchCategoryProductList as $searchCategoryProduct) {
408 $param .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
411 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
413 $parameters = array(
'param' => &$param);
414 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
415 $param .= $hookmanager->resPrint;
418 $arrayofmassactions = array(
424 if (!empty($permissiontodelete)) {
425 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
427 if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
428 $arrayofmassactions = array();
430 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
432 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
433 if ($optioncss !=
'') {
434 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
436 print
'<input type="hidden" name="token" value="'.newToken().
'">';
437 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
438 print
'<input type="hidden" name="action" value="list">';
439 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
440 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
441 print
'<input type="hidden" name="page" value="'.$page.
'">';
442 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
443 print
'<input type="hidden" name="page_y" value="">';
444 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
447 $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'));
448 $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'));
450 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/inventory/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
452 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
455 $topicmail =
"Information";
456 $modelmail =
"inventory";
458 $trackid =
'stockinv'.$object->id;
459 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
463 foreach ($fieldstosearchall as $key => $val) {
464 $fieldstosearchall[$key] = $langs->trans($val);
465 $setupstring .= $key.
"=".$val.
";";
467 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
468 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
479 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList,
'minwidth300', $searchCategoryProductList ? $searchCategoryProductList : 0);
493 $parameters = array();
494 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
495 if (empty($reshook)) {
496 $moreforfilter .= $hookmanager->resPrint;
498 $moreforfilter = $hookmanager->resPrint;
501 if (!empty($moreforfilter)) {
502 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
503 print $moreforfilter;
504 $parameters = array();
505 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
506 print $hookmanager->resPrint;
510 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
511 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
512 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
513 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
515 print
'<div class="div-table-responsive">';
516 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
521 print
'<tr class="liste_titre_filter">';
524 print
'<td class="liste_titre center maxwidthsearch">';
525 $searchpicto = $form->showFilterButtons(
'left');
529 foreach (
$object->fields as $key => $val) {
530 $searchkey = empty($search[$key]) ?
'' : $search[$key];
531 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
532 if ($key ==
'status') {
533 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
534 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
535 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
536 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
537 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
538 } 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'])) {
539 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
541 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
542 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
543 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
544 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);
545 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
546 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
547 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
548 print
'<div class="nowrap">';
549 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
551 print
'<div class="nowrap">';
552 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
554 } elseif ($key ==
'lang') {
555 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
557 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
559 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
565 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
568 $parameters = array(
'arrayfields'=>$arrayfields);
569 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
570 print $hookmanager->resPrint;
573 print
'<td class="liste_titre center maxwidthsearch">';
574 $searchpicto = $form->showFilterButtons();
580 $totalarray = array();
581 $totalarray[
'nbfield'] = 0;
585 print
'<tr class="liste_titre">';
588 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
589 $totalarray[
'nbfield']++;
591 foreach (
$object->fields as $key => $val) {
592 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
593 if ($key ==
'status') {
594 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
595 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
596 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
597 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
598 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
599 } 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'])) {
600 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
602 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
603 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
604 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";
605 $totalarray[
'nbfield']++;
609 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
611 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
612 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
613 print $hookmanager->resPrint;
616 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
617 $totalarray[
'nbfield']++;
623 $needToFetchEachLine = 0;
624 if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
625 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
626 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
627 $needToFetchEachLine++;
635 $savnbfield = $totalarray[
'nbfield'];
636 $totalarray = array();
637 $totalarray[
'nbfield'] = 0;
638 $imaxinloop = ($limit ? min($num, $limit) : $num);
639 while ($i < $imaxinloop) {
640 $obj = $db->fetch_object($resql);
646 $object->setVarsFromFetchObj($obj);
648 if ($mode ==
'kanban') {
650 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
651 print
'<div class="box-flex-container kanban">';
655 if ($massactionbutton || $massaction) {
657 if (in_array(
$object->id, $arrayofselected)) {
661 print
$object->getKanbanView(
'', array(
'selected' => $selected));
662 if ($i == ($imaxinloop - 1)) {
669 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
672 print
'<td class="nowrap center">';
673 if ($massactionbutton || $massaction) {
675 if (in_array(
$object->id, $arrayofselected)) {
678 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
682 $totalarray[
'nbfield']++;
685 foreach (
$object->fields as $key => $val) {
686 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
687 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
688 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
689 } elseif ($key ==
'status') {
690 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
693 if (in_array($val[
'type'], array(
'timestamp'))) {
694 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
695 } elseif ($key ==
'ref') {
696 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
699 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
700 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
703 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
704 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
705 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric(
$object->$key)) {
706 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
709 if ($key ==
'status') {
710 print
$object->getLibStatut(5);
711 } elseif ($key ==
'rowid') {
718 $totalarray[
'nbfield']++;
720 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
722 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
724 if (!isset($totalarray[
'val'])) {
725 $totalarray[
'val'] = array();
727 if (!isset($totalarray[
'val'][
't.'.$key])) {
728 $totalarray[
'val'][
't.'.$key] = 0;
730 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
735 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
737 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>
$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
738 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
739 print $hookmanager->resPrint;
742 print
'<td class="nowrap center">';
743 if ($massactionbutton || $massaction) {
745 if (in_array(
$object->id, $arrayofselected)) {
748 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
752 $totalarray[
'nbfield']++;
763 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
769 foreach ($arrayfields as $key => $val) {
770 if (!empty($val[
'checked'])) {
774 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
780 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
781 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
782 print $hookmanager->resPrint;
784 print
'</table>'.
"\n";
787 print
'</form>'.
"\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()
Empty header.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
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...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.