27require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
36require_once __DIR__.
'/class/mo.class.php';
47$langs->loadLangs(array(
"mrp",
"other"));
50$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
51$massaction =
GETPOST(
'massaction',
'alpha');
53$confirm =
GETPOST(
'confirm',
'alpha');
54$cancel =
GETPOST(
'cancel',
'alpha');
55$toselect =
GETPOST(
'toselect',
'array');
56$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
57$backtopage =
GETPOST(
'backtopage',
'alpha');
58$optioncss =
GETPOST(
'optioncss',
'aZ');
59$mode =
GETPOST(
'mode',
'alpha');
65$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
66$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
72$offset = $limit * $page;
81$diroutputmassaction =
$conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
82$hookmanager->initHooks(array($contextpage));
85$extrafields->fetch_name_optionals_label(
$object->table_element);
87$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
98$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
100foreach (
$object->fields as $key => $val) {
101 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
102 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
104 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
111$fieldstosearchall = array();
112foreach (
$object->fields as $key => $val) {
113 if (!empty($val[
'searchall'])) {
114 $fieldstosearchall[
't.'.$key] = $val[
'label'];
119$arrayfields = array();
120foreach (
$object->fields as $key => $val) {
122 if (!empty($val[
'visible'])) {
123 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
124 $arrayfields[
't.'.$key] = array(
125 'label'=>$val[
'label'],
126 'checked'=>(($visible < 0) ? 0 : 1),
127 'enabled'=>(abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
128 'position'=>$val[
'position'],
129 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
133 if ($key ==
'fk_parent_line') {
134 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
135 $arrayfields[
't.'.$key] = array(
136 'label'=>$val[
'label'],
137 'checked'=>(($visible <= 0) ? 0 : 1),
138 'enabled'=>(abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
139 'position'=>$val[
'position'],
140 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
145include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
150$permissiontoread = $user->hasRight(
'mrp',
'read');
151$permissiontoadd = $user->hasRight(
'mrp',
'write');
152$permissiontodelete = $user->hasRight(
'mrp',
'delete');
155if ($user->socid > 0) {
165if (
GETPOST(
'cancel',
'alpha')) {
169if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
173$parameters = array();
174$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
179if (empty($reshook)) {
181 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
184 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
185 foreach (
$object->fields as $key => $val) {
187 if ($key ==
'status') {
190 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
191 $search[$key.
'_dtstart'] =
'';
192 $search[$key.
'_dtend'] =
'';
197 $search_array_options = array();
199 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
200 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
207 $uploaddir =
$conf->mrp->dir_output;
208 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
217$form =
new Form($db);
221$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
222$title = $langs->trans(
'ListOfManufacturingOrders');
230$sql .=
$object->getFieldList(
't');
232if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
233 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
234 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
238$parameters = array();
239$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
240$sql .= $hookmanager->resPrint;
241$sql = preg_replace(
'/,\s*$/',
'', $sql);
245$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
246if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
247 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
249$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mrp_production as lineparent ON t.fk_parent_line = lineparent.rowid";
250$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mrp_mo as moparent ON lineparent.fk_mo = moparent.rowid";
251$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON t.fk_product = p.rowid";
253$parameters = array();
254$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
255$sql .= $hookmanager->resPrint;
256if (
$object->ismultientitymanaged == 1) {
257 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
259 $sql .=
" WHERE 1 = 1";
262foreach ($search as $key => $val) {
263 if (array_key_exists($key,
$object->fields)) {
264 if ($key ==
'status' && $search[$key] == -1) {
267 if ($key ==
'fk_parent_line' && $search[$key] !=
'') {
272 if ($key ==
'status') {
279 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
280 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
285 if ($search[$key] !=
'') {
286 $sql .=
natural_search(
"t.".$db->sanitize($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
289 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
290 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
291 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
292 if (preg_match(
'/_dtstart$/', $key)) {
293 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
295 if (preg_match(
'/_dtend$/', $key)) {
296 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
303 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
307include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
309$parameters = array();
310$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
311$sql .= $hookmanager->resPrint;
332$nbtotalofrecords =
'';
335 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
336 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
337 $resql = $db->query($sqlforcount);
339 $objforcount = $db->fetch_object($resql);
340 $nbtotalofrecords = $objforcount->nbtotalofrecords;
345 if (($page * $limit) > $nbtotalofrecords) {
353$sql .= $db->order($sortfield, $sortorder);
355 $sql .= $db->plimit($limit + 1, $offset);
358$resql = $db->query($sql);
364$num = $db->num_rows($resql);
367if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
368 $obj = $db->fetch_object($resql);
370 header(
"Location: ".
dol_buildpath(
'/mrp/mo_card.php', 1).
'?id='.((
int) $id));
378llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-mrp page-list');
381$arrayofselected = is_array($toselect) ? $toselect : array();
385 $param .=
'&mode='.urlencode($mode);
387if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
388 $param .=
'&contextpage='.urlencode($contextpage);
390if ($limit > 0 && $limit !=
$conf->liste_limit) {
391 $param .=
'&limit='.((int) $limit);
393if ($optioncss !=
'') {
394 $param .=
'&optioncss='.urlencode($optioncss);
396foreach ($search as $key => $val) {
397 if (is_array($search[$key])) {
398 foreach ($search[$key] as $skey) {
400 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
403 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
404 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
405 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
406 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
407 } elseif ($search[$key] !=
'') {
408 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
412include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
414$parameters = array(
'param' => &$param);
415$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
416$param .= $hookmanager->resPrint;
419$arrayofmassactions = array(
425if (!empty($permissiontodelete)) {
426 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
428if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
429 $arrayofmassactions = array();
431$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
433print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
434if ($optioncss !=
'') {
435 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
437print
'<input type="hidden" name="token" value="'.newToken().
'">';
438print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
439print
'<input type="hidden" name="action" value="list">';
440print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
441print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
442print
'<input type="hidden" name="page" value="'.$page.
'">';
443print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
444print
'<input type="hidden" name="page_y" value="">';
445print
'<input type="hidden" name="mode" value="'.$mode.
'">';
448$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'));
449$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'));
451$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
453print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
456$topicmail =
"SendMoRef";
458$objecttmp =
new Mo($db);
459$trackid =
'mo'.$object->id;
460include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
463 foreach ($fieldstosearchall as $key => $val) {
464 $fieldstosearchall[$key] = $langs->trans($val);
466 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
474$parameters = array();
475$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
476if (empty($reshook)) {
477 $moreforfilter .= $hookmanager->resPrint;
479 $moreforfilter = $hookmanager->resPrint;
482if (!empty($moreforfilter)) {
483 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
484 print $moreforfilter;
488$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
489$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
490$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
491$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
493print
'<div class="div-table-responsive">';
494print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
499print
'<tr class="liste_titre_filter">';
502 print
'<td class="liste_titre center maxwidthsearch">';
503 $searchpicto = $form->showFilterButtons(
'left');
507foreach (
$object->fields as $key => $val) {
508 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
509 if ($key ==
'status') {
510 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
511 } elseif ($key ==
'fk_parent_line') {
512 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
513 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
514 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
515 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
516 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
517 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
518 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
520 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
521 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
522 if ($key ==
'fk_parent_line') {
523 print
'<input type="text" class="flat maxwidth75" name="search_fk_parent_line">';
527 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
528 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
529 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
530 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
531 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
532 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
533 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
534 print
'<div class="nowrap">';
535 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
537 print
'<div class="nowrap">';
538 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
545include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
548$parameters = array(
'arrayfields'=>$arrayfields);
549$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
550print $hookmanager->resPrint;
553 print
'<td class="liste_titre center maxwidthsearch">';
554 $searchpicto = $form->showFilterButtons();
560$totalarray = array();
561$totalarray[
'nbfield'] = 0;
566print
'<tr class="liste_titre">';
569 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
570 $totalarray[
'nbfield']++;
572foreach (
$object->fields as $key => $val) {
573 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
574 if ($key ==
'status') {
575 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
576 } elseif ($key ==
'fk_parent_line') {
577 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
578 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
579 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
580 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
581 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
582 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
583 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
585 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
586 if ($key ==
"fk_product") {
587 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
'p.ref',
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
589 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
591 $totalarray[
'nbfield']++;
595include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
597$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
598$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
599print $hookmanager->resPrint;
602 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
603 $totalarray[
'nbfield']++;
609$needToFetchEachLine = 0;
610if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
611 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
612 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
613 $needToFetchEachLine++;
625$savnbfield = $totalarray[
'nbfield'];
626$totalarray = array();
627$totalarray[
'nbfield'] = 0;
628$imaxinloop = ($limit ? min($num, $limit) : $num);
629while ($i < $imaxinloop) {
630 $obj = $db->fetch_object($resql);
636 $object->setVarsFromFetchObj($obj);
639 if ($mode ==
'kanban') {
641 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
642 print
'<div class="box-flex-container kanban">';
647 if ($obj->fk_bom > 0) {
648 $bom->fetch($obj->fk_bom);
650 if ($obj->fk_product > 0) {
651 $product->fetch($obj->fk_product);
656 if ($massactionbutton || $massaction) {
658 if (in_array(
$object->id, $arrayofselected)) {
662 print
$object->getKanbanView(
'', array(
'bom'=>($obj->fk_bom > 0 ? $bom : null),
'product'=>($obj->fk_product > 0 ? $product : null),
'selected' => $selected));
663 if ($i == ($imaxinloop - 1)) {
670 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
674 print
'<td class="nowrap center">';
675 if ($massactionbutton || $massaction) {
677 if (in_array(
$object->id, $arrayofselected)) {
680 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
684 $totalarray[
'nbfield']++;
688 foreach (
$object->fields as $key => $val) {
689 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
690 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
691 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
692 } elseif ($key ==
'status') {
693 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
694 } elseif ($key ==
'fk_parent_line') {
695 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
698 if (in_array($val[
'type'], array(
'timestamp'))) {
699 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
700 } elseif ($key ==
'ref') {
701 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
704 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'])) {
705 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
708 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
709 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
710 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
711 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
714 if ($key ==
'status') {
715 print
$object->getLibStatut(5);
716 } elseif ($key ==
'fk_parent_line') {
717 $moparent =
$object->getMoParent();
718 if (is_object($moparent)) {
719 print $moparent->getNomUrl(1);
721 } elseif ($key ==
'rowid') {
728 $totalarray[
'nbfield']++;
730 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
732 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
734 if (!isset($totalarray[
'val'])) {
735 $totalarray[
'val'] = array();
737 if (!isset($totalarray[
'val'][
't.'.$key])) {
738 $totalarray[
'val'][
't.'.$key] = 0;
740 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
745 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
747 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
748 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
749 print $hookmanager->resPrint;
753 print
'<td class="nowrap center">';
754 if ($massactionbutton || $massaction) {
756 if (in_array(
$object->id, $arrayofselected)) {
759 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
763 $totalarray[
'nbfield']++;
773include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
779 foreach ($arrayfields as $key => $val) {
780 if (!empty($val[
'checked'])) {
784 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
790$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
791$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
792print $hookmanager->resPrint;
794print
'</table>'.
"\n";
799if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
800 $hidegeneratedfilelistifempty = 1;
801 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
802 $hidegeneratedfilelistifempty = 0;
805 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
809 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
810 $urlsource .= str_replace(
'&',
'&', $param);
812 $filedir = $diroutputmassaction;
813 $genallowed = $permissiontoread;
814 $delallowed = $permissiontoadd;
816 print $formfile->showdocuments(
'massfilesarea_mrp',
'', $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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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 a 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.