From 4dbf151b1577719a06388f61f57d23116cda9a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 9 Nov 2019 13:29:12 +0100 Subject: [PATCH 1/2] Inject $user in ProductCombination::updateProperties --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4d8afaad9aa..22c943dfa6e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1073,7 +1073,7 @@ class Product extends CommonObject $comb = new ProductCombination($this->db); foreach ($comb->fetchAllByFkProductParent($this->id) as $currcomb) { - $currcomb->updateProperties($this); + $currcomb->updateProperties($this, $user); } } From df4bcdcb94bb6615af2cbae8c89a0ec377255ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 9 Nov 2019 14:13:14 +0100 Subject: [PATCH 2/2] Edit updateProperties to inject $user --- htdocs/variants/class/ProductCombination.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 21346d6124e..4849c44c898 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -248,7 +248,7 @@ class ProductCombination $parent = new Product($this->db); $parent->fetch($this->fk_product_parent); - $this->updateProperties($parent); + $this->updateProperties($parent, $user); return 1; } @@ -315,11 +315,12 @@ class ProductCombination * Updates the weight of the child product. The price must be updated using Product::updatePrices * * @param Product $parent Parent product + * @param User $user Object user * @return int >0 OK <0 KO */ - public function updateProperties(Product $parent) + public function updateProperties(Product $parent, User $user) { - global $user, $conf; + global $conf; $this->db->begin();