From d86f89a8fa38e356004c7a9e37acd9430437798f Mon Sep 17 00:00:00 2001
From: BENKE Charlie <charles.fr@benke.fr>
Date: Sat, 4 Jun 2016 17:55:28 +0200
Subject: [PATCH] fix :  #4853

append if not contact type for the element
---
 htdocs/core/class/commonobject.class.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 3287ac5d4b7..c26251f2312 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -744,7 +744,8 @@ abstract class CommonObject
 
         $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
         $sql.= " WHERE element_id = ".$this->id;
-        $sql.= " AND fk_c_type_contact IN (".$listId.")";
+        if ($listId)
+        	$sql.= " AND fk_c_type_contact IN (".$listId.")";
 
         dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG);
         if ($this->db->query($sql))
-- 
GitLab