From cbf103ef742471644a62028db992c9bddef62e8a Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Fri, 25 Nov 2022 22:58:51 +0100 Subject: [PATCH 1/2] FIX for #22882 --- htdocs/product/fournisseurs.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 049d5857252..a601d467e0f 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -269,10 +269,14 @@ if (empty($reshook)) { if ($ret == -3) { $error++; - $object->fetch($object->product_id_already_linked); - $productLink = $object->getNomUrl(1, 'supplier'); + $tmpobject = new Product($db); + $tmpobject->fetch($object->product_id_already_linked); + $productLink = $tmpobject->getNomUrl(1, 'supplier'); - setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", $productLink), null, 'errors'); + $texttoshow = $langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", '{s1}'); + $texttoshow = str_replace('{s1}', $productLink, $texttoshow); + setEventMessages($texttoshow, null, 'errors'); + } elseif ($ret < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); From 1d0f329ac5f880712fdb6df1cbc578e072c871d7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 25 Nov 2022 22:15:01 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/product/fournisseurs.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index a601d467e0f..8988ffce455 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -269,14 +269,13 @@ if (empty($reshook)) { if ($ret == -3) { $error++; - $tmpobject = new Product($db); - $tmpobject->fetch($object->product_id_already_linked); - $productLink = $tmpobject->getNomUrl(1, 'supplier'); + $tmpobject = new Product($db); + $tmpobject->fetch($object->product_id_already_linked); + $productLink = $tmpobject->getNomUrl(1, 'supplier'); - $texttoshow = $langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", '{s1}'); - $texttoshow = str_replace('{s1}', $productLink, $texttoshow); - setEventMessages($texttoshow, null, 'errors'); - + $texttoshow = $langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", '{s1}'); + $texttoshow = str_replace('{s1}', $productLink, $texttoshow); + setEventMessages($texttoshow, null, 'errors'); } elseif ($ret < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors');