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';
42$langs->loadLangs(array(
"mrp",
"other"));
45$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
46$massaction =
GETPOST(
'massaction',
'alpha');
48$confirm =
GETPOST(
'confirm',
'alpha');
49$cancel =
GETPOST(
'cancel',
'alpha');
50$toselect =
GETPOST(
'toselect',
'array');
51$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
52$backtopage =
GETPOST(
'backtopage',
'alpha');
53$optioncss =
GETPOST(
'optioncss',
'aZ');
54$mode =
GETPOST(
'mode',
'alpha');
60$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
63if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
67$offset = $limit * $page;
76$diroutputmassaction = $conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
77$hookmanager->initHooks(array($contextpage));
80$extrafields->fetch_name_optionals_label(
$object->table_element);
82$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
93$search_all = trim(
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
95foreach (
$object->fields as $key => $val) {
96 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
97 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
99 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
106$fieldstosearchall = array();
107foreach (
$object->fields as $key => $val) {
108 if (!empty($val[
'searchall'])) {
109 $fieldstosearchall[
't.'.$key] = $val[
'label'];
114$arrayfields = array();
115foreach (
$object->fields as $key => $val) {
117 if (!empty($val[
'visible'])) {
118 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
119 $arrayfields[
't.'.$key] = array(
120 'label'=>$val[
'label'],
121 'checked'=>(($visible < 0) ? 0 : 1),
122 'enabled'=>(abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
123 'position'=>$val[
'position'],
124 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
128 if ($key ==
'fk_parent_line') {
129 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
130 $arrayfields[
't.'.$key] = array(
131 'label'=>$val[
'label'],
132 'checked'=>(($visible <= 0) ? 0 : 1),
133 'enabled'=>(abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
134 'position'=>$val[
'position'],
135 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
140include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
145$permissiontoread = $user->hasRight(
'mrp',
'read');
146$permissiontoadd = $user->hasRight(
'mrp',
'write');
147$permissiontodelete = $user->hasRight(
'mrp',
'delete');
150if ($user->socid > 0) {
160if (
GETPOST(
'cancel',
'alpha')) {
164if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
168$parameters = array();
169$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
174if (empty($reshook)) {
176 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
179 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
180 foreach (
$object->fields as $key => $val) {
182 if ($key ==
'status') {
185 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
186 $search[$key.
'_dtstart'] =
'';
187 $search[$key.
'_dtend'] =
'';
192 $search_array_options = array();
194 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
195 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
202 $uploaddir = $conf->mrp->dir_output;
203 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
212$form =
new Form($db);
216$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
217$title = $langs->trans(
'ListOfManufacturingOrders');
225$sql .=
$object->getFieldList(
't');
227if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
228 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
229 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
233$parameters = array();
234$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
235$sql .= $hookmanager->resPrint;
236$sql = preg_replace(
'/,\s*$/',
'', $sql);
240$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
241if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
242 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
244$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mrp_production as lineparent ON t.fk_parent_line = lineparent.rowid";
245$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mrp_mo as moparent ON lineparent.fk_mo = moparent.rowid";
246$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON t.fk_product = p.rowid";
248$parameters = array();
249$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
250$sql .= $hookmanager->resPrint;
251if (
$object->ismultientitymanaged == 1) {
252 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
254 $sql .=
" WHERE 1 = 1";
257foreach ($search as $key => $val) {
258 if (array_key_exists($key,
$object->fields)) {
259 if ($key ==
'status' && $search[$key] == -1) {
262 if ($key ==
'fk_parent_line' && $search[$key] !=
'') {
267 if ($key ==
'status') {
274 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
275 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
280 if ($search[$key] !=
'') {
281 $sql .=
natural_search(
"t.".$db->sanitize($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
284 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
285 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
286 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
287 if (preg_match(
'/_dtstart$/', $key)) {
288 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
290 if (preg_match(
'/_dtend$/', $key)) {
291 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
298 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
302include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
304$parameters = array();
305$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
306$sql .= $hookmanager->resPrint;
327$nbtotalofrecords =
'';
330 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
331 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
332 $resql = $db->query($sqlforcount);
334 $objforcount = $db->fetch_object($resql);
335 $nbtotalofrecords = $objforcount->nbtotalofrecords;
340 if (($page * $limit) > $nbtotalofrecords) {
348$sql .= $db->order($sortfield, $sortorder);
350 $sql .= $db->plimit($limit + 1, $offset);
353$resql = $db->query($sql);
359$num = $db->num_rows($resql);
362if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
363 $obj = $db->fetch_object($resql);
365 header(
"Location: ".
dol_buildpath(
'/mrp/mo_card.php', 1).
'?id='.((
int) $id));
373llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-mrp page-list');
376$arrayofselected = is_array($toselect) ? $toselect : array();
380 $param .=
'&mode='.urlencode($mode);
382if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
383 $param .=
'&contextpage='.urlencode($contextpage);
385if ($limit > 0 && $limit != $conf->liste_limit) {
386 $param .=
'&limit='.((int) $limit);
388if ($optioncss !=
'') {
389 $param .=
'&optioncss='.urlencode($optioncss);
391foreach ($search as $key => $val) {
392 if (is_array($search[$key])) {
393 foreach ($search[$key] as $skey) {
395 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
398 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
399 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
400 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
401 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
402 } elseif ($search[$key] !=
'') {
403 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
407include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
409$parameters = array(
'param' => &$param);
410$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
411$param .= $hookmanager->resPrint;
414$arrayofmassactions = array(
420if (!empty($permissiontodelete)) {
421 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
423if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
424 $arrayofmassactions = array();
426$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
428print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
429if ($optioncss !=
'') {
430 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
432print
'<input type="hidden" name="token" value="'.newToken().
'">';
433print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
434print
'<input type="hidden" name="action" value="list">';
435print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
436print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
437print
'<input type="hidden" name="page" value="'.$page.
'">';
438print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
439print
'<input type="hidden" name="page_y" value="">';
440print
'<input type="hidden" name="mode" value="'.$mode.
'">';
443$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'));
444$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'));
446$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
448print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
451$topicmail =
"SendMoRef";
453$objecttmp =
new Mo($db);
454$trackid =
'mo'.$object->id;
455include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
458 foreach ($fieldstosearchall as $key => $val) {
459 $fieldstosearchall[$key] = $langs->trans($val);
461 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
469$parameters = array();
470$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
471if (empty($reshook)) {
472 $moreforfilter .= $hookmanager->resPrint;
474 $moreforfilter = $hookmanager->resPrint;
477if (!empty($moreforfilter)) {
478 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
479 print $moreforfilter;
483$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
484$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
485$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
486$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
488print
'<div class="div-table-responsive">';
489print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
494print
'<tr class="liste_titre_filter">';
497 print
'<td class="liste_titre center maxwidthsearch">';
498 $searchpicto = $form->showFilterButtons(
'left');
502foreach (
$object->fields as $key => $val) {
503 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
504 if ($key ==
'status') {
505 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
506 } elseif ($key ==
'fk_parent_line') {
507 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
508 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
509 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
510 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
511 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
512 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
513 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
515 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
516 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
517 if ($key ==
'fk_parent_line') {
518 print
'<input type="text" class="flat maxwidth75" name="search_fk_parent_line">';
522 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
523 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
524 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
525 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
526 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
527 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
528 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
529 print
'<div class="nowrap">';
530 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
532 print
'<div class="nowrap">';
533 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
540include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
543$parameters = array(
'arrayfields'=>$arrayfields);
544$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
545print $hookmanager->resPrint;
548 print
'<td class="liste_titre center maxwidthsearch">';
549 $searchpicto = $form->showFilterButtons();
555$totalarray = array();
556$totalarray[
'nbfield'] = 0;
561print
'<tr class="liste_titre">';
564 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
565 $totalarray[
'nbfield']++;
567foreach (
$object->fields as $key => $val) {
568 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
569 if ($key ==
'status') {
570 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
571 } elseif ($key ==
'fk_parent_line') {
572 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
573 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
574 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
575 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
576 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
577 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
578 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
580 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
581 if ($key ==
"fk_product") {
582 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
'p.ref',
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
584 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
586 $totalarray[
'nbfield']++;
590include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
592$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
593$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
594print $hookmanager->resPrint;
597 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
598 $totalarray[
'nbfield']++;
604$needToFetchEachLine = 0;
605if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
606 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
607 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
608 $needToFetchEachLine++;
620$savnbfield = $totalarray[
'nbfield'];
621$totalarray = array();
622$totalarray[
'nbfield'] = 0;
623$imaxinloop = ($limit ? min($num, $limit) : $num);
624while ($i < $imaxinloop) {
625 $obj = $db->fetch_object($resql);
631 $object->setVarsFromFetchObj($obj);
634 if ($mode ==
'kanban') {
636 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
637 print
'<div class="box-flex-container kanban">';
642 if ($obj->fk_bom > 0) {
643 $bom->fetch($obj->fk_bom);
645 if ($obj->fk_product > 0) {
646 $product->fetch($obj->fk_product);
651 if ($massactionbutton || $massaction) {
653 if (in_array(
$object->id, $arrayofselected)) {
657 print
$object->getKanbanView(
'', array(
'bom'=>($obj->fk_bom > 0 ? $bom : null),
'product'=>($obj->fk_product > 0 ? $product : null),
'selected' => $selected));
658 if ($i == ($imaxinloop - 1)) {
665 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
669 print
'<td class="nowrap center">';
670 if ($massactionbutton || $massaction) {
672 if (in_array(
$object->id, $arrayofselected)) {
675 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
679 $totalarray[
'nbfield']++;
683 foreach (
$object->fields as $key => $val) {
684 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
685 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
686 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
687 } elseif ($key ==
'status') {
688 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
689 } elseif ($key ==
'fk_parent_line') {
690 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
693 if (in_array($val[
'type'], array(
'timestamp'))) {
694 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
695 } elseif ($key ==
'ref') {
696 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
699 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'])) {
700 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
703 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
704 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
705 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
706 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
709 if ($key ==
'status') {
710 print
$object->getLibStatut(5);
711 } elseif ($key ==
'fk_parent_line') {
712 $moparent =
$object->getMoParent();
713 if (is_object($moparent)) {
714 print $moparent->getNomUrl(1);
716 } elseif ($key ==
'rowid') {
723 $totalarray[
'nbfield']++;
725 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
727 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
729 if (!isset($totalarray[
'val'])) {
730 $totalarray[
'val'] = array();
732 if (!isset($totalarray[
'val'][
't.'.$key])) {
733 $totalarray[
'val'][
't.'.$key] = 0;
735 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
740 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
742 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
743 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
744 print $hookmanager->resPrint;
748 print
'<td class="nowrap center">';
749 if ($massactionbutton || $massaction) {
751 if (in_array(
$object->id, $arrayofselected)) {
754 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
758 $totalarray[
'nbfield']++;
768include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
774 foreach ($arrayfields as $key => $val) {
775 if (!empty($val[
'checked'])) {
779 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
785$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
786$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
787print $hookmanager->resPrint;
789print
'</table>'.
"\n";
794if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
795 $hidegeneratedfilelistifempty = 1;
796 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
797 $hidegeneratedfilelistifempty = 0;
800 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
804 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
805 $urlsource .= str_replace(
'&',
'&', $param);
807 $filedir = $diroutputmassaction;
808 $genallowed = $permissiontoread;
809 $delallowed = $permissiontoadd;
811 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...
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.