26require
'../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34$langs->loadLangs(array(
'mrp',
'other'));
38$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
39$massaction =
GETPOST(
'massaction',
'alpha');
41$confirm =
GETPOST(
'confirm',
'alpha');
42$cancel =
GETPOST(
'cancel',
'alpha');
43$toselect =
GETPOST(
'toselect',
'array');
44$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bomlist';
45$backtopage =
GETPOST(
'backtopage',
'alpha');
46$optioncss =
GETPOST(
'optioncss',
'aZ');
52$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
53$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
55if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
59$offset = $limit * $page;
68$diroutputmassaction = $conf->bom->dir_output.
'/temp/massgeneration/'.$user->id;
69$hookmanager->initHooks(array(
'bomlist'));
72$extrafields->fetch_name_optionals_label(
$object->table_element);
74$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
79 $sortfield =
"t.".key(
$object->fields);
86$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
88foreach (
$object->fields as $key => $val) {
89 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
90 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
92 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
98$fieldstosearchall = array();
100foreach (
$object->fields as $key => $val) {
101 if (!empty($val[
'searchall'])) {
102 $fieldstosearchall[
't.'.$key] = $val[
'label'];
107$arrayfields = array();
108foreach (
$object->fields as $key => $val) {
110 if (!empty($val[
'visible'])) {
111 $visible = (int)
dol_eval($val[
'visible'], 1);
112 $arrayfields[
't.'.$key] = array(
113 'label' => $val[
'label'],
114 'checked' => (($visible < 0) ? 0 : 1),
115 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
116 'position' => $val[
'position'],
117 'help' => isset($val[
'help']) ? $val[
'help'] :
''
122include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
127$permissiontoread = $user->hasRight(
'bom',
'read');
128$permissiontoadd = $user->hasRight(
'bom',
'write');
129$permissiontodelete = $user->hasRight(
'bom',
'delete');
132if ($user->socid > 0) {
143if (
GETPOST(
'cancel',
'alpha')) {
147if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
151$parameters = array();
152$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
157if (empty($reshook)) {
159 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
162 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
163 foreach (
$object->fields as $key => $val) {
165 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
166 $search[$key.
'_dtstart'] =
'';
167 $search[$key.
'_dtend'] =
'';
171 $search_array_options = array();
173 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
174 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
179 $objectclass =
'BOM';
180 $objectlabel =
'BillOfMaterials';
181 $permissiontoread = $user->hasRight(
'bom',
'read');
182 $permissiontodelete = $user->hasRight(
'bom',
'delete');
183 $uploaddir = $conf->bom->dir_output;
184 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
188 if (!$error && $massaction ==
'disable' && $permissiontoadd) {
189 $objecttmp =
new $objectclass($db);
195 foreach ($toselect as $toselectid) {
196 $result = $objecttmp->fetch($toselectid);
198 if ($objecttmp->status != $objecttmp::STATUS_VALIDATED) {
199 $langs->load(
"errors");
200 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusActiveToBeDisabled", $objecttmp->ref),
null,
'errors');
206 $result = $objecttmp->cancel($user);
232 if (!$error && $massaction ==
'enable' && $permissiontoadd) {
233 $objecttmp =
new $objectclass($db);
239 foreach ($toselect as $toselectid) {
240 $result = $objecttmp->fetch($toselectid);
242 if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED) {
243 $langs->load(
"errors");
244 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated", $objecttmp->ref),
null,
'errors');
250 $result = $objecttmp->validate($user);
281$form =
new Form($db);
285$title = $langs->trans(
'ListOfBOMs');
286$help_url =
'EN:Module_BOM';
294$sql .=
$object->getFieldList(
't');
296if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
297 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
298 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
302$parameters = array();
303$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
304$sql .= $hookmanager->resPrint;
305$sql = preg_replace(
'/,\s*$/',
'', $sql);
309$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
310if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
311 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
314$parameters = array();
315$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
316$sql .= $hookmanager->resPrint;
317if (
$object->ismultientitymanaged == 1) {
318 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
320 $sql .=
" WHERE 1 = 1";
322foreach ($search as $key => $val) {
323 if (array_key_exists($key,
$object->fields)) {
324 if ($key ==
'status' && $search[$key] == -1) {
328 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
329 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
334 if ($search[$key] !=
'') {
335 $sql .=
natural_search(
"t.".$db->sanitize($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
338 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
339 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
340 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
341 if (preg_match(
'/_dtstart$/', $key)) {
342 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
344 if (preg_match(
'/_dtend$/', $key)) {
345 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
353 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
357include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
359$parameters = array();
360$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
361$sql .= $hookmanager->resPrint;
382$nbtotalofrecords =
'';
385 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
386 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
387 $resql = $db->query($sqlforcount);
389 $objforcount = $db->fetch_object($resql);
390 $nbtotalofrecords = $objforcount->nbtotalofrecords;
395 if (($page * $limit) > $nbtotalofrecords) {
403$sql .= $db->order($sortfield, $sortorder);
405 $sql .= $db->plimit($limit + 1, $offset);
408$resql = $db->query($sql);
414$num = $db->num_rows($resql);
417if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
418 $obj = $db->fetch_object($resql);
420 header(
"Location: ".DOL_URL_ROOT.
'/bom/bom_card.php?id='.((
int) $id));
428llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-bom page-list bodyforlist');
430$arrayofselected = is_array($toselect) ? $toselect : array();
434 $param .=
'&mode='.urlencode($mode);
436if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
437 $param .=
'&contextpage='.urlencode($contextpage);
439if ($limit > 0 && $limit != $conf->liste_limit) {
440 $param .=
'&limit='.((int) $limit);
442if ($optioncss !=
'') {
443 $param .=
'&optioncss='.urlencode($optioncss);
445foreach ($search as $key => $val) {
446 if (is_array($search[$key])) {
447 foreach ($search[$key] as $skey) {
449 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
452 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
453 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
454 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
455 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
456 } elseif ($search[$key] !=
'') {
457 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
461include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
463$parameters = array(
'param' => &$param);
464$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
465$param .= $hookmanager->resPrint;
468$arrayofmassactions = array(
470 'enable' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Enable"),
471 'disable' =>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Disable"),
473if (!empty($permissiontodelete)) {
474 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
476if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
477 $arrayofmassactions = array();
479$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
481print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
482if ($optioncss !=
'') {
483 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
485print
'<input type="hidden" name="token" value="'.newToken().
'">';
486print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
487print
'<input type="hidden" name="action" value="list">';
488print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
489print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
490print
'<input type="hidden" name="page" value="'.$page.
'">';
491print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
492print
'<input type="hidden" name="page_y" value="">';
493print
'<input type="hidden" name="mode" value="'.$mode.
'">';
496$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'));
497$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'));
499$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'));
501print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
504$topicmail =
"SendBillOfMaterialsRef";
506$objecttmp =
new BOM($db);
507$trackid =
'bom'.$object->id;
508include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
512 foreach ($fieldstosearchall as $key => $val) {
513 $fieldstosearchall[$key] = $langs->trans($val);
514 $setupstring .= $key.
"=".$val.
";";
516 print
'<!-- Search done like if BOM_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
517 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
525$parameters = array();
526$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
527if (empty($reshook)) {
528 $moreforfilter .= $hookmanager->resPrint;
530 $moreforfilter = $hookmanager->resPrint;
533if (!empty($moreforfilter)) {
534 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
535 print $moreforfilter;
539$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
540$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
541$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
542$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
544print
'<div class="div-table-responsive">';
545print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
550print
'<tr class="liste_titre_filter">';
554 print
'<td class="liste_titre center maxwidthsearch">';
555 $searchpicto = $form->showFilterButtons(
'left');
560foreach (
$object->fields as $key => $val) {
561 $searchkey = empty($search[$key]) ?
'' : $search[$key];
562 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
563 if ($key ==
'status') {
564 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
565 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
566 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
567 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
568 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
569 } 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'])) {
570 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
572 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
573 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
574 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
575 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);
576 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
577 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
578 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
579 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
580 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
581 print
'<div class="nowrap">';
582 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
584 print
'<div class="nowrap">';
585 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
587 } elseif ($key ==
'lang') {
588 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
590 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
592 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
598include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
601$parameters = array(
'arrayfields' => $arrayfields);
602$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
603print $hookmanager->resPrint;
606 print
'<td class="liste_titre center maxwidthsearch">';
607 $searchpicto = $form->showFilterButtons();
613$totalarray = array();
614$totalarray[
'nbfield'] = 0;
618print
'<tr class="liste_titre">';
621 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
622 $totalarray[
'nbfield']++;
624foreach (
$object->fields as $key => $val) {
625 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
626 if ($key ==
'status') {
627 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
628 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
629 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
630 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
631 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
632 } 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'])) {
633 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
635 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
636 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
637 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";
638 $totalarray[
'nbfield']++;
642include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
644$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
645$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
646print $hookmanager->resPrint;
649 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
650 $totalarray[
'nbfield']++;
656$needToFetchEachLine = 0;
657if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
658 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
659 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
660 $needToFetchEachLine++;
669$savnbfield = $totalarray[
'nbfield'];
670$totalarray = array();
671$totalarray[
'nbfield'] = 0;
672$imaxinloop = ($limit ? min($num, $limit) : $num);
673while ($i < $imaxinloop) {
674 $obj = $db->fetch_object($resql);
680 $object->setVarsFromFetchObj($obj);
683 if ($mode ==
'kanban') {
685 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
686 print
'<div class="box-flex-container kanban">';
690 if (!empty($obj->fk_product)) {
692 $prod->fetch($obj->fk_product);
699 if ($massactionbutton || $massaction) {
701 if (in_array(
$object->id, $arrayofselected)) {
705 print
$object->getKanbanView(
'', array(
'prod' => $prod,
'selected' => $selected));
706 if ($i == ($imaxinloop - 1)) {
713 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
716 print
'<td class="nowrap center">';
717 if ($massactionbutton || $massaction) {
719 if (in_array(
$object->id, $arrayofselected)) {
722 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
726 $totalarray[
'nbfield']++;
729 foreach (
$object->fields as $key => $val) {
730 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
731 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
732 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
733 } elseif ($key ==
'status') {
734 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
737 if (in_array($val[
'type'], array(
'timestamp'))) {
738 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
739 } elseif ($key ==
'ref') {
740 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
743 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'])) {
744 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
747 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
748 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
749 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
750 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
753 if ($key ==
'status') {
754 print
$object->getLibStatut(5);
755 } elseif ($key ==
'rowid') {
762 $totalarray[
'nbfield']++;
764 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
766 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
768 if (!isset($totalarray[
'val'])) {
769 $totalarray[
'val'] = array();
771 if (!isset($totalarray[
'val'][
't.'.$key])) {
772 $totalarray[
'val'][
't.'.$key] = 0;
774 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
779 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
781 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
782 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
783 print $hookmanager->resPrint;
786 print
'<td class="nowrap center">';
787 if ($massactionbutton || $massaction) {
789 if (in_array(
$object->id, $arrayofselected)) {
792 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
796 $totalarray[
'nbfield']++;
807include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
813 foreach ($arrayfields as $key => $val) {
814 if (!empty($val[
'checked'])) {
818 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
824$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
825$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
826print $hookmanager->resPrint;
828print
'</table>'.
"\n";
834if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
835 $hidegeneratedfilelistifempty = 1;
836 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
837 $hidegeneratedfilelistifempty = 0;
840 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
844 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
845 $urlsource .= str_replace(
'&',
'&', $param);
847 $filedir = $diroutputmassaction;
848 $genallowed = $permissiontoread;
849 $delallowed = $permissiontoadd;
851 print $formfile->showdocuments(
'massfilesarea_bom',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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.
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 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...
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.