From 3a232796d8878d35e71b6f9d0f8412254a260363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Fri, 4 Sep 2020 11:43:56 +0200 Subject: [PATCH] Use new function fetchAllByFkProductChild --- htdocs/product/class/product.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1fcb76a571d..7d91052ab87 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1194,9 +1194,13 @@ class Product extends CommonObject } //We also check if it is a child product - if (!$error && ($prodcomb->fetchByFkProductChild($this->id) > 0) && ($prodcomb->delete($user) < 0)) { - $error++; - $this->errors[] = 'Error deleting child combination'; + if (!$error) { + foreach ($prodcomb->fetchAllByFkProductChild($this->id) as $obj) { + if ($obj->delete($user) < 0) { + $error++; + $this->errors[] = 'Error deleting child combination'; + } + } } }