33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
50$langs->loadLangs(array(
'products',
'stocks',
'productbatch',
'categories'));
52$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
53$massaction =
GETPOST(
'massaction',
'alpha');
54$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectlist';
55$backtopage =
GETPOST(
'backtopage',
'alpha');
56$optioncss =
GETPOST(
'optioncss',
'aZ');
59$sref =
GETPOST(
"sref",
'alpha');
60$snom =
GETPOST(
"snom",
'alpha');
61$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
63$search_barcode =
GETPOST(
"search_barcode",
'alpha');
64$search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
65$search_batch =
GETPOST(
'search_batch',
'alpha');
66$search_toolowstock =
GETPOST(
'search_toolowstock');
67$search_subjecttolotserial =
GETPOST(
'search_subjecttolotserial');
72$search_stock_physique =
GETPOST(
'search_stock_physique',
'alpha');
76$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
77$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
79if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
83$offset = $limit * $page;
89$search_sale =
GETPOST(
"search_sale");
90if (GETPOSTISSET(
'catid')) {
95$search_warehouse_categ =
GETPOSTINT(
'search_warehouse_categ');
98$extrafields->fetch_name_optionals_label(
$object->table_element);
101$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
106 $sortfield =
"p.".key(
$object->fields);
115foreach (
$object->fields as $key => $val) {
116 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
117 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
119 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
134if (!empty($canvas)) {
135 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
136 $objcanvas =
new Canvas($db, $action);
137 $objcanvas->getCanvas(
'product',
'list', $canvas);
141$hookmanager->initHooks(array(
'reassortlotlist'));
145 array(
'type' =>
'varchar',
'label' =>
'Ref',
'checked' => 1,
'enabled' => 1,
'position' => 1),
146 array(
'type' =>
'varchar',
'label' =>
'Label',
'checked' => 1,
'enabled' => 1,
'position' => 1),
147 array(
'type' =>
'int',
'label' =>
'Warehouse',
'checked' => 1,
'enabled' => 1,
'position' => 1),
148 array(
'type' =>
'varchar',
'label' =>
'Lot',
'checked' => 1,
'enabled' => 1,
'position' => 1),
149 array(
'type' =>
'varchar',
'label' =>
'DLC',
'checked' => 1,
'enabled' => 1,
'position' => 1),
150 array(
'type' =>
'varchar',
'label' =>
'DLUO',
'checked' => 1,
'enabled' => 1,
'position' => 1),
151 array(
'type' =>
'int',
'label' =>
'Stock',
'checked' => 1,
'enabled' => 1,
'position' => 1),
152 array(
'type' =>
'int',
'label' =>
'StatusSell',
'checked' => 1,
'enabled' => 1,
'position' => 1),
153 array(
'type' =>
'int',
'label' =>
'StatusBuy',
'checked' => 1,
'enabled' => 1,
'position' => 1),
162 $socid = $user->socid;
164$result =
restrictedArea($user,
'produit|service', 0,
'product&product');
172if (
GETPOST(
'cancel',
'alpha')) {
176if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
180$parameters = array();
181$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
186if (empty($reshook)) {
188 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
191 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
192 foreach (
$object->fields as $key => $val) {
194 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
195 $search[$key.
'_dtstart'] =
'';
196 $search[$key.
'_dtend'] =
'';
199 $search[
'sellby_dtstart'] =
'';
200 $search[
'eatby_dtstart'] =
'';
201 $search[
'sellby_dtend'] =
'';
202 $search[
'eatby_dtend'] =
'';
210 $search_warehouse_categ =
"";
211 $search_toolowstock =
'';
212 $search_subjecttolotserial =
'';
214 $search_warehouse =
'';
217 $search_stock_physique =
'';
219 $search_array_options = array();
221 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
222 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
240$form =
new Form($db);
245$helpurl =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
246$title = $langs->trans(
"ProductsAndServices");
250$sql =
'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
251$sql .=
' p.fk_product_type, p.tms as datem,';
252$sql .=
' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,';
253$sql .=
' ps.fk_entrepot, ps.reel,';
254$sql .=
' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,';
255$sql .=
' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,';
256$sql .=
' pl.rowid as lotid, pl.eatby, pl.sellby,';
257$sql .=
' SUM(pb.qty) as stock_physique, COUNT(pb.rowid) as nbinbatchtable';
259$parameters = array();
260$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
261$sql .= $hookmanager->resPrint;
262$sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
263$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_stock as ps on p.rowid = ps.fk_product';
264$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'entrepot as e on ps.fk_entrepot = e.rowid';
265$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_batch as pb on pb.fk_product_stock = ps.rowid';
266$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch';
268$parameters = array();
269$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
270$sql .= $hookmanager->resPrint;
271$sql .=
" WHERE p.entity IN (".getEntity(
'product').
") AND e.entity IN (".
getEntity(
'stock').
")";
272if (!empty($search_categ) && $search_categ !=
'-1') {
274 if ($search_categ == -2) {
275 $sql .=
" NOT EXISTS ";
280 $sql .=
" SELECT cp.fk_categorie, cp.fk_product";
281 $sql .=
" FROM " . MAIN_DB_PREFIX .
"categorie_product as cp";
282 $sql .=
" WHERE cp.fk_product = p.rowid";
283 if ($search_categ > 0) {
284 $sql .=
" AND cp.fk_categorie = " . ((int) $search_categ);
288if (!empty($search_warehouse_categ) && $search_warehouse_categ !=
'-1') {
290 if ($search_warehouse_categ == -2) {
291 $sql .=
" NOT EXISTS ";
296 $sql .=
" SELECT cp.fk_categorie, cp.fk_warehouse";
297 $sql .=
" FROM " . MAIN_DB_PREFIX .
"categorie_warehouse as cp";
298 $sql .=
" WHERE cp.fk_warehouse = e.rowid";
299 if ($search_warehouse_categ > 0) {
300 $sql .=
" AND cp.fk_categorie = " . ((int) $search_warehouse_categ);
305 $sql .=
natural_search(array(
'p.ref',
'p.label',
'p.description',
'p.note'), $search_all);
310 $sql .=
" AND p.fk_product_type = '1'";
312 $sql .=
" AND p.fk_product_type <> '1'";
315if ($search_subjecttolotserial) {
316 $sql .=
" AND p.tobatch > 0";
321if ($search_barcode) {
327if (!empty($tosell)) {
328 $sql .=
" AND p.tosell = ".((int) $tosell);
331 $sql .=
" AND p.tobuy = ".((int) $tobuy);
333if (!empty($canvas)) {
334 $sql .=
" AND p.canvas = '".$db->escape($canvas).
"'";
337 $sql .=
" AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id);
339if ($search_warehouse) {
346foreach ($search as $key => $val) {
347 if (array_key_exists($key,
$object->fields)) {
348 if ($key ==
'status' && $search[$key] == -1) {
352 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
353 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
358 if ($search[$key] !=
'') {
359 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
362 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
363 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
364 if ($columnName ==
'eatby' || $columnName ==
'sellby') {
365 if (preg_match(
'/_dtstart$/', $key)) {
366 $sql .=
" AND pl.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
368 if (preg_match(
'/_dtend$/', $key)) {
369 $sql .=
" AND pl.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
376$parameters = array();
377$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
378$sql .= $hookmanager->resPrint;
380$sql .=
" GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
381$sql .=
" p.fk_product_type, p.tms,";
382$sql .=
" p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,";
383$sql .=
" ps.fk_entrepot, ps.reel,";
384$sql .=
" e.ref, e.lieu, e.fk_parent,";
385$sql .=
" pb.batch, pb.eatby, pb.sellby,";
386$sql .=
" pl.rowid, pl.eatby, pl.sellby";
388$parameters = array();
389$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
390$sql .= $hookmanager->resPrint;
392if ($search_toolowstock) {
393 $sql_having .=
" HAVING SUM(".$db->ifsql(
'ps.reel IS NULL',
'0',
'ps.reel').
") < p.seuil_stock_alerte";
395if ($search_stock_physique !=
'') {
396 $natural_search_physique =
natural_search(
'SUM(' . $db->ifsql(
'pb.qty IS NULL', $db->ifsql(
'ps.reel IS NULL',
'0',
'ps.reel'),
'pb.qty') .
')', $search_stock_physique, 1, 1);
397 $natural_search_physique =
" " . substr($natural_search_physique, 1, -1);
398 if (!empty($sql_having)) {
399 $sql_having .=
" AND";
401 $sql_having .=
" HAVING";
403 $sql_having .= $natural_search_physique;
406$parameters = array();
407$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
408if (!empty($hookmanager->resPrint)) {
409 if (!empty($sql_having)) {
410 $sql_having .=
" AND";
412 $sql_having .=
" HAVING";
414 $sql_having .= $hookmanager->resPrint;
416if (!empty($sql_having)) {
423$nbtotalofrecords =
'';
425 $resql = $db->query($sql);
426 $nbtotalofrecords = $db->num_rows($resql);
428 if (($page * $limit) > $nbtotalofrecords) {
436$sql .= $db->order($sortfield, $sortorder);
438 $sql .= $db->plimit($limit + 1, $offset);
441$resql = $db->query($sql);
447$num = $db->num_rows($resql);
451if ($num == 1 &&
GETPOST(
'autojumpifoneonly') && ($search_all || $snom || $sref)) {
452 $objp = $db->fetch_object($resql);
453 header(
"Location: card.php?id=$objp->rowid");
459 $texte = $langs->trans(
"Services");
461 $texte = $langs->trans(
"Products");
464 $texte = $langs->trans(
"ProductsAndServices");
466$texte .=
' ('.$langs->trans(
"StocksByLotSerial").
')';
470 $param .=
'&mode='.urlencode($mode);
472if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
473 $param .=
'&contextpage='.urlencode($contextpage);
475if ($limit > 0 && $limit !=
$conf->liste_limit) {
476 $param .=
'&limit='.((int) $limit);
478foreach ($search as $key => $val) {
479 if (is_array($search[$key]) && count($search[$key])) {
480 foreach ($search[$key] as $skey) {
482 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
485 } elseif ($search[$key] !=
'') {
486 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
489if ($optioncss !=
'') {
490 $param .=
'&optioncss='.urlencode($optioncss);
493 $param .=
"&search_all=".urlencode($search_all);
496 $param .=
"&tosell=".urlencode($tosell);
499 $param .=
"&tobuy=".urlencode($tobuy);
502 $param .=
"&type=".urlencode((
string) ($type));
505 $param .=
"&fourn_id=".urlencode((
string) ($fourn_id));
508 $param .=
"&snom=".urlencode($snom);
511 $param .=
"&sref=".urlencode($sref);
514 $param .=
"&search_batch=".urlencode($search_batch);
517 $param .=
"&sbarcode=".urlencode((
string) ($sbarcode));
519if ($search_warehouse) {
520 $param .=
"&search_warehouse=".urlencode($search_warehouse);
522if ($search_toolowstock) {
523 $param .=
"&search_toolowstock=".urlencode($search_toolowstock);
525if ($search_subjecttolotserial) {
526 $param .=
"&search_subjecttolotserial=".urlencode($search_subjecttolotserial);
529 $param .=
"&search_sale=".urlencode($search_sale);
531if (!empty($search_categ) && $search_categ !=
'-1') {
532 $param .=
"&search_categ=".urlencode((
string) ($search_categ));
534if (!empty($search_warehouse_categ) && $search_warehouse_categ !=
'-1') {
535 $param .=
"&search_warehouse_categ=".urlencode((
string) ($search_warehouse_categ));
537if ($search_stock_physique) {
538 $param .=
'&search_stock_physique=' . urlencode($search_stock_physique);
543llxHeader(
"", $title, $helpurl, $texte, 0, 0,
'',
'',
'',
'mod-product page-reassortlot');
545print
'<form id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire">'.
"\n";
546if ($optioncss !=
'') {
547 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
549print
'<input type="hidden" name="token" value="'.newToken().
'">';
550print
'<input type="hidden" name="action" value="list">';
551print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
552print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
553print
'<input type="hidden" name="type" value="'.$type.
'">';
554print
'<input type="hidden" name="page" value="'.$page.
'">';
555print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
556print
'<input type="hidden" name="mode" value="'.$mode.
'">';
558print_barre_liste($texte, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'product', 0,
'',
'', $limit, 0, 0, 1);
573if (isModEnabled(
'category')) {
574 $moreforfilter .=
'<div class="divsearchfield">';
575 $moreforfilter .=
img_picto($langs->trans(
'ProductsCategoriesShort'),
'category',
'class="pictofixedwidth"');
576 $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ,
'search_categ', 1, $langs->trans(
"ProductsCategoryShort"),
'maxwidth400');
577 $moreforfilter .=
'</div>';
580if (isModEnabled(
'category')) {
581 $moreforfilter .=
'<div class="divsearchfield">';
582 $moreforfilter .=
img_picto($langs->trans(
'StockCategoriesShort'),
'category',
'class="pictofixedwidth"');
583 $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_WAREHOUSE, $search_warehouse_categ,
'search_warehouse_categ', 1, $langs->trans(
"StockCategoriesShort"),
'maxwidth400');
584 $moreforfilter .=
'</div>';
587$moreforfilter .=
'<label for="search_subjecttolotserial">'.$langs->trans(
"SubjectToLotSerialOnly").
' </label><input type="checkbox" id="search_subjecttolotserial" name="search_subjecttolotserial" value="1"'.($search_subjecttolotserial ?
' checked' :
'').
'>';
590print
'<div class="liste_titre liste_titre_bydiv centpercent">';
592$parameters = array();
593$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
594print $hookmanager->resPrint;
597print
'<div class="div-table-responsive">';
598print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
602print
'<tr class="liste_titre_filter">';
605 print
'<td class="liste_titre maxwidthsearch">';
606 $searchpicto = $form->showFilterButtons();
610print
'<td class="liste_titre">';
611print
'<input class="flat" type="text" name="sref" size="6" value="'.dol_escape_htmltag($sref).
'">';
613print
'<td class="liste_titre">';
614print
'<input class="flat" type="text" name="snom" size="8" value="'.dol_escape_htmltag($snom).
'">';
616if (isModEnabled(
"service") && $type == 1) {
617 print
'<td class="liste_titre">';
622print
'<td class="liste_titre"><input class="flat" type="text" name="search_warehouse" size="6" value="'.dol_escape_htmltag($search_warehouse).
'"></td>';
623print
'<td class="liste_titre center"><input class="flat" type="text" name="search_batch" size="6" value="'.dol_escape_htmltag($search_batch).
'"></td>';
625 print
'<td class="liste_titre center">';
627 print
'<div class="nowrap">';
628 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
630 print
'<div class="nowrap">';
631 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
636 print
'<td class="liste_titre center">';
638 print
'<div class="nowrap">';
639 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
641 print
'<div class="nowrap">';
642 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
647print
'<td class="liste_titre right">';
648print
'<input class="flat" type="text" size="5" name="search_stock_physique" value="'.dol_escape_htmltag($search_stock_physique).
'">';
650print
'<td class="liste_titre"> </td>';
651print
'<td class="liste_titre"> </td>';
652print
'<td class="liste_titre"> </td>';
653$parameters = array();
654$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
655print $hookmanager->resPrint;
658 print
'<td class="liste_titre maxwidthsearch">';
659 $searchpicto = $form->showFilterButtons();
665$totalarray = array();
666$totalarray[
'nbfield'] = 0;
670print
'<tr class="liste_titre">';
677if (isModEnabled(
"service") && $type == 1) {
678 print_liste_field_titre(
"Duration", $_SERVER[
"PHP_SELF"],
"p.duration",
'', $param,
"", $sortfield, $sortorder,
'center ');
682print_liste_field_titre(
"Batch", $_SERVER[
"PHP_SELF"],
"pb.batch",
'', $param,
"", $sortfield, $sortorder,
'center ');
684 print_liste_field_titre(
"SellByDate", $_SERVER[
"PHP_SELF"],
"pl.sellby",
'', $param,
"", $sortfield, $sortorder,
'center ');
687 print_liste_field_titre(
"EatByDate", $_SERVER[
"PHP_SELF"],
"pl.eatby",
'', $param,
"", $sortfield, $sortorder,
'center ');
689print_liste_field_titre(
"PhysicalStock", $_SERVER[
"PHP_SELF"],
"stock_physique",
'', $param,
"", $sortfield, $sortorder,
'right ');
693print_liste_field_titre(
"ProductStatusOnSell", $_SERVER[
"PHP_SELF"],
"p.tosell",
"", $param,
'', $sortfield, $sortorder,
'right ');
694print_liste_field_titre(
"ProductStatusOnBuy", $_SERVER[
"PHP_SELF"],
"p.tobuy",
"", $param,
'', $sortfield, $sortorder,
'right ');
696$parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
697$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
698print $hookmanager->resPrint;
704$product_static =
new Product($db);
711$savnbfield = $totalarray[
'nbfield'];
712$totalarray[
'nbfield'] = 0;
713$imaxinloop = ($limit ? min($num, $limit) : $num);
714while ($i < $imaxinloop) {
715 $objp = $db->fetch_object($resql);
720 $sql =
"SELECT label";
721 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
722 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
723 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
726 $result = $db->query($sql);
728 $objtp = $db->fetch_object($result);
729 if (!empty($objtp->label)) {
730 $objp->label = $objtp->label;
735 $product_static->ref = $objp->ref;
736 $product_static->id = $objp->rowid;
737 $product_static->label = $objp->label;
738 $product_static->type = $objp->fk_product_type;
739 $product_static->entity = $objp->entity;
740 $product_static->status = $objp->tosell;
741 $product_static->status_buy = $objp->tobuy;
742 $product_static->status_batch = $objp->tobatch;
744 $product_lot_static->batch = $objp->batch;
745 $product_lot_static->fk_product = $objp->rowid;
746 $product_lot_static->id = $objp->lotid;
747 $product_lot_static->eatby = $objp->eatby;
748 $product_lot_static->sellby = $objp->sellby;
751 $warehousetmp->id = $objp->fk_entrepot;
752 $warehousetmp->ref = $objp->warehouse_ref;
753 $warehousetmp->label = $objp->warehouse_ref;
754 $warehousetmp->fk_parent = $objp->warehouse_parent;
762 $totalarray[
'nbfield']++;
767 print
'<td class="nowrap">';
768 print $product_static->getNomUrl(1,
'', 16);
772 $totalarray[
'nbfield']++;
776 print
'<td>'.$objp->label.
'</td>';
778 $totalarray[
'nbfield']++;
781 if (isModEnabled(
"service") && $type == 1) {
782 print
'<td class="center">';
784 if (preg_match(
'/([0-9]+)y/i', $objp->duration, $regs)) {
785 print $regs[1].
' '.$langs->trans(
"DurationYear");
786 } elseif (preg_match(
'/([0-9]+)m/i', $objp->duration, $regs)) {
787 print $regs[1].
' '.$langs->trans(
"DurationMonth");
788 } elseif (preg_match(
'/([0-9]+)d/i', $objp->duration, $regs)) {
789 print $regs[1].
' '.$langs->trans(
"DurationDay");
791 print $objp->duration;
794 $totalarray[
'nbfield']++;
803 print
'<td class="nowrap">';
804 if ($objp->fk_entrepot > 0) {
805 print $warehousetmp->getNomUrl(1);
808 $totalarray[
'nbfield']++;
813 print
'<td class="center nowrap">';
814 if ($product_lot_static->batch) {
815 print $product_lot_static->getNomUrl(1);
818 $totalarray[
'nbfield']++;
823 print
'<td class="center">'.dol_print_date($db->jdate($objp->sellby),
'day').
'</td>';
825 $totalarray[
'nbfield']++;
830 print
'<td class="center">'.dol_print_date($db->jdate($objp->eatby),
'day').
'</td>';
832 $totalarray[
'nbfield']++;
836 print
'<td class="right">';
838 if (is_null($objp->stock_physique)) {
839 if (!empty($objp->reel)) {
840 if ($objp->reel < 0) {
841 print
'<span class="warning">';
844 if ($objp->reel < 0) {
847 print($objp->stock_physique < 0 ?
' '.img_warning() :
'');
850 if (!empty($objp->stock_physique)) {
851 if ($objp->stock_physique < 0) {
852 print
'<span class="warning">';
854 print
price2num($objp->stock_physique,
'MS');
855 if ($objp->stock_physique < 0) {
858 print($objp->stock_physique < 0 ?
' '.img_warning() : (($objp->stock_physique > 1 && $objp->tobatch == 2) ?
' '.
img_warning($langs->trans(
'IlligalQtyForSerialNumbers')) :
''));
863 $totalarray[
'nbfield']++;
866 print
'<td class="right">';
867 print
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="pictofixedwidth"');
868 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>';
871 $totalarray[
'nbfield']++;
874 print
'<td class="right nowrap">'.$product_static->LibStatut($objp->statut, 5, 0).
'</td>';
876 $totalarray[
'nbfield']++;
879 print
'<td class="right nowrap">'.$product_static->LibStatut($objp->tobuy, 5, 1).
'</td>';
881 $totalarray[
'nbfield']++;
885 $parameters = array(
'obj' => $objp);
886 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $product);
887 print $hookmanager->resPrint;
893 $totalarray[
'nbfield']++;
904 foreach ($arrayfields as $key => $val) {
905 if (!empty($val[
'checked'])) {
909 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
915print
'</table>'.
"\n";
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 warehouses.
Class to manage products or services.
Class with list of lots and properties.
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_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show 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.
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.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
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.