diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php
index 55d6a518250..c5e98935ebb 100644
--- a/htdocs/admin/stock.php
+++ b/htdocs/admin/stock.php
@@ -743,6 +743,21 @@ if ($conf->use_javascript_ajax) {
}
print "\n";
print "\n";
+
+if (!empty($conf->productbatch->enabled)) {
+ print '
';
+ print '| ' . $langs->trans("ShowAllBatchByDefault") . ' | ';
+ print '';
+ if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('STOCK_SHOW_ALL_BATCH_BY_DEFAULT');
+ } else {
+ $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
+ print $form->selectarray("STOCK_SHOW_ALL_BATCH_BY_DEFAULT", $arrval, $conf->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT);
+ }
+ print " | \n";
+ print "
\n";
+}
+
print '';
print '';
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index ee9edc6694b..19dd7b59b3b 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -250,6 +250,12 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
}
+
+// Add table from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
+
if (!$user->rights->societe->client->voir && empty($socid)) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index 5f60715ae2a..df1034eb43f 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -254,4 +254,5 @@ ReOpen=Reopen
ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock.
ObjectNotFound=%s not found
MakeMovementsAndClose=Generate movements and close
-AutofillWithExpected=Fill real quantity with expected quantity
\ No newline at end of file
+AutofillWithExpected=Fill real quantity with expected quantity
+ShowAllBatchByDefault=By default, show batch details on product "stock" tab
diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang
index 811f64f0d84..2e6e3d257ee 100644
--- a/htdocs/langs/fr_FR/stocks.lang
+++ b/htdocs/langs/fr_FR/stocks.lang
@@ -255,3 +255,4 @@ ConfirmFinish=Do you confirm the closing of the inventory ? This will generate a
ObjectNotFound=%s not found
MakeMovementsAndClose=Generate movements and close
AutofillWithExpected=Fill real quantity with expected quantity
+ShowAllBatchByDefault=Dérouler par défaut le détail des lots dans l'onglet "stock"
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index b97e9b6c2d2..5418e82f17e 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -9,6 +9,7 @@
* Copyright (C) 2014-2015 Cédric Gross
* Copyright (C) 2015 Marcos García
* Copyright (C) 2018-2019 Frédéric France
+ * Copyright (C) 2021 Gauthier VERDOL
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -521,6 +522,44 @@ if ($id > 0 || $ref) {
llxHeader('', $title, $helpurl);
+ ?>
+
+
+
+ 0) {
$head = product_prepare_head($object);
$titre = $langs->trans("CardProduct".$object->type);
@@ -859,7 +898,10 @@ if (!$variants) {
print '';
if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) {
$colspan = 3;
- print ' | ';
+ print '
';
+ print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").' ';
+ print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'';
+ print ' | ';
print ''.$langs->trans("batch_number").' | ';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
$colspan--;
@@ -914,7 +956,11 @@ if (!$variants) {
$stock_real = price2num($obj->reel, 'MS');
print '
';
- print '| '.$entrepotstatic->getNomUrl(1).' | ';
+ print '';
+ if (!empty($conf->productbatch->enabled)) {
+ print '' . (empty($conf->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
+ }
+ print $entrepotstatic->getNomUrl(1).' | ';
print ''.$stock_real.($stock_real < 0 ? ' '.img_warning() : '').' | ';
// PMP
print ''.(price2num($object->pmp) ? price2num($object->pmp, 'MU') : '').' | ';
@@ -984,7 +1030,7 @@ if (!$variants) {
print ' | ';
print '
';
} else {
- print "\n".'| ';
+ print "\n".' |
| ';
print ' | ';
print '';
print $product_lot_static->getNomUrl(1);
|