From 172b615d6c43cb767be5a7bed39b0ccc381f2f57 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Mar 2021 11:51:29 +0100 Subject: [PATCH] Debug auto numbering of lot/serial. --- htdocs/core/modules/modProductBatch.class.php | 16 ++++++++++++++++ htdocs/product/admin/product_lot.php | 10 +++++----- htdocs/product/admin/product_lot_extrafields.php | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index 3d8359ebc3a..79529898bb0 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -76,8 +76,24 @@ class modProductBatch extends DolibarrModules $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module $this->langfiles = array("productbatch"); + // Constants // Constants $this->const = array(); + $r = 0; + + $this->const[$r][0] = "PRODUCTBATCH_LOT_ADDON"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_lot_free"; + $this->const[$r][3] = 'Module to control product codes'; + $this->const[$r][4] = 0; + $r++; + + $this->const[$r][0] = "PRODUCTBATCH_SN_ADDON"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_sn_free"; + $this->const[$r][3] = 'Module to control product codes'; + $this->const[$r][4] = 0; + $r++; $this->tabs = array(); diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index 13b47e56afd..37b8e0bc975 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -69,9 +69,9 @@ if ($action == 'updateMaskLot') { setEventMessages($langs->trans("Error"), null, 'errors'); } } elseif ($action == 'setmodlot') { - dolibarr_set_const($db, "LOT_ADDON", $value, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "PRODUCTBATCH_LOT_ADDON", $value, 'chaine', 0, '', $conf->entity); } elseif ($action == 'setmodsn') { - dolibarr_set_const($db, "SN_ADDON", $value, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "PRODUCTBATCH_SN_ADDON", $value, 'chaine', 0, '', $conf->entity); } /* @@ -89,7 +89,7 @@ print load_fiche_titre($langs->trans("ProductLotSetup"), $linkback, 'title_setup $head = product_lot_admin_prepare_head(); -dol_fiche_head($head, 'settings', $langs->trans("Batch"), -1, 'productbatch'); +dol_fiche_head($head, 'settings', $langs->trans("Batch"), -1, 'lot'); /* * Lot Numbering models @@ -140,7 +140,7 @@ foreach ($dirmodels as $reldir) { print ''."\n"; print ''; - if ($conf->global->LOT_ADDON == $file) { + if ($conf->global->PRODUCTBATCH_LOT_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; @@ -232,7 +232,7 @@ foreach ($dirmodels as $reldir) { print ''."\n"; print ''; - if ($conf->global->SN_ADDON == $file) { + if ($conf->global->PRODUCTBATCH_SN_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; diff --git a/htdocs/product/admin/product_lot_extrafields.php b/htdocs/product/admin/product_lot_extrafields.php index fc14b4c142c..38af3a41f8d 100644 --- a/htdocs/product/admin/product_lot_extrafields.php +++ b/htdocs/product/admin/product_lot_extrafields.php @@ -77,7 +77,7 @@ print load_fiche_titre($title, $linkback, 'title_setup'); $head = product_lot_admin_prepare_head(); -print dol_get_fiche_head($head, 'attributes', $textobject, -1, 'stock'); +print dol_get_fiche_head($head, 'attributes', $textobject, -1, 'lot'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';