From 6e0b38c4e3cc84a1b056fa22e9c4430821876868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 14:53:49 +0100 Subject: [PATCH 1/6] doc --- htdocs/core/modules/product_batch/mod_lot_advanced.php | 2 +- htdocs/core/modules/product_batch/mod_lot_free.php | 2 +- htdocs/core/modules/product_batch/mod_lot_standard.php | 2 +- htdocs/core/modules/product_batch/mod_sn_advanced.php | 2 +- htdocs/core/modules/product_batch/mod_sn_free.php | 2 +- htdocs/core/modules/product_batch/mod_sn_standard.php | 2 +- .../core/modules/product_batch/modules_product_batch.class.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 0e108b6b021..4342dedc2e9 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) diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index d6b24945ab0..7edba167768 100644 --- a/htdocs/core/modules/product_batch/mod_lot_free.php +++ b/htdocs/core/modules/product_batch/mod_lot_free.php @@ -94,7 +94,7 @@ 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) 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..3012ea37b30 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) 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) From 8d2f6376084956dabc48249b94950dd084e8ce46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 14:57:22 +0100 Subject: [PATCH 2/6] doc --- htdocs/product/stock/class/productlot.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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) { From 80d5d05cba4c29db6a2f34abc38378b2dfec4e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 15:04:58 +0100 Subject: [PATCH 3/6] doc --- .../core/modules/product_batch/mod_lot_free.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index 7edba167768..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 @@ -99,7 +102,6 @@ class mod_lot_free extends ModeleNumRefBatch */ public function getNextValue($objsoc, $object) { - global $langs; return ''; } } From 22bf6cc5a6d74caf2f482a028da7306d7f73c7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 15:07:52 +0100 Subject: [PATCH 4/6] doc --- htdocs/core/modules/product/mod_codeproduct_elephant.php | 2 +- htdocs/core/modules/product/mod_codeproduct_leopard.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) 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 */ From d5fbab8688a3bbe9b0d36568e30fe118bccef730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 15:19:08 +0100 Subject: [PATCH 5/6] advanced --- .../core/modules/product_batch/mod_lot_advanced.php | 11 ++++++++++- .../core/modules/product_batch/mod_sn_advanced.php | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 4342dedc2e9..d6128573f97 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -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_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index 3012ea37b30..6c796f06c3b 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -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; } From 6ff2c87fe392c0f1b17d521b8becee93acd898cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 15:48:11 +0100 Subject: [PATCH 6/6] trans --- htdocs/langs/en_US/agenda.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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