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';
30require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
33$langs->loadLangs(array(
'mrp',
'other'));
37$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
38$massaction =
GETPOST(
'massaction',
'alpha');
39$show_files =
GETPOST(
'show_files',
'int');
40$confirm =
GETPOST(
'confirm',
'alpha');
41$cancel =
GETPOST(
'cancel',
'alpha');
42$toselect =
GETPOST(
'toselect',
'array');
43$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bomlist';
44$backtopage =
GETPOST(
'backtopage',
'alpha');
45$optioncss =
GETPOST(
'optioncss',
'aZ');
50$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
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;
65$object =
new BOM($db);
67$diroutputmassaction = $conf->bom->dir_output.
'/temp/massgeneration/'.$user->id;
68$hookmanager->initHooks(array(
'bomlist'));
71$extrafields->fetch_name_optionals_label($object->table_element);
73$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
77 reset($object->fields);
78 $sortfield =
"t.".key($object->fields);
85$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
87foreach ($object->fields as $key => $val) {
88 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
89 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
91 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
92 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
93 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
97$fieldstosearchall = array();
99foreach ($object->fields as $key => $val) {
100 if (!empty($val[
'searchall'])) {
101 $fieldstosearchall[
't.'.$key] = $val[
'label'];
106$arrayfields = array();
107foreach ($object->fields as $key => $val) {
109 if (!empty($val[
'visible'])) {
110 $visible = (int)
dol_eval($val[
'visible'], 1);
111 $arrayfields[
't.'.$key] = array(
112 'label'=>$val[
'label'],
113 'checked'=>(($visible < 0) ? 0 : 1),
114 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
115 'position'=>$val[
'position'],
116 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
121include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
126$permissiontoread = $user->hasRight(
'bom',
'read');
127$permissiontoadd = $user->hasRight(
'bom',
'write');
128$permissiontodelete = $user->hasRight(
'bom',
'delete');
131if ($user->socid > 0) {
142if (
GETPOST(
'cancel',
'alpha')) {
146if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
150$parameters = array();
151$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
156if (empty($reshook)) {
158 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
161 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
162 foreach ($object->fields as $key => $val) {
164 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
165 $search[$key.
'_dtstart'] =
'';
166 $search[$key.
'_dtend'] =
'';
170 $search_array_options = array();
172 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
173 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
178 $objectclass =
'BOM';
179 $objectlabel =
'BillOfMaterials';
180 $permissiontoread = $user->hasRight(
'bom',
'read');
181 $permissiontodelete = $user->hasRight(
'bom',
'delete');
182 $uploaddir = $conf->bom->dir_output;
183 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
187 if (!$error && $massaction ==
'disable' && $permissiontoadd) {
188 $objecttmp =
new $objectclass($db);
194 foreach ($toselect as $toselectid) {
195 $result = $objecttmp->fetch($toselectid);
197 if ($objecttmp->status != $objecttmp::STATUS_VALIDATED) {
198 $langs->load(
"errors");
199 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusActiveToBeDisabled", $objecttmp->ref),
null,
'errors');
205 $result = $objecttmp->cancel($user);
235 if (!$error && $massaction ==
'enable' && $permissiontoadd) {
236 $objecttmp =
new $objectclass($db);
242 foreach ($toselect as $toselectid) {
243 $result = $objecttmp->fetch($toselectid);
245 if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED) {
246 $langs->load(
"errors");
247 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated", $objecttmp->ref),
null,
'errors');
253 $result = $objecttmp->validate($user);
288$form =
new Form($db);
292$title = $langs->trans(
'ListOfBOMs');
293$help_url =
'EN:Module_BOM';
301$sql .= $object->getFieldList(
't');
303if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
304 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
305 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
309$parameters = array();
310$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
311$sql .= $hookmanager->resPrint;
312$sql = preg_replace(
'/,\s*$/',
'', $sql);
316$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
317if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
318 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
321$parameters = array();
322$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
323$sql .= $hookmanager->resPrint;
324if ($object->ismultientitymanaged == 1) {
325 $sql .=
" WHERE t.entity IN (".getEntity($object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
327 $sql .=
" WHERE 1 = 1";
329foreach ($search as $key => $val) {
330 if (array_key_exists($key, $object->fields)) {
331 if ($key ==
'status' && $search[$key] == -1) {
334 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
335 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
336 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
341 if ($search[$key] !=
'') {
342 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
345 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
346 $columnName=preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
347 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
348 if (preg_match(
'/_dtstart$/', $key)) {
349 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
351 if (preg_match(
'/_dtend$/', $key)) {
352 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
360 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
364include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
366$parameters = array();
367$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
368$sql .= $hookmanager->resPrint;
389$nbtotalofrecords =
'';
392 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
393 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
394 $resql = $db->query($sqlforcount);
396 $objforcount = $db->fetch_object($resql);
397 $nbtotalofrecords = $objforcount->nbtotalofrecords;
402 if (($page * $limit) > $nbtotalofrecords) {
410$sql .= $db->order($sortfield, $sortorder);
412 $sql .= $db->plimit($limit + 1, $offset);
415$resql = $db->query($sql);
421$num = $db->num_rows($resql);
424if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
425 $obj = $db->fetch_object($resql);
427 header(
"Location: ".DOL_URL_ROOT.
'/bom/bom_card.php?id='.((
int) $id));
435llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-bom page-list bodyforlist');
437$arrayofselected = is_array($toselect) ? $toselect : array();
441 $param .=
'&mode='.urlencode($mode);
443if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
444 $param .=
'&contextpage='.urlencode($contextpage);
446if ($limit > 0 && $limit != $conf->liste_limit) {
447 $param .=
'&limit='.((int) $limit);
449if ($optioncss !=
'') {
450 $param .=
'&optioncss='.urlencode($optioncss);
452foreach ($search as $key => $val) {
453 if (is_array($search[$key])) {
454 foreach ($search[$key] as $skey) {
456 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
459 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
460 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
461 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
462 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
463 } elseif ($search[$key] !=
'') {
464 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
468include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
470$parameters = array(
'param' => &$param);
471$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
472$param .= $hookmanager->resPrint;
475$arrayofmassactions = array(
477 'enable'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Enable"),
478 'disable'=>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Disable"),
480if (!empty($permissiontodelete)) {
481 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
483if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
484 $arrayofmassactions = array();
486$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
488print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
489if ($optioncss !=
'') {
490 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
492print
'<input type="hidden" name="token" value="'.newToken().
'">';
493print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
494print
'<input type="hidden" name="action" value="list">';
495print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
496print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
497print
'<input type="hidden" name="page" value="'.$page.
'">';
498print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
499print
'<input type="hidden" name="page_y" value="">';
500print
'<input type="hidden" name="mode" value="'.$mode.
'">';
503$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'));
504$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'));
506$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $user->hasRight(
'bom',
'write'));
508print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
511$topicmail =
"SendBillOfMaterialsRef";
513$objecttmp =
new BOM($db);
514$trackid =
'bom'.$object->id;
515include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
519 foreach ($fieldstosearchall as $key => $val) {
520 $fieldstosearchall[$key] = $langs->trans($val);
521 $setupstring .= $key.
"=".$val.
";";
523 print
'<!-- Search done like if BOM_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
524 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
532$parameters = array();
533$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
534if (empty($reshook)) {
535 $moreforfilter .= $hookmanager->resPrint;
537 $moreforfilter = $hookmanager->resPrint;
540if (!empty($moreforfilter)) {
541 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
542 print $moreforfilter;
543 $parameters = array();
544 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
545 print $hookmanager->resPrint;
549$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
550$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
551$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
553print
'<div class="div-table-responsive">';
554print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
559print
'<tr class="liste_titre_filter">';
563 print
'<td class="liste_titre center maxwidthsearch">';
564 $searchpicto = $form->showFilterButtons(
'left');
569foreach ($object->fields as $key => $val) {
570 $searchkey = empty($search[$key]) ?
'' : $search[$key];
571 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
572 if ($key ==
'status') {
573 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
574 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
575 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
576 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
577 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
578 } 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'])) {
579 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
581 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
582 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
583 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
584 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
585 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
586 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
587 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
588 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
589 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
590 print
'<div class="nowrap">';
591 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
593 print
'<div class="nowrap">';
594 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
596 } elseif ($key ==
'lang') {
597 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
599 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
601 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
607include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
610$parameters = array(
'arrayfields'=>$arrayfields);
611$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
612print $hookmanager->resPrint;
615 print
'<td class="liste_titre center maxwidthsearch">';
616 $searchpicto = $form->showFilterButtons();
622$totalarray = array();
623$totalarray[
'nbfield'] = 0;
627print
'<tr class="liste_titre">';
630 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
631 $totalarray[
'nbfield']++;
633foreach ($object->fields as $key => $val) {
634 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
635 if ($key ==
'status') {
636 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
637 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
638 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
639 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
640 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
641 } 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'])) {
642 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
644 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
645 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
646 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";
647 $totalarray[
'nbfield']++;
651include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
653$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
654$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
655print $hookmanager->resPrint;
658 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
659 $totalarray[
'nbfield']++;
665$needToFetchEachLine = 0;
666if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
667 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
668 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
669 $needToFetchEachLine++;
678$savnbfield = $totalarray[
'nbfield'];
679$totalarray = array();
680$totalarray[
'nbfield'] = 0;
681$imaxinloop = ($limit ? min($num, $limit) : $num);
682while ($i < $imaxinloop) {
683 $obj = $db->fetch_object($resql);
689 $object->setVarsFromFetchObj($obj);
692 if ($mode ==
'kanban') {
694 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
695 print
'<div class="box-flex-container kanban">';
699 if (!empty($obj->fk_product)) {
701 $prod->fetch($obj->fk_product);
708 if ($massactionbutton || $massaction) {
710 if (in_array($object->id, $arrayofselected)) {
714 print $object->getKanbanView(
'', array(
'prod'=>$prod,
'selected' => $selected));
715 if ($i == ($imaxinloop - 1)) {
722 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
725 print
'<td class="nowrap center">';
726 if ($massactionbutton || $massaction) {
728 if (in_array($object->id, $arrayofselected)) {
731 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
735 $totalarray[
'nbfield']++;
738 foreach ($object->fields as $key => $val) {
739 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
740 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
741 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
742 } elseif ($key ==
'status') {
743 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
746 if (in_array($val[
'type'], array(
'timestamp'))) {
747 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
748 } elseif ($key ==
'ref') {
749 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
752 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && empty($val[
'arrayofkeyval'])) {
753 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
756 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
757 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
758 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric($object->$key)) {
759 print
' title="'.dol_escape_htmltag($object->$key).
'"';
762 if ($key ==
'status') {
763 print $object->getLibStatut(5);
764 } elseif ($key ==
'rowid') {
765 print $object->showOutputField($val, $key, $object->id,
'');
767 print $object->showOutputField($val, $key, $object->$key,
'');
771 $totalarray[
'nbfield']++;
773 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
775 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
777 if (!isset($totalarray[
'val'])) {
778 $totalarray[
'val'] = array();
780 if (!isset($totalarray[
'val'][
't.'.$key])) {
781 $totalarray[
'val'][
't.'.$key] = 0;
783 $totalarray[
'val'][
't.'.$key] += $object->$key;
788 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
790 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
791 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
792 print $hookmanager->resPrint;
795 print
'<td class="nowrap center">';
796 if ($massactionbutton || $massaction) {
798 if (in_array($object->id, $arrayofselected)) {
801 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
805 $totalarray[
'nbfield']++;
816include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
822 foreach ($arrayfields as $key => $val) {
823 if (!empty($val[
'checked'])) {
827 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
833$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
834$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
835print $hookmanager->resPrint;
837print
'</table>'.
"\n";
843if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
844 $hidegeneratedfilelistifempty = 1;
845 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
846 $hidegeneratedfilelistifempty = 0;
849 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
853 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
854 $urlsource .= str_replace(
'&',
'&', $param);
856 $filedir = $diroutputmassaction;
857 $genallowed = $permissiontoread;
858 $delallowed = $permissiontoadd;
860 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.
Class to manage products or services.
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...
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.