25require
'../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';
33require_once __DIR__.
'/class/mo.class.php';
39$langs->loadLangs(array(
"mrp",
"other"));
41$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
42$massaction =
GETPOST(
'massaction',
'alpha');
43$show_files =
GETPOST(
'show_files',
'int');
44$confirm =
GETPOST(
'confirm',
'alpha');
45$cancel =
GETPOST(
'cancel',
'alpha');
46$toselect =
GETPOST(
'toselect',
'array');
47$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'molist';
48$backtopage =
GETPOST(
'backtopage',
'alpha');
49$optioncss =
GETPOST(
'optioncss',
'aZ');
50$mode =
GETPOST(
'mode',
'alpha');
55$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
56$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
57$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
58$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
59if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
63$offset = $limit * $page;
72$diroutputmassaction = $conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
73$hookmanager->initHooks(array(
'molist'));
76$extrafields->fetch_name_optionals_label($object->table_element);
78$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
89$search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
91foreach ($object->fields as $key => $val) {
92 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
93 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
95 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
96 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
97 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
102$fieldstosearchall = array();
103foreach ($object->fields as $key => $val) {
104 if (!empty($val[
'searchall'])) {
105 $fieldstosearchall[
't.'.$key] = $val[
'label'];
110$arrayfields = array();
111foreach ($object->fields as $key => $val) {
113 if (!empty($val[
'visible'])) {
114 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
115 $arrayfields[
't.'.$key] = array(
116 'label'=>$val[
'label'],
117 'checked'=>(($visible < 0) ? 0 : 1),
118 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
119 'position'=>$val[
'position'],
120 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
124 if ($key ==
'fk_parent_line') {
125 $visible = (int)
dol_eval($val[
'visible'], 1);
126 $arrayfields[
't.'.$key] = array(
127 'label'=>$val[
'label'],
128 'checked'=>(($visible <= 0) ? 0 : 1),
129 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1)),
130 'position'=>$val[
'position'],
131 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
136include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
141$permissiontoread = $user->rights->mrp->read;
142$permissiontoadd = $user->rights->mrp->write;
143$permissiontodelete = $user->rights->mrp->delete;
146if ($user->socid > 0) {
157if (
GETPOST(
'cancel',
'alpha')) {
161if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
165$parameters = array();
166$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
171if (empty($reshook)) {
173 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
176 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
177 foreach ($object->fields as $key => $val) {
179 if ($key ==
'status') {
182 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
183 $search[$key.
'_dtstart'] =
'';
184 $search[$key.
'_dtend'] =
'';
188 $search_array_options = array();
190 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
191 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
198 $uploaddir = $conf->mrp->dir_output;
199 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
208$form =
new Form($db);
214$title = $langs->trans(
'ListOfManufacturingOrders');
222$sql .= $object->getFieldList(
't');
224if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
225 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
226 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
230$parameters = array();
231$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
232$sql .= $hookmanager->resPrint;
233$sql = preg_replace(
'/,\s*$/',
'', $sql);
237$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
238if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
239 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
241$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mrp_production as lineparent ON t.fk_parent_line = lineparent.rowid";
242$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mrp_mo as moparent ON lineparent.fk_mo = moparent.rowid";
243$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON t.fk_product = p.rowid";
245$parameters = array();
246$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
247$sql .= $hookmanager->resPrint;
248if ($object->ismultientitymanaged == 1) {
249 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
251 $sql .=
" WHERE 1 = 1";
254foreach ($search as $key => $val) {
255 if (array_key_exists($key, $object->fields)) {
256 if ($key ==
'status' && $search[$key] == -1) {
259 if ($key ==
'fk_parent_line' && $search[$key] !=
'') {
264 if ($key ==
'status') {
270 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
271 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
272 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
277 if ($search[$key] !=
'') {
278 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
281 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
282 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
283 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
284 if (preg_match(
'/_dtstart$/', $key)) {
285 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
287 if (preg_match(
'/_dtend$/', $key)) {
288 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
295 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
299include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
301$parameters = array();
302$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
303$sql .= $hookmanager->resPrint;
324$nbtotalofrecords =
'';
327 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
328 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
329 $resql = $db->query($sqlforcount);
331 $objforcount = $db->fetch_object($resql);
332 $nbtotalofrecords = $objforcount->nbtotalofrecords;
337 if (($page * $limit) > $nbtotalofrecords) {
345$sql .= $db->order($sortfield, $sortorder);
347 $sql .= $db->plimit($limit + 1, $offset);
350$resql = $db->query($sql);
356$num = $db->num_rows($resql);
359if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
360 $obj = $db->fetch_object($resql);
362 header(
"Location: ".
dol_buildpath(
'/mrp/mo_card.php', 1).
'?id='.$id);
370llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'');
373$arrayofselected = is_array($toselect) ? $toselect : array();
377 $param .=
'&mode='.urlencode($mode);
379if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
380 $param .=
'&contextpage='.urlencode($contextpage);
382if ($limit > 0 && $limit != $conf->liste_limit) {
383 $param .=
'&limit='.((int) $limit);
385foreach ($search as $key => $val) {
386 if (is_array($search[$key]) && count($search[$key])) {
387 foreach ($search[$key] as $skey) {
389 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
392 } elseif ($search[$key] !=
'') {
393 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
396if ($optioncss !=
'') {
397 $param .=
'&optioncss='.urlencode($optioncss);
400include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
402$parameters = array();
403$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
404$param .= $hookmanager->resPrint;
407$arrayofmassactions = array(
413if ($permissiontodelete) {
414 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
416if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
417 $arrayofmassactions = array();
419$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
421print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
422if ($optioncss !=
'') {
423 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
425print
'<input type="hidden" name="token" value="'.newToken().
'">';
426print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
427print
'<input type="hidden" name="action" value="list">';
428print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
429print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
430print
'<input type="hidden" name="page" value="'.$page.
'">';
431print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
432print
'<input type="hidden" name="mode" value="'.$mode.
'">';
435$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'));
436$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'));
437$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
439print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
442$topicmail =
"SendMoRef";
444$objecttmp =
new Mo($db);
445$trackid =
'mo'.$object->id;
446include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
449 foreach ($fieldstosearchall as $key => $val) {
450 $fieldstosearchall[$key] = $langs->trans($val);
452 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
460$parameters = array();
461$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
462if (empty($reshook)) {
463 $moreforfilter .= $hookmanager->resPrint;
465 $moreforfilter = $hookmanager->resPrint;
468if (!empty($moreforfilter)) {
469 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
470 print $moreforfilter;
474$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
475$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
476$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
478print
'<div class="div-table-responsive">';
479print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
484print
'<tr class="liste_titre">';
487 print
'<td class="liste_titre maxwidthsearch">';
488 $searchpicto = $form->showFilterButtons(
'left');
492foreach ($object->fields as $key => $val) {
493 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
494 if ($key ==
'status') {
495 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
496 } elseif ($key ==
'fk_parent_line') {
497 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
498 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
499 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
500 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
501 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
502 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
503 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
505 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
506 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
507 if ($key ==
'fk_parent_line') {
508 print
'<input type="text" class="flat maxwidth75" name="search_fk_parent_line">';
512 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
513 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
514 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
515 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
516 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
517 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
518 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
519 print
'<div class="nowrap">';
520 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
522 print
'<div class="nowrap">';
523 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
530include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
533$parameters = array(
'arrayfields'=>$arrayfields);
534$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
535print $hookmanager->resPrint;
538 print
'<td class="liste_titre maxwidthsearch">';
539 $searchpicto = $form->showFilterButtons();
545$totalarray = array();
546$totalarray[
'nbfield'] = 0;
551print
'<tr class="liste_titre">';
554 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
555 $totalarray[
'nbfield']++;
557foreach ($object->fields as $key => $val) {
558 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
559 if ($key ==
'status') {
560 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
561 } elseif ($key ==
'fk_parent_line') {
562 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
563 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
564 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
565 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
566 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
567 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
568 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
570 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
571 if ($key ==
"fk_product") {
572 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
'p.ref',
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
574 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
576 $totalarray[
'nbfield']++;
580include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
582$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
583$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
584print $hookmanager->resPrint;
587 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
588 $totalarray[
'nbfield']++;
594$needToFetchEachLine = 0;
595if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
596 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
597 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
598 $needToFetchEachLine++;
610$savnbfield = $totalarray[
'nbfield'];
611$totalarray = array();
612$totalarray[
'nbfield'] = 0;
613$imaxinloop = ($limit ? min($num, $limit) : $num);
614while ($i < $imaxinloop) {
615 $obj = $db->fetch_object($resql);
621 $object->setVarsFromFetchObj($obj);
624 if ($mode ==
'kanban') {
626 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
627 print
'<div class="box-flex-container kanban">';
629 $object->id = $obj->type_id;
632 if ($obj->fk_bom > 0) {
633 $bom->fetch($obj->fk_bom);
635 if ($obj->fk_product > 0) {
636 $product->fetch($obj->fk_product);
640 print $object->getKanbanView(
'', array(
'bom'=>($obj->fk_bom > 0 ? $bom : null),
'product'=>($obj->fk_product > 0 ? $product: null),
'selected' => in_array($object->id, $arrayofselected)));
641 if ($i == ($imaxinloop - 1)) {
647 print
'<tr class="oddeven">';
650 print
'<td class="nowrap center">';
651 if ($massactionbutton || $massaction) {
653 if (in_array($object->id, $arrayofselected)) {
656 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
660 foreach ($object->fields as $key => $val) {
661 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
662 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
663 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
664 } elseif ($key ==
'status') {
665 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
666 } elseif ($key ==
'fk_parent_line') {
667 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
670 if (in_array($val[
'type'], array(
'timestamp'))) {
671 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
672 } elseif ($key ==
'ref') {
673 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
676 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
677 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
680 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
681 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
682 if ($key ==
'status') {
683 print $object->getLibStatut(5);
684 } elseif ($key ==
'fk_parent_line') {
685 $moparent = $object->getMoParent();
686 if (is_object($moparent)) print $moparent->getNomUrl(1);
687 } elseif ($key ==
'rowid') {
688 print $object->showOutputField($val, $key, $object->id,
'');
690 print $object->showOutputField($val, $key, $object->$key,
'');
694 $totalarray[
'nbfield']++;
696 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
698 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
700 if (!isset($totalarray[
'val'])) {
701 $totalarray[
'val'] = array();
703 if (!isset($totalarray[
'val'][
't.'.$key])) {
704 $totalarray[
'val'][
't.'.$key] = 0;
706 $totalarray[
'val'][
't.'.$key] += $object->$key;
711 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
713 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
714 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
715 print $hookmanager->resPrint;
718 print
'<td class="nowrap center">';
719 if ($massactionbutton || $massaction) {
721 if (in_array($object->id, $arrayofselected)) {
724 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
729 $totalarray[
'nbfield']++;
738include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
744 foreach ($arrayfields as $key => $val) {
745 if (!empty($val[
'checked'])) {
749 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
755$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
756$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
757print $hookmanager->resPrint;
759print
'</table>'.
"\n";
764if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
765 $hidegeneratedfilelistifempty = 1;
766 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
767 $hidegeneratedfilelistifempty = 0;
770 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
774 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
775 $urlsource .= str_replace(
'&',
'&', $param);
777 $filedir = $diroutputmassaction;
778 $genallowed = $permissiontoread;
779 $delallowed = $permissiontoadd;
781 print $formfile->showdocuments(
'massfilesarea_mrp',
'', $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...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.