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.
'/bom/class/bom.class.php';
32$langs->loadLangs(array(
'mrp',
'other'));
36$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
37$massaction =
GETPOST(
'massaction',
'alpha');
38$show_files =
GETPOST(
'show_files',
'int');
39$confirm =
GETPOST(
'confirm',
'alpha');
40$cancel =
GETPOST(
'cancel',
'alpha');
41$toselect =
GETPOST(
'toselect',
'array');
42$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bomlist';
43$backtopage =
GETPOST(
'backtopage',
'alpha');
44$optioncss =
GETPOST(
'optioncss',
'aZ');
45$mode =
GETPOST(
'mode',
'alpha');
49$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
50$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
51$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
'page',
'int');
53if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
56$offset = $limit * $page;
63$object =
new BOM($db);
65$diroutputmassaction = $conf->bom->dir_output.
'/temp/massgeneration/'.$user->id;
66$hookmanager->initHooks(array(
'bomlist'));
69$extrafields->fetch_name_optionals_label($object->table_element);
71$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
75 reset($object->fields);
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'])) {
90 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
91 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
96$fieldstosearchall = array();
97foreach ($object->fields as $key => $val) {
98 if (!empty($val[
'searchall'])) {
99 $fieldstosearchall[
't.'.$key] = $val[
'label'];
104$arrayfields = array();
105foreach ($object->fields as $key => $val) {
107 if (!empty($val[
'visible'])) {
108 $visible = (int)
dol_eval($val[
'visible'], 1);
109 $arrayfields[
't.'.$key] = array(
110 'label'=>$val[
'label'],
111 'checked'=>(($visible < 0) ? 0 : 1),
112 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
113 'position'=>$val[
'position'],
114 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
119include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
124$permissiontoread = $user->hasRight(
'bom',
'read');
125$permissiontoadd = $user->hasRight(
'bom',
'write');
126$permissiontodelete = $user->hasRight(
'bom',
'delete');
129if ($user->socid > 0) {
140if (
GETPOST(
'cancel',
'alpha')) {
144if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
148$parameters = array();
149$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
154if (empty($reshook)) {
156 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
159 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
160 foreach ($object->fields as $key => $val) {
162 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
163 $search[$key.
'_dtstart'] =
'';
164 $search[$key.
'_dtend'] =
'';
168 $search_array_options = array();
170 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
171 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
176 $objectclass =
'BOM';
177 $objectlabel =
'BillOfMaterials';
178 $permissiontoread = $user->hasRight(
'bom',
'read');
179 $permissiontodelete = $user->hasRight(
'bom',
'delete');
180 $uploaddir = $conf->bom->dir_output;
181 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
185 if (!$error && $massaction ==
'disable' && $permissiontoadd) {
186 $objecttmp =
new $objectclass($db);
192 foreach ($toselect as $toselectid) {
193 $result = $objecttmp->fetch($toselectid);
195 if ($objecttmp->status != $objecttmp::STATUS_VALIDATED) {
196 $langs->load(
"errors");
197 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusActiveToBeDisabled", $objecttmp->ref),
null,
'errors');
203 $result = $objecttmp->cancel($user);
233 if (!$error && $massaction ==
'enable' && $permissiontoadd) {
234 $objecttmp =
new $objectclass($db);
240 foreach ($toselect as $toselectid) {
241 $result = $objecttmp->fetch($toselectid);
243 if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED) {
244 $langs->load(
"errors");
245 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated", $objecttmp->ref),
null,
'errors');
251 $result = $objecttmp->validate($user);
286$form =
new Form($db);
290$help_url =
'EN:Module_BOM';
291$title = $langs->trans(
'ListOfBOMs');
299$sql .= $object->getFieldList(
't');
301if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
302 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
303 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
307$parameters = array();
308$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
309$sql .= $hookmanager->resPrint;
310$sql = preg_replace(
'/,\s*$/',
'', $sql);
314$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
315if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
316 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
319$parameters = array();
320$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
321$sql .= $hookmanager->resPrint;
322if ($object->ismultientitymanaged == 1) {
323 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
325 $sql .=
" WHERE 1 = 1";
327foreach ($search as $key => $val) {
328 if (array_key_exists($key, $object->fields)) {
329 if ($key ==
'status' && $search[$key] == -1) {
332 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
333 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
334 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
339 if ($search[$key] !=
'') {
340 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
343 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
344 $columnName=preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
345 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
346 if (preg_match(
'/_dtstart$/', $key)) {
347 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
349 if (preg_match(
'/_dtend$/', $key)) {
350 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
358 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
362include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
364$parameters = array();
365$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
366$sql .= $hookmanager->resPrint;
387$nbtotalofrecords =
'';
390 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
391 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
392 $resql = $db->query($sqlforcount);
394 $objforcount = $db->fetch_object($resql);
395 $nbtotalofrecords = $objforcount->nbtotalofrecords;
400 if (($page * $limit) > $nbtotalofrecords) {
408$sql .= $db->order($sortfield, $sortorder);
410 $sql .= $db->plimit($limit + 1, $offset);
413$resql = $db->query($sql);
419$num = $db->num_rows($resql);
422if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
423 $obj = $db->fetch_object($resql);
425 header(
"Location: ".DOL_URL_ROOT.
'/bom/bom_card.php?id='.$id);
433llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'');
435$arrayofselected = is_array($toselect) ? $toselect : array();
439 $param .=
'&mode='.urlencode($mode);
441if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
442 $param .=
'&contextpage='.urlencode($contextpage);
444if ($limit > 0 && $limit != $conf->liste_limit) {
445 $param .=
'&limit='.((int) $limit);
447foreach ($search as $key => $val) {
448 if (is_array($search[$key])) {
449 foreach ($search[$key] as $skey) {
451 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
454 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
455 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
456 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
457 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
458 } elseif ($search[$key] !=
'') {
459 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
462if ($optioncss !=
'') {
463 $param .=
'&optioncss='.urlencode($optioncss);
466include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
468$parameters = array();
469$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
470$param .= $hookmanager->resPrint;
473$arrayofmassactions = array(
475 'enable'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Enable"),
476 'disable'=>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Disable"),
478if (!empty($permissiontodelete)) {
479 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
481if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
482 $arrayofmassactions = array();
484$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
486print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
487if ($optioncss !=
'') {
488 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
490print
'<input type="hidden" name="token" value="'.newToken().
'">';
491print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
492print
'<input type="hidden" name="action" value="list">';
493print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
494print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
495print
'<input type="hidden" name="page" value="'.$page.
'">';
496print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
497print
'<input type="hidden" name="page_y" value="">';
498print
'<input type="hidden" name="mode" value="'.$mode.
'">';
501$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'));
502$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'));
503$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $user->rights->bom->write);
505print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
508$topicmail =
"SendBillOfMaterialsRef";
510$objecttmp =
new BOM($db);
511$trackid =
'bom'.$object->id;
512include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
516 foreach ($fieldstosearchall as $key => $val) {
517 $fieldstosearchall[$key] = $langs->trans($val);
518 $setupstring .= $key.
"=".$val.
";";
520 print
'<!-- Search done like if BOM_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
521 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
529$parameters = array();
530$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
531if (empty($reshook)) {
532 $moreforfilter .= $hookmanager->resPrint;
534 $moreforfilter = $hookmanager->resPrint;
537if (!empty($moreforfilter)) {
538 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
539 print $moreforfilter;
543$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
544$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
545$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
547print
'<div class="div-table-responsive">';
548print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
553print
'<tr class="liste_titre">';
557 print
'<td class="liste_titre maxwidthsearch">';
558 $searchpicto = $form->showFilterButtons(
'left');
563foreach ($object->fields as $key => $val) {
564 $searchkey = empty($search[$key]) ?
'' : $search[$key];
565 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
566 if ($key ==
'status') {
567 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
568 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
569 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
570 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
571 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
572 } 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'])) {
573 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
575 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
576 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
577 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
578 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);
579 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
580 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
581 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
582 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
583 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
584 print
'<div class="nowrap">';
585 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
587 print
'<div class="nowrap">';
588 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
590 } elseif ($key ==
'lang') {
591 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
593 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
595 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
601include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
604$parameters = array(
'arrayfields'=>$arrayfields);
605$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
606print $hookmanager->resPrint;
609 print
'<td class="liste_titre maxwidthsearch">';
610 $searchpicto = $form->showFilterButtons();
616$totalarray = array();
617$totalarray[
'nbfield'] = 0;
621print
'<tr class="liste_titre">';
624 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
626foreach ($object->fields as $key => $val) {
627 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
628 if ($key ==
'status') {
629 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
630 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
631 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
632 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
633 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
634 } 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'])) {
635 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
637 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
638 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
639 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
640 $totalarray[
'nbfield']++;
644include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
646$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
647$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
648print $hookmanager->resPrint;
651 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
653$totalarray[
'nbfield']++;
658$needToFetchEachLine = 0;
659if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
660 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
661 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
662 $needToFetchEachLine++;
671$savnbfield = $totalarray[
'nbfield'];
672$totalarray = array();
673$totalarray[
'nbfield'] = 0;
674$imaxinloop = ($limit ? min($num, $limit) : $num);
675while ($i < $imaxinloop) {
676 $obj = $db->fetch_object($resql);
682 $object->setVarsFromFetchObj($obj);
685 if ($mode ==
'kanban') {
687 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
688 print
'<div class="box-flex-container kanban">';
691 print $object->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected)));
692 if ($i == ($imaxinloop - 1)) {
699 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
702 print
'<td class="nowrap center">';
703 if ($massactionbutton || $massaction) {
705 if (in_array($object->id, $arrayofselected)) {
708 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
712 foreach ($object->fields as $key => $val) {
713 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
714 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
715 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
716 } elseif ($key ==
'status') {
717 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
720 if (in_array($val[
'type'], array(
'timestamp'))) {
721 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
722 } elseif ($key ==
'ref') {
723 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
726 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
727 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
730 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
731 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
732 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
733 print
' title="'.dol_escape_htmltag($object->$key).
'"';
736 if ($key ==
'status') {
737 print $object->getLibStatut(5);
738 } elseif ($key ==
'rowid') {
739 print $object->showOutputField($val, $key, $object->id,
'');
741 print $object->showOutputField($val, $key, $object->$key,
'');
745 $totalarray[
'nbfield']++;
747 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
749 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
751 if (!isset($totalarray[
'val'])) {
752 $totalarray[
'val'] = array();
754 if (!isset($totalarray[
'val'][
't.'.$key])) {
755 $totalarray[
'val'][
't.'.$key] = 0;
757 $totalarray[
'val'][
't.'.$key] += $object->$key;
762 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
764 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
765 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
766 print $hookmanager->resPrint;
769 print
'<td class="nowrap center">';
770 if ($massactionbutton || $massaction) {
772 if (in_array($object->id, $arrayofselected)) {
775 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
780 $totalarray[
'nbfield']++;
790include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
796 foreach ($arrayfields as $key => $val) {
797 if (!empty($val[
'checked'])) {
801 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
807$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
808$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
809print $hookmanager->resPrint;
811print
'</table>'.
"\n";
817if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
818 $hidegeneratedfilelistifempty = 1;
819 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
820 $hidegeneratedfilelistifempty = 0;
823 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
827 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
828 $urlsource .= str_replace(
'&',
'&', $param);
830 $filedir = $diroutputmassaction;
831 $genallowed = $permissiontoread;
832 $delallowed = $permissiontoadd;
834 print $formfile->showdocuments(
'massfilesarea_bom',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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 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.
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.