29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
38 $langs->loadLangs(array(
"stocks",
"other"));
40 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
41 $massaction =
GETPOST(
'massaction',
'alpha');
42 $show_files =
GETPOST(
'show_files',
'int');
43 $confirm =
GETPOST(
'confirm',
'alpha');
44 $cancel =
GETPOST(
'cancel',
'alpha');
45 $toselect =
GETPOST(
'toselect',
'array');
46 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'stocklist';
47 $backtopage =
GETPOST(
'backtopage',
'alpha');
48 $optioncss =
GETPOST(
'optioncss',
'aZ');
49 $toselect =
GETPOST(
'toselect',
'array');
52 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
54 $search_label =
GETPOST(
"snom",
"alpha") ?
GETPOST(
"snom",
"alpha") :
GETPOST(
"search_label",
"alpha");
55 $search_status =
GETPOST(
"search_status",
"int");
56 $mode =
GETPOST(
'mode',
'alpha');
60 $search_category_list =
GETPOST(
"search_category_".Categorie::TYPE_WAREHOUSE.
"_list",
"array");
64 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
65 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
66 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
71 $offset = $limit * $page;
72 $pageprev = $page - 1;
73 $pagenext = $page + 1;
84 $diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
85 $hookmanager->initHooks(array(
'stocklist'));
88 $extrafields->fetch_name_optionals_label($object->table_element);
90 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
94 $search_all =
GETPOST(
"search_all",
'alpha');
96 foreach ($object->fields as $key => $val) {
98 if ($search_key ==
'statut') {
99 $search_key =
'status';
101 if (
GETPOST(
'search_'.$search_key,
'alpha') !==
'') {
102 $search[$search_key] =
GETPOST(
'search_'.$search_key,
'alpha');
107 $fieldstosearchall = array();
108 foreach ($object->fields as $key => $val) {
109 if (!empty($val[
'searchall'])) {
110 $fieldstosearchall[
't.'.$key] = $val[
'label'];
115 $arrayfields = array(
116 'stockqty'=>array(
'type'=>
'float',
'label'=>
'PhysicalStock',
'enabled'=>1,
'visible'=>-2,
'checked'=>0,
'position'=>170),
117 'estimatedvalue'=>array(
'type'=>
'float',
'label'=>
'EstimatedStockValue',
'enabled'=>1,
'visible'=>1,
'checked'=>1,
'position'=>171),
118 'estimatedstockvaluesell'=>array(
'type'=>
'float',
'label'=>
'EstimatedStockValueSell',
'enabled'=>1,
'checked'=>1,
'visible'=>2,
'position'=>172),
120 foreach ($object->fields as $key => $val) {
122 if (!empty($val[
'visible'])) {
123 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
124 $arrayfields[
't.'.$key] = array(
125 'label'=>$val[
'label'],
126 'checked'=>(($visible < 0) ? 0 : 1),
127 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
128 'position'=>$val[
'position'],
129 'help'=> isset($val[
'help']) ? $val[
'help'] :
'help'
134 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
147 if (
GETPOST(
'cancel',
'alpha')) {
148 $action =
'list'; $massaction =
'';
150 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
154 $parameters = array();
155 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
160 if (empty($reshook)) {
162 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
165 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
166 foreach ($object->fields as $key => $val) {
170 $search_array_options = array();
171 $search_category_list = array();
173 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
174 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
179 $objectclass =
'Entrepot';
180 $objectlabel =
'Warehouse';
181 $permissiontoread = $user->rights->stock->lire;
182 $permissiontodelete = $user->rights->stock->supprimer;
183 $permissiontoadd = $user->rights->stock->creer;
184 $uploaddir = $conf->stock->dir_output;
185 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
198 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
199 $title = $langs->trans(
"Warehouses");
201 $totalarray = array();
202 $totalarray[
'nbfield'] = 0;
207 foreach ($object->fields as $key => $val) {
208 $sql .=
"t.".$key.
", ";
211 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
212 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
213 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
" as options_".$key.
', ' :
'');
218 $separatedPMP =
false;
219 if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) {
220 $separatedPMP =
true;
221 $sql .=
" SUM(pa.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
223 $sql .=
" SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
227 $parameters = array();
228 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
229 $sql .= $hookmanager->resPrint;
230 $sql = preg_replace(
'/,\s*$/',
'', $sql);
231 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
232 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
233 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
235 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_stock as ps ON t.rowid = ps.fk_entrepot";
236 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON ps.fk_product = p.rowid";
237 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as c_dep ON c_dep.rowid = t.fk_departement";
238 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as ccount ON ccount.rowid = t.fk_pays";
240 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_perentity as pa ON pa.fk_product = p.rowid AND pa.fk_product = ps.fk_product AND pa.entity = ". (int) $conf->entity;
242 $sql .=
" WHERE t.entity IN (".getEntity(
'stock').
")";
243 foreach ($search as $key => $val) {
245 if ($class_key ==
'status') {
246 $class_key =
'statut';
248 if (($key ==
'status' && $search[$key] == -1) || $key ==
'entity') {
251 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
252 if (strpos($object->fields[$key][
'type'],
'integer:') === 0) {
253 if ($search[$key] ==
'-1') {
258 if ($search[$key] !=
'') {
259 $sql .=
natural_search((($key ==
"ref") ?
"t.ref" :
"t.".$class_key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
263 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
266 $searchCategoryWarehouseList = $search_category_list;
267 $searchCategoryWarehouseOperator = 0;
268 if (!empty($searchCategoryWarehouseList)) {
269 $searchCategoryWarehouseSqlList = array();
270 $listofcategoryid =
'';
271 foreach ($searchCategoryWarehouseList as $searchCategoryWarehouse) {
272 if (intval($searchCategoryWarehouse) == -2) {
273 $searchCategoryWarehouseSqlList[] =
"NOT EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX.
"categorie_warehouse as ck WHERE p.rowid = ck.fk_warehouse)";
274 } elseif (intval($searchCategoryWarehouse) > 0) {
275 if ($searchCategoryWarehouseOperator == 0) {
276 $searchCategoryWarehouseSqlList[] =
" EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX.
"categorie_warehouse as ck WHERE p.rowid = ck.fk_warehouse AND ck.fk_categorie = ".((int) $searchCategoryWarehouse).
")";
278 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryWarehouse);
282 if ($listofcategoryid) {
283 $searchCategoryWarehouseSqlList[] =
" EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX.
"categorie_warehouse as ck WHERE p.rowid = ck.fk_warehouse AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
285 if ($searchCategoryWarehouseOperator == 1) {
286 if (!empty($searchCategoryWarehouseSqlList)) {
287 $sql .=
" AND (".implode(
' OR ', $searchCategoryWarehouseSqlList).
")";
290 if (!empty($searchCategoryWarehouseSqlList)) {
291 $sql .=
" AND (".implode(
' AND ', $searchCategoryWarehouseSqlList).
")";
297 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
299 $parameters = array();
300 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
301 $sql .= $hookmanager->resPrint;
302 $sql .=
" GROUP BY ";
303 foreach ($object->fields as $key => $val) {
304 $sql .=
"t.".$key.
", ";
307 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
308 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
309 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
313 $parameters = array();
314 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters);
315 $sql .= $hookmanager->resPrint;
316 $sql = preg_replace(
'/,\s*$/',
'', $sql);
319 $result = $db->query($sql);
321 $totalnboflines = $db->num_rows($result);
323 $line = $total = $totalsell = $totalStock = 0;
324 while ($line < $totalnboflines) {
325 $objp = $db->fetch_object($result);
326 $total += $objp->estimatedvalue;
327 $totalsell += $objp->sellvalue;
328 $totalStock += $objp->stockqty;
331 $totalarray[
'val'][
'stockqty'] =
price2num($totalStock,
'MS');
332 $totalarray[
'val'][
'estimatedvalue'] =
price2num($total,
'MT');
333 $totalarray[
'val'][
'estimatedstockvaluesell'] =
price2num($totalsell,
'MT');
335 $sql .= $db->order($sortfield, $sortorder);
339 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
340 $resql = $db->query($sql);
352 $sql .= $db->plimit($limit + 1, $offset);
355 $resql = $db->query($sql);
361 $num = $db->num_rows(
$resql);
365 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
366 $obj = $db->fetch_object(
$resql);
368 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/card.php?id='.$id);
378 $arrayofselected = is_array($toselect) ? $toselect : array();
382 $param .=
'&mode='.urlencode($mode);
384 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
385 $param .=
'&contextpage='.urlencode($contextpage);
387 if ($limit > 0 && $limit != $conf->liste_limit) {
388 $param .=
'&limit='.urlencode($limit);
390 foreach ($search as $key => $val) {
391 if (is_array($search[$key]) && count($search[$key])) {
392 foreach ($search[$key] as $skey) {
393 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
396 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
399 if ($optioncss !=
'') {
400 $param .=
'&optioncss='.urlencode($optioncss);
403 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
406 $arrayofmassactions = array(
411 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
412 $arrayofmassactions = array();
414 if (
isModEnabled(
'category') && $user->rights->stock->creer) {
415 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'label',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
417 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
419 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" id="searchFormList" method="POST" name="formulaire">';
420 if ($optioncss !=
'') {
421 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
423 print
'<input type="hidden" name="token" value="'.newToken().
'">';
424 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
425 print
'<input type="hidden" name="action" value="list">';
426 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
427 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
428 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
429 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
433 $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'));
434 $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'));
435 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuNewWarehouse'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $user->rights->stock->creer);
437 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'stock', 0, $newcardbutton,
'', $limit, 0, 0, 1);
440 $topicmail =
"Information";
441 $modelmail =
"warehouse";
443 $trackid =
'ware'.$object->id;
444 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
448 foreach ($fieldstosearchall as $key => $val) {
449 $fieldstosearchall[$key] = $langs->trans($val);
451 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
456 if (
isModEnabled(
'categorie') && $user->rights->categorie->lire) {
458 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list);
465 $parameters = array();
466 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
467 if (empty($reshook)) {
468 $moreforfilter .= $hookmanager->resPrint;
470 $moreforfilter = $hookmanager->resPrint;
473 if (!empty($moreforfilter)) {
474 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
475 print $moreforfilter;
479 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
480 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
481 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
483 print
'<div class="div-table-responsive">';
484 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
488 print
'<tr class="liste_titre_filter">';
490 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
491 print
'<td class="liste_titre maxwidthsearch">';
492 $searchpicto =
$form->showFilterButtons(
'left');
496 foreach ($object->fields as $key => $val) {
497 if ($key ==
'statut') {
500 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
501 if ($key ==
'status') {
502 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
503 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
504 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
505 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
506 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
507 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
508 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
510 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
511 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
512 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
513 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], $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, $search[$key],
'',
'',
'search_',
'maxwidth125', 1);
516 } elseif (!preg_match(
'/^(date|timestamp)/', $val[
'type'])) {
517 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(!empty($search[$key])?$search[$key]:
'').
'">';
523 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
524 print
'<td class="liste_titre"></td>';
527 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
528 print
'<td class="liste_titre"></td>';
531 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
532 print
'<td class="liste_titre"></td>';
536 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
539 $parameters = array(
'arrayfields'=>$arrayfields);
540 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
541 print $hookmanager->resPrint;
544 if (!empty($arrayfields[
't.statut'][
'checked'])) {
545 print
'<td class="liste_titre center">';
546 print
$form->selectarray(
'search_status', $warehouse->statuts, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'onrightofpage');
551 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
552 print
'<td class="liste_titre maxwidthsearch">';
553 $searchpicto =
$form->showFilterButtons();
561 print
'<tr class="liste_titre">';
564 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
565 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
567 foreach ($object->fields as $key => $val) {
568 if ($key ==
'statut') {
571 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
572 if ($key ==
'status') {
573 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
574 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
575 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
576 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
577 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
578 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
579 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
581 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
582 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
586 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
587 print_liste_field_titre(
"PhysicalStock", $_SERVER[
"PHP_SELF"],
"stockqty",
'', $param,
'', $sortfield, $sortorder,
'right ');
590 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
591 print_liste_field_titre(
"EstimatedStockValue", $_SERVER[
"PHP_SELF"],
"estimatedvalue",
'', $param,
'', $sortfield, $sortorder,
'right ');
594 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
595 print_liste_field_titre(
"EstimatedStockValueSell", $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ');
599 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
602 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
603 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
604 print $hookmanager->resPrint;
606 if (!empty($arrayfields[
't.statut'][
'checked'])) {
607 print_liste_field_titre($arrayfields[
't.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"t.statut",
'', $param,
'', $sortfield, $sortorder,
'center ');
611 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
612 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
622 while ($i < min($num, $limit)) {
623 $obj = $db->fetch_object(
$resql);
629 $warehouse->setVarsFromFetchObj($obj);
631 $warehouse->label = $warehouse->ref;
632 $warehouse->sellvalue = $obj->sellvalue;
634 if ($mode ==
'kanban') {
636 print
'<tr><td colspan="12">';
637 print
'<div class="box-flex-container">';
640 print $warehouse->getKanbanView(
'');
642 if ($i == ($imaxinloop - 1)) {
648 print
'<tr class="oddeven">';
651 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
652 print
'<td class="nowrap center">';
653 if ($massactionbutton || $massaction) {
655 if (in_array($obj->rowid, $arrayofselected)) {
658 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
662 foreach ($warehouse->fields as $key => $val) {
663 if ($key ==
'statut') {
666 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
667 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
668 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
669 } elseif ($key ==
'status') {
670 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
673 if (in_array($val[
'type'], array(
'timestamp'))) {
674 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
675 } elseif ($key ==
'ref') {
676 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
679 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'status' && empty($val[
'arrayofkeyval'])) {
680 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
682 if (in_array($key, array(
'fk_soc',
'fk_user',
'fk_warehouse'))) {
683 $cssforfield =
'tdoverflowmax100';
686 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
687 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
688 if ($key ==
'statut') {
689 print $warehouse->getLibStatut(5);
691 if ($key ==
'phone') {
693 } elseif ($key ==
'fax') {
696 print $warehouse->showOutputField($val, $key, $warehouse->$key,
'');
700 $totalarray[
'nbfield']++;
702 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
704 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
706 if (!isset($totalarray[
'val'])) {
707 $totalarray[
'val'] = array();
709 if (!isset($totalarray[
'val'][
't.'.$key])) {
710 $totalarray[
'val'][
't.'.$key] = 0;
712 $totalarray[
'val'][
't.'.$key] += $warehouse->$key;
718 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
719 print
'<td class="right">'.price2num($obj->stockqty, 5).
'</td>';
721 $totalarray[
'nbfield']++;
724 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'stockqty';
729 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
730 print
'<td class="right">';
731 if (
price2num($obj->estimatedvalue,
'MT')) {
732 print
'<span class="amount">'.price(
price2num($obj->estimatedvalue,
'MT'), 1).
'</span>';
738 $totalarray[
'nbfield']++;
741 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'estimatedvalue';
746 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
747 print
'<td class="right">';
748 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
749 if ($obj->sellvalue) {
750 print
'<span class="amount">'.price(
price2num($obj->sellvalue,
'MT'), 1).
'</span>';
753 $htmltext = $langs->trans(
"OptionMULTIPRICESIsOn");
754 print
$form->textwithtooltip(
'<span class="opacitymedium">'.$langs->trans(
"Variable").
'</span>', $htmltext);
758 $totalarray[
'nbfield']++;
761 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'estimatedstockvaluesell';
766 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
768 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
769 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
770 print $hookmanager->resPrint;
773 if (!empty($arrayfields[
't.statut'][
'checked'])) {
774 print
'<td class="center">'.$warehouse->LibStatut($obj->statut, 5).
'</td>';
776 $totalarray[
'nbfield']++;
781 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
782 print
'<td class="nowrap center">';
783 if ($massactionbutton || $massaction) {
785 if (in_array($obj->rowid, $arrayofselected)) {
788 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
793 $totalarray[
'nbfield']++;
802 if ($totalnboflines - $offset <= $limit) {
804 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
810 foreach ($arrayfields as $key => $val) {
811 if (!empty($val[
'checked'])) {
815 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
820 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
821 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
822 print $hookmanager->resPrint;
824 print
'</table>'.
"\n";
827 print
'</form>'.
"\n";
830 $hidegeneratedfilelistifempty = 1;
831 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
832 $hidegeneratedfilelistifempty = 0;
835 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
839 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
840 $urlsource .= str_replace(
'&',
'&', $param);
842 $filedir = $diroutputmassaction;
843 $genallowed = $user->rights->stock->lire;
844 $delallowed = $user->rights->stock->creer;
846 print $formfile->showdocuments(
'massfilesarea_stock',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage warehouses.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0)
Format phone numbers according to country.
dol_now($mode='auto')
Return date for now.
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.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
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.