From ef94452f77fc7eca3ac58caea35bd76168dd1af5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2026 01:01:37 +0200 Subject: [PATCH] Doc --- htdocs/product/class/product.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f6bcc80633b..a36a9b931a4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1492,8 +1492,9 @@ class Product extends CommonObject if ($result >= 0) { // $this->oldcopy should have been set by the caller of update (here properties were already modified) - if (is_null($this->oldcopy) || (is_object($this->oldcopy) && $this->oldcopy->isEmpty())) { - $this->oldcopy = dol_clone($this, 1); // 1 to clone with methods to avoid fatal error with $this->oldcopy->hasbatch() + // Note that this->oldcopy must be object and not stdClass, if not the method hasbatch() will not work. + if (is_null($this->oldcopy) || (is_object($this->oldcopy) && empty($this->oldcopy->id))) { + $this->oldcopy = dol_clone($this, 1); // 1 to clone with methods to avoid fatal error with $this->oldcopy->hasbatch() } // Test if batch management is activated on existing product // If yes, we create missing entries into product_batch @@ -6859,9 +6860,9 @@ class Product extends CommonObject } /** - * Return if the object has a sell-by or eat-by date. + * Return if the object has a batch management. * - * @return boolean True if the object has a sell-by or eat-by date, false otherwise. + * @return boolean True if the object has a batch management, false otherwise. */ public function hasbatch() {