25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
29 require_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');
53 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
56 $offset = $limit * $page;
57 $pageprev = $page - 1;
58 $pagenext = $page + 1;
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 $sortfield =
"t.".key($object->fields);
82 $search_all =
GETPOST(
"search_all",
'alpha');
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'])) {
89 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
90 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
95 $fieldstosearchall = array();
96 foreach ($object->fields as $key => $val) {
97 if (!empty($val[
'searchall'])) {
98 $fieldstosearchall[
't.'.$key] = $val[
'label'];
103 $arrayfields = array();
104 foreach ($object->fields as $key => $val) {
106 if (!empty($val[
'visible'])) {
107 $visible = (int)
dol_eval($val[
'visible'], 1);
108 $arrayfields[
't.'.$key] = array(
109 'label'=>$val[
'label'],
110 'checked'=>(($visible < 0) ? 0 : 1),
111 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
112 'position'=>$val[
'position'],
113 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
118 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
123 $permissiontoread = $user->rights->bom->read;
124 $permissiontoadd = $user->rights->bom->write;
125 $permissiontodelete = $user->rights->bom->delete;
128 if ($user->socid > 0) {
139 if (
GETPOST(
'cancel',
'alpha')) {
143 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
147 $parameters = array();
148 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
153 if (empty($reshook)) {
155 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
158 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
159 foreach ($object->fields as $key => $val) {
161 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
162 $search[$key.
'_dtstart'] =
'';
163 $search[$key.
'_dtend'] =
'';
167 $search_array_options = array();
169 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
170 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
175 $objectclass =
'BOM';
176 $objectlabel =
'BillOfMaterials';
177 $permissiontoread = $user->rights->bom->read;
178 $permissiontodelete = $user->rights->bom->delete;
179 $uploaddir = $conf->bom->dir_output;
180 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
184 if (!$error && $massaction ==
'disable' && $permissiontoadd) {
185 $objecttmp =
new $objectclass($db);
191 foreach ($toselect as $toselectid) {
192 $result = $objecttmp->fetch($toselectid);
194 if ($objecttmp->status != $objecttmp::STATUS_VALIDATED) {
195 $langs->load(
"errors");
196 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusActiveToBeDisabled", $objecttmp->ref),
null,
'errors');
202 $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);
290 $title = $langs->trans(
'ListOfBOMs');
298 $sql .= $object->getFieldList(
't');
300 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
301 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
302 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key.
' ' :
'');
306 $parameters = array();
307 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
308 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
309 $sql = preg_replace(
'/,\s*$/',
'', $sql);
313 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
314 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
315 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
318 $parameters = array();
319 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
320 $sql .= $hookmanager->resPrint;
321 if ($object->ismultientitymanaged == 1) {
322 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
324 $sql .=
" WHERE 1 = 1";
326 foreach ($search as $key => $val) {
327 if (array_key_exists($key, $object->fields)) {
328 if ($key ==
'status' && $search[$key] == -1) {
331 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
332 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
333 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
338 if ($search[$key] !=
'') {
339 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
342 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
343 $columnName=preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
344 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
345 if (preg_match(
'/_dtstart$/', $key)) {
346 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
348 if (preg_match(
'/_dtend$/', $key)) {
349 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
357 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
361 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
363 $parameters = array();
364 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
365 $sql .= $hookmanager->resPrint;
388 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
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);
408 $sql .= $db->order($sortfield, $sortorder);
410 $sql .= $db->plimit($limit + 1, $offset);
413 $resql = $db->query($sql);
419 $num = $db->num_rows(
$resql);
422 if ($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);
435 $arrayofselected = is_array($toselect) ? $toselect : array();
439 $param .=
'&mode='.urlencode($mode);
441 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
442 $param .=
'&contextpage='.urlencode($contextpage);
444 if ($limit > 0 && $limit != $conf->liste_limit) {
445 $param .=
'&limit='.urlencode($limit);
447 foreach ($search as $key => $val) {
448 if (is_array($search[$key]) && count($search[$key])) {
449 foreach ($search[$key] as $skey) {
450 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
453 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
456 if ($optioncss !=
'') {
457 $param .=
'&optioncss='.urlencode($optioncss);
460 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
462 $parameters = array();
463 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
464 $param .= $hookmanager->resPrint;
467 $arrayofmassactions = array(
469 'enable'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Enable"),
470 'disable'=>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Disable"),
472 if ($permissiontodelete) {
473 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
475 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
476 $arrayofmassactions = array();
478 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
480 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
481 if ($optioncss !=
'') {
482 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
484 print
'<input type="hidden" name="token" value="'.newToken().
'">';
485 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
486 print
'<input type="hidden" name="action" value="list">';
487 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
488 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
489 print
'<input type="hidden" name="page" value="'.$page.
'">';
490 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
491 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
493 $newcardbutton .=
'';
494 $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'));
495 $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'));
496 $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);
498 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
501 $topicmail =
"SendBillOfMaterialsRef";
503 $objecttmp =
new BOM($db);
504 $trackid =
'bom'.$object->id;
505 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
508 foreach ($fieldstosearchall as $key => $val) {
509 $fieldstosearchall[$key] = $langs->trans($val);
511 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
519 $parameters = array();
520 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
521 if (empty($reshook)) {
522 $moreforfilter .= $hookmanager->resPrint;
524 $moreforfilter = $hookmanager->resPrint;
527 if (!empty($moreforfilter)) {
528 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
529 print $moreforfilter;
533 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
534 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
535 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
537 print
'<div class="div-table-responsive">';
538 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
543 print
'<tr class="liste_titre">';
547 print
'<td class="liste_titre center">';
548 $searchpicto =
$form->showFilterButtons(
'left');
553 foreach ($object->fields as $key => $val) {
554 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
555 if ($key ==
'status') {
556 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
557 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
558 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
559 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
560 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
561 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
562 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
564 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
565 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
566 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
567 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status onrightofpage' :
''), 1);
568 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
569 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
570 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
571 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
572 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
573 print
'<div class="nowrap">';
574 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
576 print
'<div class="nowrap">';
577 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
584 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
587 $parameters = array(
'arrayfields'=>$arrayfields);
588 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
589 print $hookmanager->resPrint;
592 print
'<td class="liste_titre center">';
593 $searchpicto =
$form->showFilterButtons();
602 print
'<tr class="liste_titre">';
605 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
607 foreach ($object->fields as $key => $val) {
608 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
609 if ($key ==
'status') {
610 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
611 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
612 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
613 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
614 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
615 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
616 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
618 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
619 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
623 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
625 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
626 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
627 print $hookmanager->resPrint;
630 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
636 $needToFetchEachLine = 0;
637 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
638 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
639 if (preg_match(
'/\$object/', $val)) {
640 $needToFetchEachLine++;
649 $totalarray = array();
650 $totalarray[
'nbfield'] = 0;
651 while ($i < ($limit ? min($num, $limit) : $num)) {
652 $obj = $db->fetch_object(
$resql);
658 $object->setVarsFromFetchObj($obj);
661 if ($mode ==
'kanban') {
663 print
'<tr><td colspan="12">';
664 print
'<div class="box-flex-container">';
667 print $object->getKanbanView(
'');
670 if ($i == min($num, $limit)-1) {
676 print
'<tr class="oddeven">';
679 print
'<td class="nowrap center">';
680 if ($massactionbutton || $massaction) {
682 if (in_array($object->id, $arrayofselected)) {
685 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
689 foreach ($object->fields as $key => $val) {
690 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
691 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
692 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
693 } elseif ($key ==
'status') {
694 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
697 if (in_array($val[
'type'], array(
'timestamp'))) {
698 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
699 } elseif ($key ==
'ref') {
700 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
703 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
704 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
707 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
708 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
709 if ($key ==
'status') {
710 print $object->getLibStatut(5);
711 } elseif ($key ==
'rowid') {
712 print $object->showOutputField($val, $key, $object->id,
'');
714 print $object->showOutputField($val, $key, $object->$key,
'');
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);
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"' :
'').
'>';
753 $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.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
780 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
781 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
782 print $hookmanager->resPrint;
784 print
'</table>'.
"\n";
787 print
'</form>'.
"\n";
791 $hidegeneratedfilelistifempty = 1;
792 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
793 $hidegeneratedfilelistifempty = 0;
796 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
800 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
801 $urlsource .= str_replace(
'&',
'&', $param);
803 $filedir = $diroutputmassaction;
804 $genallowed = $permissiontoread;
805 $delallowed = $permissiontoadd;
807 print $formfile->showdocuments(
'massfilesarea_bom',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_now($mode='auto')
Return date for now.
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.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
$nbtotalofrecords
Count total nb of records.
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.