From 41e54529b0e6b54bf08878a94928e8d721a23587 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 19 Feb 2025 17:26:54 +0100 Subject: [PATCH 1/2] FIX #33145 wrong label status buy on prodcut tooltip --- htdocs/core/class/commonobject.class.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cf013497aec..807c5f37bfc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5213,14 +5213,10 @@ abstract class CommonObject $discount->fk_soc = $this->socid; $this->tpl['label'] .= $discount->getNomUrl(0, 'discount'); } elseif (!empty($line->fk_product)) { - $productstatic = new Product($this->db); - $productstatic->id = $line->fk_product; - $productstatic->ref = $line->ref; - $productstatic->type = $line->fk_product_type; - if (empty($productstatic->ref)) { + if (empty($line->product)) { $line->fetch_product(); - $productstatic = $line->product; } + $productstatic = $line->product; $this->tpl['label'] .= $productstatic->getNomUrl(1); $this->tpl['label'] .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); From 5911d7d0c00aad720b22928789e3d8432c9aa6b3 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 20 Feb 2025 08:21:50 +0100 Subject: [PATCH 2/2] Protect product object for line label --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 807c5f37bfc..085b77dd532 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5218,7 +5218,7 @@ abstract class CommonObject } $productstatic = $line->product; - $this->tpl['label'] .= $productstatic->getNomUrl(1); + $this->tpl['label'] .= (is_object($productstatic) ? $productstatic->getNomUrl(1) : $line->ref); $this->tpl['label'] .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); // Dates if ($line->product_type == 1 && ($date_start || $date_end)) {