28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
31 if (!empty($conf->categorie->enabled)) {
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
37 $langs->loadLangs(array(
"stocks",
"other"));
39 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
40 $massaction =
GETPOST(
'massaction',
'alpha');
41 $show_files =
GETPOST(
'show_files',
'int');
42 $confirm =
GETPOST(
'confirm',
'alpha');
43 $cancel =
GETPOST(
'cancel',
'alpha');
44 $toselect =
GETPOST(
'toselect',
'array');
45 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'stocklist';
46 $backtopage =
GETPOST(
'backtopage',
'alpha');
47 $optioncss =
GETPOST(
'optioncss',
'aZ');
48 $toselect =
GETPOST(
'toselect',
'array');
51 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
53 $search_label =
GETPOST(
"snom",
"alpha") ?
GETPOST(
"snom",
"alpha") :
GETPOST(
"search_label",
"alpha");
54 $search_status =
GETPOST(
"search_status",
"int");
56 if (!empty($conf->categorie->enabled)) {
57 $search_category_list =
GETPOST(
"search_category_".Categorie::TYPE_WAREHOUSE.
"_list",
"array");
61 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
62 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
63 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
65 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
68 $offset = $limit * $page;
69 $pageprev = $page - 1;
70 $pagenext = $page + 1;
81 $diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
82 $hookmanager->initHooks(array(
'stocklist'));
85 $extrafields->fetch_name_optionals_label($object->table_element);
87 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
91 $search_all =
GETPOST(
"search_all",
'alpha');
93 foreach ($object->fields as $key => $val) {
95 if ($search_key ==
'statut') {
96 $search_key =
'status';
98 if (
GETPOST(
'search_'.$search_key,
'alpha') !==
'') {
99 $search[$search_key] =
GETPOST(
'search_'.$search_key,
'alpha');
104 $fieldstosearchall = array();
105 foreach ($object->fields as $key => $val) {
106 if (!empty($val[
'searchall'])) {
107 $fieldstosearchall[
't.'.$key] = $val[
'label'];
112 $arrayfields = array(
113 'stockqty'=>array(
'type'=>
'float',
'label'=>
'PhysicalStock',
'enabled'=>1,
'visible'=>-2,
'checked'=>0,
'position'=>170),
114 'estimatedvalue'=>array(
'type'=>
'float',
'label'=>
'EstimatedStockValue',
'enabled'=>1,
'visible'=>1,
'checked'=>1,
'position'=>171),
115 'estimatedstockvaluesell'=>array(
'type'=>
'float',
'label'=>
'EstimatedStockValueSell',
'enabled'=>1,
'checked'=>1,
'visible'=>2,
'position'=>172),
117 foreach ($object->fields as $key => $val) {
119 if (!empty($val[
'visible'])) {
120 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
121 $arrayfields[
't.'.$key] = array(
122 'label'=>$val[
'label'],
123 'checked'=>(($visible < 0) ? 0 : 1),
124 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
125 'position'=>$val[
'position'],
126 'help'=> isset($val[
'help']) ? $val[
'help'] :
'help'
131 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
144 if (
GETPOST(
'cancel',
'alpha')) {
145 $action =
'list'; $massaction =
'';
147 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
151 $parameters = array();
152 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
157 if (empty($reshook)) {
159 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
162 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
163 foreach ($object->fields as $key => $val) {
167 $search_array_options = array();
168 $search_category_list = array();
170 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
171 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
176 $objectclass =
'Entrepot';
177 $objectlabel =
'Warehouse';
178 $permissiontoread = $user->rights->stock->lire;
179 $permissiontodelete = $user->rights->stock->supprimer;
180 $permissiontoadd = $user->rights->stock->creer;
181 $uploaddir = $conf->stock->dir_output;
182 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
195 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
196 $title = $langs->trans(
"ListOfWarehouses");
198 $totalarray = array();
199 $totalarray[
'nbfield'] = 0;
204 foreach ($object->fields as $key => $val) {
205 $sql .=
"t.".$key.
", ";
208 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
209 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
210 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
" as options_".$key.
', ' :
'');
215 $separatedPMP =
false;
216 if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) {
217 $separatedPMP =
true;
218 $sql .=
" SUM(pa.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
220 $sql .=
" SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
224 $parameters = array();
225 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
226 $sql .= $hookmanager->resPrint;
227 $sql = preg_replace(
'/,\s*$/',
'', $sql);
228 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
229 if (!empty($conf->categorie->enabled)) {
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;
243 $sql .=
" WHERE t.entity IN (".getEntity(
'stock').
")";
245 if (!empty($conf->categorie->enabled)) {
248 foreach ($search as $key => $val) {
250 if ($class_key ==
'status') {
251 $class_key =
'statut';
253 if (($key ==
'status' && $search[$key] == -1) || $key ==
'entity') {
256 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
257 if (strpos($object->fields[$key][
'type'],
'integer:') === 0) {
258 if ($search[$key] ==
'-1') {
263 if ($search[$key] !=
'') {
264 $sql .=
natural_search((($key ==
"ref") ?
"t.ref" :
"t.".$class_key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
268 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
271 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
273 $parameters = array();
274 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
275 $sql .= $hookmanager->resPrint;
276 $sql .=
" GROUP BY ";
277 foreach ($object->fields as $key => $val) {
278 $sql .=
"t.".$key.
", ";
281 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
282 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
283 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
287 $parameters = array();
288 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters);
289 $sql .= $hookmanager->resPrint;
290 $sql = preg_replace(
'/,\s*$/',
'', $sql);
293 $result = $db->query($sql);
295 $totalnboflines = $db->num_rows($result);
297 $line = $total = $totalsell = $totalStock = 0;
298 while ($line < $totalnboflines) {
299 $objp = $db->fetch_object($result);
300 $total += $objp->estimatedvalue;
301 $totalsell += $objp->sellvalue;
302 $totalStock += $objp->stockqty;
305 $totalarray[
'val'][
'stockqty'] =
price2num($totalStock,
'MS');
306 $totalarray[
'val'][
'estimatedvalue'] =
price2num($total,
'MT');
307 $totalarray[
'val'][
'estimatedstockvaluesell'] =
price2num($totalsell,
'MT');
309 $sql .= $db->order($sortfield, $sortorder);
312 $nbtotalofrecords =
'';
313 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
314 $resql = $db->query($sql);
315 $nbtotalofrecords = $db->num_rows(
$resql);
316 if (($page * $limit) > $nbtotalofrecords) {
322 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
323 $num = $nbtotalofrecords;
326 $sql .= $db->plimit($limit + 1, $offset);
329 $resql = $db->query($sql);
335 $num = $db->num_rows(
$resql);
339 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
340 $obj = $db->fetch_object(
$resql);
342 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/card.php?id='.$id);
352 $arrayofselected = is_array($toselect) ? $toselect : array();
355 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
356 $param .=
'&contextpage='.urlencode($contextpage);
358 if ($limit > 0 && $limit != $conf->liste_limit) {
359 $param .=
'&limit='.urlencode($limit);
361 foreach ($search as $key => $val) {
362 if (is_array($search[$key]) && count($search[$key])) {
363 foreach ($search[$key] as $skey) {
364 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
367 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
370 if ($optioncss !=
'') {
371 $param .=
'&optioncss='.urlencode($optioncss);
374 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
377 $arrayofmassactions = array(
382 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
383 $arrayofmassactions = array();
385 if (
isModEnabled(
'category') && $user->rights->stock->creer) {
386 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'label',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
388 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
390 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" id="searchFormList" method="POST" name="formulaire">';
391 if ($optioncss !=
'') {
392 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
394 print
'<input type="hidden" name="token" value="'.newToken().
'">';
395 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
396 print
'<input type="hidden" name="action" value="list">';
397 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
398 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
399 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
401 $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);
403 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'stock', 0, $newcardbutton,
'', $limit, 0, 0, 1);
406 $topicmail =
"Information";
407 $modelmail =
"warehouse";
409 $trackid =
'ware'.$object->id;
410 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
414 foreach ($fieldstosearchall as $key => $val) {
415 $fieldstosearchall[$key] = $langs->trans($val);
417 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
422 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
424 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list);
431 $parameters = array();
432 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
433 if (empty($reshook)) {
434 $moreforfilter .= $hookmanager->resPrint;
436 $moreforfilter = $hookmanager->resPrint;
439 if (!empty($moreforfilter)) {
440 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
441 print $moreforfilter;
445 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
446 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
447 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
449 print
'<div class="div-table-responsive">';
450 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
454 print
'<tr class="liste_titre_filter">';
456 foreach ($object->fields as $key => $val) {
457 if ($key ==
'statut') {
460 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
461 if ($key ==
'status') {
462 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
463 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
464 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
465 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
466 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
467 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
468 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
470 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
471 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
472 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
473 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], $search[$key], $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
474 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
475 print $object->showInputField($val, $key, $search[$key],
'',
'',
'search_',
'maxwidth125', 1);
476 } elseif (!preg_match(
'/^(date|timestamp)/', $val[
'type'])) {
477 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(!empty($search[$key])?$search[$key]:
'').
'">';
483 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
484 print
'<td class="liste_titre"></td>';
487 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
488 print
'<td class="liste_titre"></td>';
491 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
492 print
'<td class="liste_titre"></td>';
496 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
499 $parameters = array(
'arrayfields'=>$arrayfields);
500 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
501 print $hookmanager->resPrint;
504 if (!empty($arrayfields[
't.statut'][
'checked'])) {
505 print
'<td class="liste_titre center">';
506 print
$form->selectarray(
'search_status', $warehouse->statuts, $search_status, 1, 0, 0,
'', 1);
511 print
'<td class="liste_titre maxwidthsearch">';
512 $searchpicto =
$form->showFilterButtons();
519 print
'<tr class="liste_titre">';
521 foreach ($object->fields as $key => $val) {
522 if ($key ==
'statut') {
525 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
526 if ($key ==
'status') {
527 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
528 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
529 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
530 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
531 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
532 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
533 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
535 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
536 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
540 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
541 print_liste_field_titre(
"PhysicalStock", $_SERVER[
"PHP_SELF"],
"stockqty",
'', $param,
'', $sortfield, $sortorder,
'right ');
544 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
545 print_liste_field_titre(
"EstimatedStockValue", $_SERVER[
"PHP_SELF"],
"estimatedvalue",
'', $param,
'', $sortfield, $sortorder,
'right ');
548 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
549 print_liste_field_titre(
"EstimatedStockValueSell", $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ');
553 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
556 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
557 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
558 print $hookmanager->resPrint;
560 if (!empty($arrayfields[
't.statut'][
'checked'])) {
561 print_liste_field_titre($arrayfields[
't.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"t.statut",
'', $param,
'', $sortfield, $sortorder,
'center ');
565 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
574 while ($i < min($num, $limit)) {
575 $obj = $db->fetch_object(
$resql);
581 $warehouse->setVarsFromFetchObj($obj);
583 $warehouse->label = $warehouse->ref;
586 print
'<tr class="oddeven">';
588 foreach ($warehouse->fields as $key => $val) {
589 if ($key ==
'statut') {
592 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
593 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
594 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
595 } elseif ($key ==
'status') {
596 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
599 if (in_array($val[
'type'], array(
'timestamp'))) {
600 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
601 } elseif ($key ==
'ref') {
602 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
605 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'status' && empty($val[
'arrayofkeyval'])) {
606 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
608 if (in_array($key, array(
'fk_soc',
'fk_user',
'fk_warehouse'))) {
609 $cssforfield =
'tdoverflowmax100';
612 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
613 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
614 if ($key ==
'statut') {
615 print $warehouse->getLibStatut(5);
617 if ($key ==
'phone') {
619 } elseif ($key ==
'fax') {
622 print $warehouse->showOutputField($val, $key, $warehouse->$key,
'');
626 $totalarray[
'nbfield']++;
628 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
630 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
632 if (!isset($totalarray[
'val'])) {
633 $totalarray[
'val'] = array();
635 if (!isset($totalarray[
'val'][
't.'.$key])) {
636 $totalarray[
'val'][
't.'.$key] = 0;
638 $totalarray[
'val'][
't.'.$key] += $warehouse->$key;
644 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
645 print
'<td class="right">'.price2num($obj->stockqty, 5).
'</td>';
647 $totalarray[
'nbfield']++;
650 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'stockqty';
655 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
656 print
'<td class="right">';
657 if (
price2num($obj->estimatedvalue,
'MT')) {
658 print
'<span class="amount">'.price(
price2num($obj->estimatedvalue,
'MT'), 1).
'</span>';
664 $totalarray[
'nbfield']++;
667 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'estimatedvalue';
672 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
673 print
'<td class="right">';
674 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
675 if ($obj->sellvalue) {
676 print
'<span class="amount">'.price(
price2num($obj->sellvalue,
'MT'), 1).
'</span>';
679 $htmltext = $langs->trans(
"OptionMULTIPRICESIsOn");
680 print
$form->textwithtooltip(
'<span class="opacitymedium">'.$langs->trans(
"Variable").
'</span>', $htmltext);
684 $totalarray[
'nbfield']++;
687 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'estimatedstockvaluesell';
692 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
694 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
695 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
696 print $hookmanager->resPrint;
699 if (!empty($arrayfields[
't.statut'][
'checked'])) {
700 print
'<td class="center">'.$warehouse->LibStatut($obj->statut, 5).
'</td>';
702 $totalarray[
'nbfield']++;
707 print
'<td class="nowrap center">';
708 if ($massactionbutton || $massaction) {
710 if (in_array($obj->rowid, $arrayofselected)) {
713 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
717 $totalarray[
'nbfield']++;
726 if ($totalnboflines - $offset <= $limit) {
728 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
734 foreach ($arrayfields as $key => $val) {
735 if (!empty($val[
'checked'])) {
739 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
744 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
745 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
746 print $hookmanager->resPrint;
748 print
'</table>'.
"\n";
751 print
'</form>'.
"\n";
753 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
754 $hidegeneratedfilelistifempty = 1;
755 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
756 $hidegeneratedfilelistifempty = 0;
759 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
763 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
764 $urlsource .= str_replace(
'&',
'&', $param);
766 $filedir = $diroutputmassaction;
767 $genallowed = $user->rights->stock->lire;
768 $delallowed = $user->rights->stock->creer;
770 print $formfile->showdocuments(
'massfilesarea_stock',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);