diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e36d5970e8f..e989b0eb206 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1116,7 +1116,7 @@ class Product extends CommonObject //If it is a parent product, then we remove the association with child products $prodcomb = new ProductCombination($this->db); - if ($prodcomb->deleteByFkProductParent($id) < 0) { + if ($prodcomb->deleteByFkProductParent($user, $id) < 0) { $error++; $this->errors[] = 'Error deleting combinations'; } diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 4f647aa2cb3..92bba2f70f8 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -275,10 +275,11 @@ class ProductCombination /** * Deletes all product combinations of a parent product * - * @param int $fk_product_parent Rowid of parent product + * @param User $user Object user + * @param int $fk_product_parent Rowid of parent product * @return int <0 KO >0 OK */ - public function deleteByFkProductParent($fk_product_parent) + public function deleteByFkProductParent($user, $fk_product_parent) { $this->db->begin(); @@ -289,11 +290,11 @@ class ProductCombination $res = $prodstatic->fetch($prodcomb->fk_product_child); if ($res > 0) { - $res = $prodcomb->delete(); + $res = $prodcomb->delete($user); } if ($res > 0 && !$prodstatic->isObjectUsed($prodstatic->id)) { - $res = $prodstatic->delete(); + $res = $prodstatic->delete($user); } if ($res < 0) { diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php index d4162899874..4daa2d8f45a 100644 --- a/htdocs/variants/generator.php +++ b/htdocs/variants/generator.php @@ -95,7 +95,7 @@ if ($_POST) { $delete_prev_comb_res = 1; if (!$donotremove) { - $delete_prev_comb_res = $combination->deleteByFkProductParent($id); + $delete_prev_comb_res = $combination->deleteByFkProductParent($user, $id); } //Current combinations will be deleted