diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b86ea4fb650..022862e751b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2017 ATM Consulting * Copyright (C) 2017-2019 Nicolas ZABOURI * Copyright (C) 2017 Rui Strecht - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2018 Josep Lluís Amador * Copyright (C) 2021 Gauthier VERDOL * @@ -738,11 +738,11 @@ abstract class CommonObject } if ($this->element == 'contact') { $contactid = $this->id; - $thirdpartyid = $object->fk_soc; + $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; } if ($this->element == 'user') { $contactid = $this->contact_id; - $thirdpartyid = $object->fk_soc; + $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; } $out = '';