diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 29cc0aac249..de3b937094a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1991,12 +1991,14 @@ class Adherent extends CommonObject // Process foreach ($to_del as $del) { - $c->fetch($del); - $c->del_type($this, 'member'); + if ($c->fetch($del) > 0) { + $c->del_type($this, 'member'); + } } foreach ($to_add as $add) { - $c->fetch($add); - $c->add_type($this, 'member'); + if ($c->fetch($add) > 0) { + $c->add_type($this, 'member'); + } } return; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index c48408ab281..7af2a763ad1 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1155,12 +1155,14 @@ class Contact extends CommonObject // Process foreach ($to_del as $del) { - $c->fetch($del); - $c->del_type($this, 'contact'); + if ($c->fetch($del) > 0) { + $c->del_type($this, 'contact'); + } } foreach ($to_add as $add) { - $c->fetch($add); - $c->add_type($this, 'contact'); + if ($c->fetch($add) > 0) { + $c->add_type($this, 'contact'); + } } return; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a51a1a77c7b..6f4e37c8ab2 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3976,12 +3976,14 @@ class Product extends CommonObject // Process foreach($to_del as $del) { - $c->fetch($del); - $c->del_type($this, 'product'); + if ($c->fetch($del) > 0) { + $c->del_type($this, 'product'); + } } foreach ($to_add as $add) { - $c->fetch($add); - $c->add_type($this, 'product'); + if ($c->fetch($add) > 0) { + $c->add_type($this, 'product'); + } } return; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index af54c7b8742..7bf8d6c45cf 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3395,12 +3395,14 @@ class Societe extends CommonObject // Process foreach ($to_del as $del) { - $c->fetch($del); - $c->del_type($this, $type_text); + if ($c->fetch($del) > 0) { + $c->del_type($this, $type_text); + } } foreach ($to_add as $add) { - $c->fetch($add); - $c->add_type($this, $type_text); + if ($c->fetch($add) > 0) { + $c->add_type($this, $type_text); + } } return;