diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index b2164e80175..c883de79c5e 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -139,7 +139,7 @@ class mod_codeproduct_elephant extends ModeleProductCode * Return an example of result returned by getNextValue * * @param Translate $langs Object langs - * @param product $objproduct Object product + * @param Product $objproduct Object product * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ diff --git a/htdocs/core/modules/product/mod_codeproduct_leopard.php b/htdocs/core/modules/product/mod_codeproduct_leopard.php index f7578d696f6..5819821f814 100644 --- a/htdocs/core/modules/product/mod_codeproduct_leopard.php +++ b/htdocs/core/modules/product/mod_codeproduct_leopard.php @@ -33,10 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php' class mod_codeproduct_leopard extends ModeleProductCode { /* - * Attention ce module est utilise par defaut si aucun module n'a - * ete definit dans la configuration + * Please note this module is used by default if no module has been defined in the configuration * - * Le fonctionnement de celui-ci doit donc rester le plus ouvert possible + * Its operation must therefore remain as open as possible */ /** @@ -100,7 +99,7 @@ class mod_codeproduct_leopard extends ModeleProductCode /** * Return an example of result returned by getNextValue * - * @param product $objproduct Object product + * @param Product $objproduct Object product * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return next value */ diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 0e108b6b021..d6128573f97 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -132,7 +132,7 @@ class mod_lot_advanced extends ModeleNumRefBatch * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc, $object) @@ -143,6 +143,15 @@ class mod_lot_advanced extends ModeleNumRefBatch // We get cursor rule $mask = getDolGlobalString('LOT_ADVANCED_MASK'); + $filter = ''; + if (getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && !empty($object->fk_product)) { + $product = new Product($db); + $res = $product->fetch($object->fk_product); + if ($res > 0 && !empty($product->batch_mask)) { + $mask = $product->batch_mask; + $filter = ''; + } + } if (!$mask) { $this->error = 'NotConfigured'; @@ -151,7 +160,7 @@ class mod_lot_advanced extends ModeleNumRefBatch $date = dol_now(); - $numFinal = get_next_value($db, $mask, 'product_lot', 'batch', '', null, $date); + $numFinal = get_next_value($db, $mask, 'product_lot', 'batch', $filter, null, $date); return $numFinal; } diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index d6b24945ab0..8d14a25374f 100644 --- a/htdocs/core/modules/product_batch/mod_lot_free.php +++ b/htdocs/core/modules/product_batch/mod_lot_free.php @@ -1,6 +1,7 @@ * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2022 Frédéric France * * 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 @@ -26,16 +27,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product_batch/modules_product_batch.class.php'; /** - * \class mod_codeproduct_leopard - * \brief Classe permettant la gestion leopard des codes produits + * \class mod_lot_free + * \brief Class allowing lot_free management of batch numbers */ class mod_lot_free extends ModeleNumRefBatch { /* - * Attention ce module est utilise par defaut si aucun module n'a - * ete definit dans la configuration + * Please note this module is used by default if no module has been defined in the configuration * - * Le fonctionnement de celui-ci doit donc rester le plus ouvert possible + * Its operation must therefore remain as open as possible */ @@ -44,7 +44,10 @@ class mod_lot_free extends ModeleNumRefBatch */ public $name = 'lot_free'; - public $code_modifiable; // Code modifiable + /** + * @var string Code modifiable + */ + public $code_modifiable; public $code_modifiable_invalide; // Code modifiable si il est invalide @@ -94,12 +97,11 @@ class mod_lot_free extends ModeleNumRefBatch * Return an example of result returned by getNextValue * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Return next value */ public function getNextValue($objsoc, $object) { - global $langs; return ''; } } diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php index fc8d1389a00..ef3918fd167 100644 --- a/htdocs/core/modules/product_batch/mod_lot_standard.php +++ b/htdocs/core/modules/product_batch/mod_lot_standard.php @@ -112,7 +112,7 @@ class mod_lot_standard extends ModeleNumRefBatch * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index f8d61c43c61..6c796f06c3b 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -132,7 +132,7 @@ class mod_sn_advanced extends ModeleNumRefBatch * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc, $object) @@ -144,6 +144,16 @@ class mod_sn_advanced extends ModeleNumRefBatch // We get cursor rule $mask = getDolGlobalString('SN_ADVANCED_MASK'); + $filter = ''; + if (getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS') && !empty($object->fk_product)) { + $product = new Product($db); + $res = $product->fetch($object->fk_product); + if ($res > 0 && !empty($product->batch_mask)) { + $mask = $product->batch_mask; + $filter = ''; + } + } + if (!$mask) { $this->error = 'NotConfigured'; return 0; @@ -151,7 +161,7 @@ class mod_sn_advanced extends ModeleNumRefBatch $date = dol_now(); - $numFinal = get_next_value($db, $mask, 'product_lot', 'batch', '', null, $date); + $numFinal = get_next_value($db, $mask, 'product_lot', 'batch', $filter, null, $date); return $numFinal; } diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php index f6b2417d34b..8ada51fb93b 100644 --- a/htdocs/core/modules/product_batch/mod_sn_free.php +++ b/htdocs/core/modules/product_batch/mod_sn_free.php @@ -93,7 +93,7 @@ class mod_sn_free extends ModeleNumRefBatch * Return an example of result returned by getNextValue * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Return next value */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php index d6c109cff81..ccd49d03b8f 100644 --- a/htdocs/core/modules/product_batch/mod_sn_standard.php +++ b/htdocs/core/modules/product_batch/mod_sn_standard.php @@ -112,7 +112,7 @@ class mod_sn_standard extends ModeleNumRefBatch * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php index 42d4d052bfe..ea64bd98609 100644 --- a/htdocs/core/modules/product_batch/modules_product_batch.class.php +++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php @@ -125,7 +125,7 @@ abstract class ModeleNumRefBatch * Returns next assigned value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Valeur */ public function getNextValue($objsoc, $object) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 4eca4b1734a..2016172c381 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -68,6 +68,7 @@ ShipmentBackToDraftInDolibarr=Shipment %s go back to draft status ShipmentDeletedInDolibarr=Shipment %s deleted ShipmentCanceledInDolibarr=Shipment %s canceled ReceptionValidatedInDolibarr=Reception %s validated +ReceptionDeletedInDolibarr=Reception %s deleted ReceptionClassifyClosedInDolibarr=Reception %s classified closed OrderCreatedInDolibarr=Order %s created OrderValidatedInDolibarr=Order %s validated @@ -177,4 +178,4 @@ AddReminder=Create an automatic reminder notification for this event ErrorReminderActionCommCreation=Error creating the reminder notification for this event BrowserPush=Browser Popup Notification ActiveByDefault=Enabled by default -Until=until \ No newline at end of file +Until=until diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 7009d0d55fc..6fe855543c9 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -110,10 +110,13 @@ class Productlot extends CommonObject public $entity; /** - * @var int ID + * @var int Product ID */ public $fk_product; + /** + * @var string batch ref + */ public $batch; public $eatby = ''; public $sellby = ''; @@ -126,15 +129,18 @@ class Productlot extends CommonObject public $tms = ''; /** - * @var int ID + * @var int user ID */ public $fk_user_creat; /** - * @var int ID + * @var int user ID */ public $fk_user_modif; + /** + * @var string import key + */ public $import_key; @@ -241,9 +247,6 @@ class Productlot extends CommonObject } if (!$error && !$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. - // Call triggers $result = $this->call_trigger('PRODUCTLOT_CREATE', $user); if ($result < 0) {