From aaa0128884bd265df6db5ae9bc5088d04812e588 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Fri, 6 Sep 2024 14:51:50 +0300 Subject: [PATCH] Update contact.class.php (#30867) When creating a customer and a contact at the same time if in the third-party settings the default role assignment option is empty (not filled in) an SQL error occurs. --- htdocs/contact/class/contact.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index a727e812f8a..dd18314a0d5 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1893,6 +1893,9 @@ class Contact extends CommonObject } else { if (count($this->roles) > 0) { foreach ($this->roles as $keyRoles => $valRoles) { + if (empty($valRoles)) { + continue; + } $idrole = 0; if (is_array($valRoles)) { $idrole = $valRoles['id'];