From a6c6f9eb08443c2dd4e0c4e7568573ed08002521 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Mon, 19 Apr 2021 10:20:51 +0200 Subject: [PATCH 1/4] add missing printFieldListFrom hook --- htdocs/fichinter/list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d054f5e5bcc..d690feb7407 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -223,6 +223,10 @@ if (!empty($conf->contrat->enabled)) { } if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)"; 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"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE f.entity IN (".getEntity('intervention').")"; From 894eb1e5a418f9e0c2d7c60490a8dfc1083bee17 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 19 Apr 2021 14:34:11 +0200 Subject: [PATCH 2/4] NEW : "+" and "-" to show / hide batch details on product "stock" tab --- htdocs/admin/stock.php | 15 +++++++++ htdocs/langs/en_US/stocks.lang | 3 +- htdocs/langs/fr_FR/stocks.lang | 1 + htdocs/product/stock/product.php | 56 ++++++++++++++++++++++++++++++-- 4 files changed, 71 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 39a9e5ae601..c2d64d977c3 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -758,6 +758,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/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 1b54e53d6de..376b86fcef7 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -240,4 +240,5 @@ InventoryRealQtyHelp=Set value to 0 to reset qty
Keep field empty, or remove UpdateByScaning=Update by scaning UpdateByScaningProductBarcode=Update by scan (product barcode) UpdateByScaningLot=Update by scan (lot|serial barcode) -DisableStockChangeOfSubProduct=Deactivate the stock change for all the subproducts of this Kit during this movement. \ No newline at end of file +DisableStockChangeOfSubProduct=Deactivate the stock change for all the subproducts of this Kit during this movement. +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 444c546b853..cf178141f74 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -242,3 +242,4 @@ UpdateByScaning=Mise à jour par scan UpdateByScaningProductBarcode=Mettre à jour par scan (code-barres produit) UpdateByScaningLot=Mise à jour par scan (code barres lot/série) DisableStockChangeOfSubProduct=Désactiver les mouvements de stock des composants pour tout mouvement de stock de ce kit +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 d1c1ea99ff7..1b72404011b 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 @@ -522,6 +523,48 @@ if ($id > 0 || $ref) llxHeader('', $title, $helpurl); + ?> + + + + 0) { $head = product_prepare_head($object); @@ -828,7 +871,10 @@ if (!$variants) { print ''; if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) { $colspan = 3; - print ''; + print ''; + print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").''; + print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").''; + print ''; print ''.$langs->trans("batch_number").''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { $colspan--; @@ -880,7 +926,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') : '').''; @@ -934,7 +984,7 @@ if (!$variants) { print ''; print ''; } else { - print "\n".''; + print "\n".''; print img_picto($langs->trans("Tranfer"), 'uparrow', 'class="hideonsmartphone"').' '; print 'id.'">'.$langs->trans("TransferStock").''; // Disabled, because edition of stock content must use the "Correct stock menu". From a79823742f464f0bbbe5ca217debf0c37c13d37e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 19 Apr 2021 12:41:17 +0000 Subject: [PATCH 3/4] Fixing style errors. --- htdocs/product/stock/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 1b72404011b..17b209b845a 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -927,7 +927,7 @@ if (!$variants) { $stock_real = price2num($obj->reel, 'MS'); print ''; print ''; - if(!empty($conf->productbatch->enabled)) { + if (!empty($conf->productbatch->enabled)) { print '' . (empty($conf->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT) ? '(+)' : '(-)') . ' '; } print $entrepotstatic->getNomUrl(1).''; From 2236d1b07fa6c5967d8ab46049608dc0790e188d Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 19 Apr 2021 14:46:28 +0200 Subject: [PATCH 4/4] FIX : Hide all and check all links always available --- htdocs/product/stock/product.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 1b72404011b..8e17eb0c885 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -545,8 +545,6 @@ if ($id > 0 || $ref) }); $("#show_all").click(function() { - $(this).hide(); - $("#hide_all").show(); $("[class^=batch_warehouse]").show(); $("[class^=collapse_batch]").html('(-) '); return false; @@ -554,8 +552,6 @@ if ($id > 0 || $ref) $("#hide_all").click(function() { $("[class^=batch_warehouse]").hide(); - $(this).hide(); - $("#show_all").show(); $("[class^=collapse_batch]").html('(+) '); return false; }); @@ -872,8 +868,8 @@ if (!$variants) { if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) { $colspan = 3; print ''; - print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").''; - print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").''; + 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)) {