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");
58 $search_category_list =
GETPOST(
"search_category_".Categorie::TYPE_WAREHOUSE.
"_list",
"array");
62 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
63 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
64 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
66 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
69 $offset = $limit * $page;
70 $pageprev = $page - 1;
71 $pagenext = $page + 1;
82 $diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
83 $hookmanager->initHooks(array(
'stocklist'));
86 $extrafields->fetch_name_optionals_label($object->table_element);
88 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
92 $search_all =
GETPOST(
"search_all",
'alpha');
94 foreach ($object->fields as $key => $val) {
96 if ($search_key ==
'statut') {
97 $search_key =
'status';
99 if (
GETPOST(
'search_'.$search_key,
'alpha') !==
'') {
100 $search[$search_key] =
GETPOST(
'search_'.$search_key,
'alpha');
105 $fieldstosearchall = array();
106 foreach ($object->fields as $key => $val) {
107 if (!empty($val[
'searchall'])) {
108 $fieldstosearchall[
't.'.$key] = $val[
'label'];
113 $arrayfields = array(
114 'stockqty'=>array(
'type'=>
'float',
'label'=>
'PhysicalStock',
'enabled'=>1,
'visible'=>-2,
'checked'=>0,
'position'=>170),
115 'estimatedvalue'=>array(
'type'=>
'float',
'label'=>
'EstimatedStockValue',
'enabled'=>1,
'visible'=>1,
'checked'=>1,
'position'=>171),
116 'estimatedstockvaluesell'=>array(
'type'=>
'float',
'label'=>
'EstimatedStockValueSell',
'enabled'=>1,
'checked'=>1,
'visible'=>2,
'position'=>172),
118 foreach ($object->fields as $key => $val) {
120 if (!empty($val[
'visible'])) {
121 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
122 $arrayfields[
't.'.$key] = array(
123 'label'=>$val[
'label'],
124 'checked'=>(($visible < 0) ? 0 : 1),
125 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
126 'position'=>$val[
'position'],
127 'help'=> isset($val[
'help']) ? $val[
'help'] :
'help'
132 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
145 if (
GETPOST(
'cancel',
'alpha')) {
146 $action =
'list'; $massaction =
'';
148 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
152 $parameters = array();
153 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
158 if (empty($reshook)) {
160 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
163 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
164 foreach ($object->fields as $key => $val) {
168 $search_array_options = array();
169 $search_category_list = array();
171 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
172 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
177 $objectclass =
'Entrepot';
178 $objectlabel =
'Warehouse';
179 $permissiontoread = $user->rights->stock->lire;
180 $permissiontodelete = $user->rights->stock->supprimer;
181 $permissiontoadd = $user->rights->stock->creer;
182 $uploaddir = $conf->stock->dir_output;
183 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
196 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
197 $title = $langs->trans(
"Warehouses");
199 $totalarray = array();
200 $totalarray[
'nbfield'] = 0;
205 foreach ($object->fields as $key => $val) {
206 $sql .=
"t.".$key.
", ";
209 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
210 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
211 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
" as options_".$key.
', ' :
'');
216 $separatedPMP =
false;
217 if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) {
218 $separatedPMP =
true;
219 $sql .=
" SUM(pa.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
221 $sql .=
" SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
225 $parameters = array();
226 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
227 $sql .= $hookmanager->resPrint;
228 $sql = preg_replace(
'/,\s*$/',
'', $sql);
229 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
230 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
231 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
233 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_stock as ps ON t.rowid = ps.fk_entrepot";
234 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON ps.fk_product = p.rowid";
235 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as c_dep ON c_dep.rowid = t.fk_departement";
236 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as ccount ON ccount.rowid = t.fk_pays";
238 $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;
240 $sql .=
" WHERE t.entity IN (".getEntity(
'stock').
")";
241 foreach ($search as $key => $val) {
243 if ($class_key ==
'status') {
244 $class_key =
'statut';
246 if (($key ==
'status' && $search[$key] == -1) || $key ==
'entity') {
249 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
250 if (strpos($object->fields[$key][
'type'],
'integer:') === 0) {
251 if ($search[$key] ==
'-1') {
256 if ($search[$key] !=
'') {
257 $sql .=
natural_search((($key ==
"ref") ?
"t.ref" :
"t.".$class_key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
261 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
264 $searchCategoryWarehouseList = $search_category_list;
265 $searchCategoryWarehouseOperator = 0;
266 if (!empty($searchCategoryWarehouseList)) {
267 $searchCategoryWarehouseSqlList = array();
268 $listofcategoryid =
'';
269 foreach ($searchCategoryWarehouseList as $searchCategoryWarehouse) {
270 if (intval($searchCategoryWarehouse) == -2) {
271 $searchCategoryWarehouseSqlList[] =
"NOT EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX.
"categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse)";
272 } elseif (intval($searchCategoryWarehouse) > 0) {
273 if ($searchCategoryWarehouseOperator == 0) {
274 $searchCategoryWarehouseSqlList[] =
" EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX.
"categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse AND ck.fk_categorie = ".((int) $searchCategoryWarehouse).
")";
276 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryWarehouse);
280 if ($listofcategoryid) {
281 $searchCategoryWarehouseSqlList[] =
" EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX.
"categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
283 if ($searchCategoryWarehouseOperator == 1) {
284 if (!empty($searchCategoryWarehouseSqlList)) {
285 $sql .=
" AND (".implode(
' OR ', $searchCategoryWarehouseSqlList).
")";
288 if (!empty($searchCategoryWarehouseSqlList)) {
289 $sql .=
" AND (".implode(
' AND ', $searchCategoryWarehouseSqlList).
")";
295 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
297 $parameters = array();
298 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
299 $sql .= $hookmanager->resPrint;
300 $sql .=
" GROUP BY ";
301 foreach ($object->fields as $key => $val) {
302 $sql .=
"t.".$key.
", ";
305 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
306 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
307 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
311 $parameters = array();
312 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters);
313 $sql .= $hookmanager->resPrint;
314 $sql = preg_replace(
'/,\s*$/',
'', $sql);
317 $result = $db->query($sql);
319 $totalnboflines = $db->num_rows($result);
321 $line = $total = $totalsell = $totalStock = 0;
322 while ($line < $totalnboflines) {
323 $objp = $db->fetch_object($result);
324 $total += $objp->estimatedvalue;
325 $totalsell += $objp->sellvalue;
326 $totalStock += $objp->stockqty;
329 $totalarray[
'val'][
'stockqty'] =
price2num($totalStock,
'MS');
330 $totalarray[
'val'][
'estimatedvalue'] =
price2num($total,
'MT');
331 $totalarray[
'val'][
'estimatedstockvaluesell'] =
price2num($totalsell,
'MT');
333 $sql .= $db->order($sortfield, $sortorder);
337 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
338 $resql = $db->query($sql);
350 $sql .= $db->plimit($limit + 1, $offset);
353 $resql = $db->query($sql);
359 $num = $db->num_rows(
$resql);
363 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
364 $obj = $db->fetch_object(
$resql);
366 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/card.php?id='.$id);
376 $arrayofselected = is_array($toselect) ? $toselect : array();
379 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
380 $param .=
'&contextpage='.urlencode($contextpage);
382 if ($limit > 0 && $limit != $conf->liste_limit) {
383 $param .=
'&limit='.urlencode($limit);
385 foreach ($search as $key => $val) {
386 if (is_array($search[$key]) && count($search[$key])) {
387 foreach ($search[$key] as $skey) {
388 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
391 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
394 if ($optioncss !=
'') {
395 $param .=
'&optioncss='.urlencode($optioncss);
398 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
401 $arrayofmassactions = array(
406 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
407 $arrayofmassactions = array();
409 if (
isModEnabled(
'category') && $user->rights->stock->creer) {
410 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'label',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
412 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
414 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" id="searchFormList" method="POST" name="formulaire">';
415 if ($optioncss !=
'') {
416 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
418 print
'<input type="hidden" name="token" value="'.newToken().
'">';
419 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
420 print
'<input type="hidden" name="action" value="list">';
421 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
422 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
423 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
425 $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);
427 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'stock', 0, $newcardbutton,
'', $limit, 0, 0, 1);
430 $topicmail =
"Information";
431 $modelmail =
"warehouse";
433 $trackid =
'ware'.$object->id;
434 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
438 foreach ($fieldstosearchall as $key => $val) {
439 $fieldstosearchall[$key] = $langs->trans($val);
441 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
446 if (
isModEnabled(
'categorie') && $user->rights->categorie->lire) {
448 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list);
455 $parameters = array();
456 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
457 if (empty($reshook)) {
458 $moreforfilter .= $hookmanager->resPrint;
460 $moreforfilter = $hookmanager->resPrint;
463 if (!empty($moreforfilter)) {
464 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
465 print $moreforfilter;
469 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
470 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
471 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
473 print
'<div class="div-table-responsive">';
474 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
478 print
'<tr class="liste_titre_filter">';
480 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
481 print
'<td class="liste_titre maxwidthsearch">';
482 $searchpicto =
$form->showFilterButtons(
'left');
486 foreach ($object->fields as $key => $val) {
487 if ($key ==
'statut') {
490 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
491 if ($key ==
'status') {
492 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
493 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
494 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
495 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
496 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
497 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
498 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
500 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
501 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
502 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
503 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], $search[$key], $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
504 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
505 print $object->showInputField($val, $key, $search[$key],
'',
'',
'search_',
'maxwidth125', 1);
506 } elseif (!preg_match(
'/^(date|timestamp)/', $val[
'type'])) {
507 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(!empty($search[$key])?$search[$key]:
'').
'">';
513 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
514 print
'<td class="liste_titre"></td>';
517 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
518 print
'<td class="liste_titre"></td>';
521 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
522 print
'<td class="liste_titre"></td>';
526 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
529 $parameters = array(
'arrayfields'=>$arrayfields);
530 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
531 print $hookmanager->resPrint;
534 if (!empty($arrayfields[
't.statut'][
'checked'])) {
535 print
'<td class="liste_titre center">';
536 print
$form->selectarray(
'search_status', $warehouse->statuts, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'onrightofpage');
541 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
542 print
'<td class="liste_titre maxwidthsearch">';
543 $searchpicto =
$form->showFilterButtons();
551 print
'<tr class="liste_titre">';
554 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
555 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
557 foreach ($object->fields as $key => $val) {
558 if ($key ==
'statut') {
561 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
562 if ($key ==
'status') {
563 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
564 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
565 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
566 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
567 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
568 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
569 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
571 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
572 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
576 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
577 print_liste_field_titre(
"PhysicalStock", $_SERVER[
"PHP_SELF"],
"stockqty",
'', $param,
'', $sortfield, $sortorder,
'right ');
580 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
581 print_liste_field_titre(
"EstimatedStockValue", $_SERVER[
"PHP_SELF"],
"estimatedvalue",
'', $param,
'', $sortfield, $sortorder,
'right ');
584 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
585 print_liste_field_titre(
"EstimatedStockValueSell", $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ');
589 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
592 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
593 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
594 print $hookmanager->resPrint;
596 if (!empty($arrayfields[
't.statut'][
'checked'])) {
597 print_liste_field_titre($arrayfields[
't.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"t.statut",
'', $param,
'', $sortfield, $sortorder,
'center ');
601 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
602 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
612 while ($i < min($num, $limit)) {
613 $obj = $db->fetch_object(
$resql);
619 $warehouse->setVarsFromFetchObj($obj);
621 $warehouse->label = $warehouse->ref;
624 print
'<tr class="oddeven">';
627 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
628 print
'<td class="nowrap center">';
629 if ($massactionbutton || $massaction) {
631 if (in_array($obj->rowid, $arrayofselected)) {
634 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
638 foreach ($warehouse->fields as $key => $val) {
639 if ($key ==
'statut') {
642 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
643 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
644 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
645 } elseif ($key ==
'status') {
646 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
649 if (in_array($val[
'type'], array(
'timestamp'))) {
650 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
651 } elseif ($key ==
'ref') {
652 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
655 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'status' && empty($val[
'arrayofkeyval'])) {
656 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
658 if (in_array($key, array(
'fk_soc',
'fk_user',
'fk_warehouse'))) {
659 $cssforfield =
'tdoverflowmax100';
662 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
663 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
664 if ($key ==
'statut') {
665 print $warehouse->getLibStatut(5);
667 if ($key ==
'phone') {
669 } elseif ($key ==
'fax') {
672 print $warehouse->showOutputField($val, $key, $warehouse->$key,
'');
676 $totalarray[
'nbfield']++;
678 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
680 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
682 if (!isset($totalarray[
'val'])) {
683 $totalarray[
'val'] = array();
685 if (!isset($totalarray[
'val'][
't.'.$key])) {
686 $totalarray[
'val'][
't.'.$key] = 0;
688 $totalarray[
'val'][
't.'.$key] += $warehouse->$key;
694 if (!empty($arrayfields[
"stockqty"][
'checked'])) {
695 print
'<td class="right">'.price2num($obj->stockqty, 5).
'</td>';
697 $totalarray[
'nbfield']++;
700 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'stockqty';
705 if (!empty($arrayfields[
"estimatedvalue"][
'checked'])) {
706 print
'<td class="right">';
707 if (
price2num($obj->estimatedvalue,
'MT')) {
708 print
'<span class="amount">'.price(
price2num($obj->estimatedvalue,
'MT'), 1).
'</span>';
714 $totalarray[
'nbfield']++;
717 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'estimatedvalue';
722 if (!empty($arrayfields[
"estimatedstockvaluesell"][
'checked'])) {
723 print
'<td class="right">';
724 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
725 if ($obj->sellvalue) {
726 print
'<span class="amount">'.price(
price2num($obj->sellvalue,
'MT'), 1).
'</span>';
729 $htmltext = $langs->trans(
"OptionMULTIPRICESIsOn");
730 print
$form->textwithtooltip(
'<span class="opacitymedium">'.$langs->trans(
"Variable").
'</span>', $htmltext);
734 $totalarray[
'nbfield']++;
737 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'estimatedstockvaluesell';
742 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
744 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
745 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
746 print $hookmanager->resPrint;
749 if (!empty($arrayfields[
't.statut'][
'checked'])) {
750 print
'<td class="center">'.$warehouse->LibStatut($obj->statut, 5).
'</td>';
752 $totalarray[
'nbfield']++;
757 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
758 print
'<td class="nowrap center">';
759 if ($massactionbutton || $massaction) {
761 if (in_array($obj->rowid, $arrayofselected)) {
764 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
769 $totalarray[
'nbfield']++;
778 if ($totalnboflines - $offset <= $limit) {
780 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
786 foreach ($arrayfields as $key => $val) {
787 if (!empty($val[
'checked'])) {
791 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
796 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
797 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
798 print $hookmanager->resPrint;
800 print
'</table>'.
"\n";
803 print
'</form>'.
"\n";
806 $hidegeneratedfilelistifempty = 1;
807 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
808 $hidegeneratedfilelistifempty = 0;
811 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
815 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
816 $urlsource .= str_replace(
'&',
'&', $param);
818 $filedir = $diroutputmassaction;
819 $genallowed = $user->rights->stock->lire;
820 $delallowed = $user->rights->stock->creer;
822 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.