34require
'../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
52$langs->loadLangs(array(
'products',
'stocks',
'productbatch',
'categories'));
54$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
55$massaction =
GETPOST(
'massaction',
'alpha');
56$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectlist';
57$backtopage =
GETPOST(
'backtopage',
'alpha');
58$optioncss =
GETPOST(
'optioncss',
'aZ');
61$sref =
GETPOST(
"sref",
'alpha');
62$snom =
GETPOST(
"snom",
'alpha');
63$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
65$search_barcode =
GETPOST(
"search_barcode",
'alpha');
66$search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
67$search_batch =
GETPOST(
'search_batch',
'alpha');
68$search_toolowstock =
GETPOST(
'search_toolowstock');
69$search_subjecttolotserial =
GETPOST(
'search_subjecttolotserial');
74$search_stock_physique =
GETPOST(
'search_stock_physique',
'alpha');
78$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
79$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
81if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
85$offset = $limit * $page;
91$search_sale =
GETPOST(
"search_sale");
92if (GETPOSTISSET(
'catid')) {
97$search_warehouse_categ =
GETPOSTINT(
'search_warehouse_categ');
100$extrafields->fetch_name_optionals_label(
$object->table_element);
103$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
108 $sortfield =
"p.".key(
$object->fields);
117foreach (
$object->fields as $key => $val) {
118 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
119 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
121 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
136if (!empty($canvas)) {
137 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
139 $objcanvas->getCanvas(
'product',
'list', $canvas);
143$hookmanager->initHooks(array(
'reassortlotlist'));
147 array(
'type' =>
'varchar',
'label' =>
'Ref',
'checked' => 1,
'enabled' => 1,
'position' => 1),
148 array(
'type' =>
'varchar',
'label' =>
'Label',
'checked' => 1,
'enabled' => 1,
'position' => 1),
149 array(
'type' =>
'int',
'label' =>
'Warehouse',
'checked' => 1,
'enabled' => 1,
'position' => 1),
150 array(
'type' =>
'varchar',
'label' =>
'Lot',
'checked' => 1,
'enabled' => 1,
'position' => 1),
151 array(
'type' =>
'varchar',
'label' =>
'DLC',
'checked' => 1,
'enabled' => 1,
'position' => 1),
152 array(
'type' =>
'varchar',
'label' =>
'DLUO',
'checked' => 1,
'enabled' => 1,
'position' => 1),
153 array(
'type' =>
'int',
'label' =>
'Stock',
'checked' => 1,
'enabled' => 1,
'position' => 1),
154 array(
'type' =>
'int',
'label' =>
'StatusSell',
'checked' => 1,
'enabled' => 1,
'position' => 1),
155 array(
'type' =>
'int',
'label' =>
'StatusBuy',
'checked' => 1,
'enabled' => 1,
'position' => 1),
164 $socid = $user->socid;
166$result =
restrictedArea($user,
'produit|service', 0,
'product&product');
174if (
GETPOST(
'cancel',
'alpha')) {
178if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
182$parameters = array();
183$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
188if (empty($reshook)) {
190 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
193 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
194 foreach (
$object->fields as $key => $val) {
196 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
197 $search[$key.
'_dtstart'] =
'';
198 $search[$key.
'_dtend'] =
'';
201 $search[
'sellby_dtstart'] =
'';
202 $search[
'eatby_dtstart'] =
'';
203 $search[
'sellby_dtend'] =
'';
204 $search[
'eatby_dtend'] =
'';
212 $search_warehouse_categ =
"";
213 $search_toolowstock =
'';
214 $search_subjecttolotserial =
'';
216 $search_warehouse =
'';
219 $search_stock_physique =
'';
221 $search_array_options = array();
223 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
224 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
247$helpurl =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
248$title = $langs->trans(
"ProductsAndServices");
252$sql =
'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
253$sql .=
' p.fk_product_type, p.tms as datem,';
254$sql .=
' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,';
255$sql .=
' ps.fk_entrepot, ps.reel,';
256$sql .=
' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,';
257$sql .=
' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,';
258$sql .=
' pl.rowid as lotid, pl.eatby, pl.sellby,';
259$sql .=
' SUM(pb.qty) as stock_physique, COUNT(pb.rowid) as nbinbatchtable';
261$parameters = array();
262$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
263$sql .= $hookmanager->resPrint;
264$sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
265$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_stock as ps on p.rowid = ps.fk_product';
266$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'entrepot as e on ps.fk_entrepot = e.rowid';
267$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_batch as pb on pb.fk_product_stock = ps.rowid';
268$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch';
270$parameters = array();
271$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
272$sql .= $hookmanager->resPrint;
273$sql .=
" WHERE p.entity IN (".getEntity(
'product').
") AND e.entity IN (".
getEntity(
'stock').
")";
274if (!empty($search_categ) && $search_categ !=
'-1') {
276 if ($search_categ == -2) {
277 $sql .=
" NOT EXISTS ";
282 $sql .=
" SELECT cp.fk_categorie, cp.fk_product";
283 $sql .=
" FROM " . MAIN_DB_PREFIX .
"categorie_product as cp";
284 $sql .=
" WHERE cp.fk_product = p.rowid";
285 if ($search_categ > 0) {
286 $sql .=
" AND cp.fk_categorie = " . ((int) $search_categ);
290if (!empty($search_warehouse_categ) && $search_warehouse_categ !=
'-1') {
292 if ($search_warehouse_categ == -2) {
293 $sql .=
" NOT EXISTS ";
298 $sql .=
" SELECT cp.fk_categorie, cp.fk_warehouse";
299 $sql .=
" FROM " . MAIN_DB_PREFIX .
"categorie_warehouse as cp";
300 $sql .=
" WHERE cp.fk_warehouse = e.rowid";
301 if ($search_warehouse_categ > 0) {
302 $sql .=
" AND cp.fk_categorie = " . ((int) $search_warehouse_categ);
307 $sql .=
natural_search(array(
'p.ref',
'p.label',
'p.description',
'p.note'), $search_all);
312 $sql .=
" AND p.fk_product_type = '1'";
314 $sql .=
" AND p.fk_product_type <> '1'";
317if ($search_subjecttolotserial) {
318 $sql .=
" AND p.tobatch > 0";
323if ($search_barcode) {
329if (!empty($tosell)) {
330 $sql .=
" AND p.tosell = ".((int) $tosell);
333 $sql .=
" AND p.tobuy = ".((int) $tobuy);
335if (!empty($canvas)) {
336 $sql .=
" AND p.canvas = '".$db->escape($canvas).
"'";
339 $sql .=
" AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id);
341if ($search_warehouse) {
348foreach ($search as $key => $val) {
349 if (array_key_exists($key,
$object->fields)) {
350 if ($key ==
'status' && $search[$key] == -1) {
354 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
355 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
360 if ($search[$key] !=
'') {
361 $sql .=
natural_search(
"t.".
$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
364 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
365 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
366 if ($columnName ==
'eatby' || $columnName ==
'sellby') {
367 if (preg_match(
'/_dtstart$/', $key)) {
368 $sql .=
" AND pl.".$db->escape($columnName).
" >= '".
$db->idate($search[$key]).
"'";
370 if (preg_match(
'/_dtend$/', $key)) {
371 $sql .=
" AND pl.".$db->escape($columnName).
" <= '".
$db->idate($search[$key]).
"'";
378$parameters = array();
379$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
380$sql .= $hookmanager->resPrint;
382$sql .=
" GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
383$sql .=
" p.fk_product_type, p.tms,";
384$sql .=
" p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,";
385$sql .=
" ps.fk_entrepot, ps.reel,";
386$sql .=
" e.ref, e.lieu, e.fk_parent,";
387$sql .=
" pb.batch, pb.eatby, pb.sellby,";
388$sql .=
" pl.rowid, pl.eatby, pl.sellby";
390$parameters = array();
391$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
392$sql .= $hookmanager->resPrint;
394if ($search_toolowstock) {
395 $sql_having .=
" HAVING SUM(".$db->ifsql(
'ps.reel IS NULL',
'0',
'ps.reel').
") < p.seuil_stock_alerte";
397if ($search_stock_physique !=
'') {
398 $natural_search_physique =
natural_search(
'__SEARCH_PHYSIQUE__', $search_stock_physique, 1, 1);
399 $natural_search_physique =
" " . substr(str_replace(
'__SEARCH_PHYSIQUE__',
'SUM(COALESCE(pb.qty, ps.reel, 0))', $natural_search_physique), 1, -1);
400 if (!empty($sql_having)) {
401 $sql_having .=
" AND";
403 $sql_having .=
" HAVING";
405 $sql_having .= $natural_search_physique;
408$parameters = array();
409$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
410if (empty($reshook)) {
411 if (empty($sql_having)) {
412 $sql_having .=
" HAVING 1=1";
414 $sql_having .= $hookmanager->resPrint;
416 $sql_having = $hookmanager->resPrint;
419if (!empty($sql_having)) {
426$nbtotalofrecords =
'';
428 $resql =
$db->query($sql);
429 $nbtotalofrecords =
$db->num_rows($resql);
431 if (($page * $limit) > (
int) $nbtotalofrecords) {
439$sql .=
$db->order($sortfield, $sortorder);
441 $sql .=
$db->plimit($limit + 1, $offset);
444$resql =
$db->query($sql);
450$num =
$db->num_rows($resql);
454if ($num == 1 &&
GETPOST(
'autojumpifoneonly') && ($search_all || $snom || $sref)) {
455 $objp =
$db->fetch_object($resql);
456 header(
"Location: card.php?id=$objp->rowid");
462 $texte = $langs->trans(
"Services");
464 $texte = $langs->trans(
"Products");
467 $texte = $langs->trans(
"ProductsAndServices");
469$texte .=
' ('.$langs->trans(
"StocksByLotSerial").
')';
473 $param .=
'&mode='.urlencode($mode);
475if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
476 $param .=
'&contextpage='.urlencode($contextpage);
478if ($limit > 0 && $limit !=
$conf->liste_limit) {
479 $param .=
'&limit='.((int) $limit);
481foreach ($search as $key => $val) {
482 if (is_array($search[$key]) && count($search[$key])) {
483 foreach ($search[$key] as $skey) {
485 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
488 } elseif ($search[$key] !=
'') {
489 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
492if ($optioncss !=
'') {
493 $param .=
'&optioncss='.urlencode($optioncss);
496 $param .=
"&search_all=".urlencode($search_all);
499 $param .=
"&tosell=".urlencode($tosell);
502 $param .=
"&tobuy=".urlencode($tobuy);
505 $param .=
"&type=".urlencode((
string) ($type));
508 $param .=
"&fourn_id=".urlencode((
string) ($fourn_id));
511 $param .=
"&snom=".urlencode($snom);
514 $param .=
"&sref=".urlencode($sref);
517 $param .=
"&search_batch=".urlencode($search_batch);
520 $param .=
"&sbarcode=".urlencode((
string) ($sbarcode));
522if ($search_warehouse) {
523 $param .=
"&search_warehouse=".urlencode($search_warehouse);
525if ($search_toolowstock) {
526 $param .=
"&search_toolowstock=".urlencode($search_toolowstock);
528if ($search_subjecttolotserial) {
529 $param .=
"&search_subjecttolotserial=".urlencode($search_subjecttolotserial);
532 $param .=
"&search_sale=".urlencode($search_sale);
534if (!empty($search_categ) && $search_categ !=
'-1') {
535 $param .=
"&search_categ=".urlencode((
string) ($search_categ));
537if (!empty($search_warehouse_categ) && $search_warehouse_categ !=
'-1') {
538 $param .=
"&search_warehouse_categ=".urlencode((
string) ($search_warehouse_categ));
540if ($search_stock_physique) {
541 $param .=
'&search_stock_physique=' . urlencode($search_stock_physique);
546llxHeader(
"", $title, $helpurl, $texte, 0, 0,
'',
'',
'',
'mod-product page-reassortlot');
548print
'<form id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire">'.
"\n";
549if ($optioncss !=
'') {
550 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
552print
'<input type="hidden" name="token" value="'.newToken().
'">';
553print
'<input type="hidden" name="action" value="list">';
554print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
555print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
556print
'<input type="hidden" name="type" value="'.$type.
'">';
557print
'<input type="hidden" name="page" value="'.$page.
'">';
558print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
559print
'<input type="hidden" name="mode" value="'.$mode.
'">';
561print_barre_liste($texte, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'product', 0,
'',
'', $limit, 0, 0, 1);
577 $moreforfilter .=
'<div class="divsearchfield">';
578 $moreforfilter .=
img_picto($langs->trans(
'ProductsCategoriesShort'),
'category',
'class="pictofixedwidth"');
579 $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ,
'search_categ', 1, $langs->trans(
"ProductsCategoryShort"),
'maxwidth400');
580 $moreforfilter .=
'</div>';
584 $moreforfilter .=
'<div class="divsearchfield">';
585 $moreforfilter .=
img_picto($langs->trans(
'StockCategoriesShort'),
'category',
'class="pictofixedwidth"');
586 $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_WAREHOUSE, $search_warehouse_categ,
'search_warehouse_categ', 1, $langs->trans(
"StockCategoriesShort"),
'maxwidth400');
587 $moreforfilter .=
'</div>';
590$moreforfilter .=
'<label for="search_subjecttolotserial">'.$langs->trans(
"SubjectToLotSerialOnly").
' </label><input type="checkbox" id="search_subjecttolotserial" name="search_subjecttolotserial" value="1"'.($search_subjecttolotserial ?
' checked' :
'').
'>';
593print
'<div class="liste_titre liste_titre_bydiv centpercent">';
595$parameters = array();
596$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
597print $hookmanager->resPrint;
600print
'<div class="div-table-responsive">';
601print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
605print
'<tr class="liste_titre_filter">';
607if (
$conf->main_checkbox_left_column) {
608 print
'<td class="liste_titre maxwidthsearch">';
609 $searchpicto = $form->showFilterButtons();
613print
'<td class="liste_titre">';
614print
'<input class="flat" type="text" name="sref" size="6" value="'.dol_escape_htmltag($sref).
'">';
616print
'<td class="liste_titre">';
617print
'<input class="flat" type="text" name="snom" size="8" value="'.dol_escape_htmltag($snom).
'">';
620 print
'<td class="liste_titre">';
625print
'<td class="liste_titre"><input class="flat" type="text" name="search_warehouse" size="6" value="'.dol_escape_htmltag($search_warehouse).
'"></td>';
626print
'<td class="liste_titre center"><input class="flat" type="text" name="search_batch" size="6" value="'.dol_escape_htmltag($search_batch).
'"></td>';
628 print
'<td class="liste_titre center">';
630 print
'<div class="nowrap">';
631 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
633 print
'<div class="nowrap">';
634 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
639 print
'<td class="liste_titre center">';
641 print
'<div class="nowrap">';
642 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
644 print
'<div class="nowrap">';
645 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
650print
'<td class="liste_titre right">';
651print
'<input class="flat" type="text" size="5" name="search_stock_physique" value="'.dol_escape_htmltag($search_stock_physique).
'">';
653print
'<td class="liste_titre"> </td>';
654print
'<td class="liste_titre"> </td>';
655print
'<td class="liste_titre"> </td>';
656$parameters = array();
657$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
658print $hookmanager->resPrint;
660if (!
$conf->main_checkbox_left_column) {
661 print
'<td class="liste_titre maxwidthsearch">';
662 $searchpicto = $form->showFilterButtons();
673print
'<tr class="liste_titre">';
675if (
$conf->main_checkbox_left_column) {
681 print_liste_field_titre(
"Duration", $_SERVER[
"PHP_SELF"],
"p.duration",
'', $param,
"", $sortfield, $sortorder,
'center ');
685print_liste_field_titre(
"Batch", $_SERVER[
"PHP_SELF"],
"pb.batch",
'', $param,
"", $sortfield, $sortorder,
'center ');
687 print_liste_field_titre(
"SellByDate", $_SERVER[
"PHP_SELF"],
"pl.sellby",
'', $param,
"", $sortfield, $sortorder,
'center ');
690 print_liste_field_titre(
"EatByDate", $_SERVER[
"PHP_SELF"],
"pl.eatby",
'', $param,
"", $sortfield, $sortorder,
'center ');
692print_liste_field_titre(
"PhysicalStock", $_SERVER[
"PHP_SELF"],
"stock_physique",
'', $param,
"", $sortfield, $sortorder,
'right ');
696print_liste_field_titre(
"ProductStatusOnSell", $_SERVER[
"PHP_SELF"],
"p.tosell",
"", $param,
'', $sortfield, $sortorder,
'right ');
697print_liste_field_titre(
"ProductStatusOnBuy", $_SERVER[
"PHP_SELF"],
"p.tobuy",
"", $param,
'', $sortfield, $sortorder,
'right ');
699$parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
700$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
701print $hookmanager->resPrint;
702if (!
$conf->main_checkbox_left_column) {
716$imaxinloop = ($limit ? min($num, $limit) : $num);
717while ($i < $imaxinloop) {
718 $objp =
$db->fetch_object($resql);
723 $sql =
"SELECT label";
724 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
725 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
726 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
729 $result =
$db->query($sql);
731 $objtp =
$db->fetch_object($result);
732 if (!empty($objtp->label)) {
733 $objp->label = $objtp->label;
738 $product_static->ref = $objp->ref;
739 $product_static->id = $objp->rowid;
740 $product_static->label = $objp->label;
741 $product_static->type = $objp->fk_product_type;
742 $product_static->entity = $objp->entity;
743 $product_static->status = $objp->tosell;
744 $product_static->status_buy = $objp->tobuy;
745 $product_static->status_batch = $objp->tobatch;
747 $product_lot_static->batch = $objp->batch;
748 $product_lot_static->fk_product = $objp->rowid;
749 $product_lot_static->id = $objp->lotid;
750 $product_lot_static->eatby = $objp->eatby;
751 $product_lot_static->sellby = $objp->sellby;
754 $warehousetmp->id = $objp->fk_entrepot;
755 $warehousetmp->ref = $objp->warehouse_ref;
756 $warehousetmp->label = $objp->warehouse_ref;
757 $warehousetmp->fk_parent = $objp->warehouse_parent;
762 if (
$conf->main_checkbox_left_column) {
770 print
'<td class="tdoverflowmax250">';
771 print $product_static->getNomUrl(1);
779 print
'<td class="tdoverflowmax150">'.$objp->label.
'</td>';
785 print
'<td class="center">';
787 if (preg_match(
'/([0-9]+)y/i', $objp->duration, $regs)) {
788 print $regs[1].
' '.$langs->trans(
"DurationYear");
789 } elseif (preg_match(
'/([0-9]+)m/i', $objp->duration, $regs)) {
790 print $regs[1].
' '.$langs->trans(
"DurationMonth");
791 } elseif (preg_match(
'/([0-9]+)d/i', $objp->duration, $regs)) {
792 print $regs[1].
' '.$langs->trans(
"DurationDay");
794 print $objp->duration;
806 print
'<td class="nowrap">';
807 if ($objp->fk_entrepot > 0) {
808 print $warehousetmp->getNomUrl(1);
816 print
'<td class="center nowrap">';
817 if ($product_lot_static->batch) {
818 print $product_lot_static->getNomUrl(1);
826 print
'<td class="center">'.dol_print_date(
$db->jdate($objp->sellby),
'day').
'</td>';
833 print
'<td class="center">'.dol_print_date(
$db->jdate($objp->eatby),
'day').
'</td>';
839 print
'<td class="right">';
841 if (is_null($objp->stock_physique)) {
842 if (!empty($objp->reel)) {
843 if ($objp->reel < 0) {
844 print
'<span class="warning">';
847 if ($objp->reel < 0) {
850 print($objp->stock_physique < 0 ?
' '.img_warning() :
'');
853 if (!empty($objp->stock_physique)) {
854 if ($objp->stock_physique < 0) {
855 print
'<span class="warning">';
857 print
price2num($objp->stock_physique,
'MS');
858 if ($objp->stock_physique < 0) {
861 print($objp->stock_physique < 0 ?
' '.img_warning() : (($objp->stock_physique > 1 && $objp->tobatch == 2) ?
' '.
img_warning($langs->trans(
'IlligalQtyForSerialNumbers')) :
''));
869 print
'<td class="right">';
870 print
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="pictofixedwidth"');
871 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?idproduct='.$product_static->id.
'&search_warehouse='.$objp->fk_entrepot.
'&search_batch='.($objp->batch !=
'Undefined' ? $objp->batch :
'Undefined').
'">'.$langs->trans(
"Movements").
'</a>';
877 print
'<td class="right nowrap">'.$product_static->LibStatut($objp->statut, 5, 0).
'</td>';
882 print
'<td class="right nowrap">'.$product_static->LibStatut($objp->tobuy, 5, 1).
'</td>';
888 $parameters = array(
'obj' => $objp);
889 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $product);
890 print $hookmanager->resPrint;
893 if (!
$conf->main_checkbox_left_column) {
907 foreach ($arrayfields as $key => $val) {
908 if (!empty($val[
'checked'])) {
912 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
918print
'</table>'.
"\n";
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 warehouses.
Class to manage products or services.
Class with list of lots and properties.
dol_now($mode='gmt')
Return date for now.
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_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
isModEnabled($module)
Is Dolibarr module enabled.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
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.