diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f8bbcd97511..6d49abf9902 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8203,6 +8203,17 @@ abstract class CommonObject if (!empty($classpath)) { dol_include_once($InfoFieldList[1]); + + if ($classname && !class_exists($classname)) { + // from V19 of Dolibarr, In some cases link use element instead of class, example project_task + // TODO use newObjectByElement() introduce in V20 by PR #30036 for better errors management + $element_prop = getElementProperties($classname); + if ($element_prop) { + $classname = $element_prop['classname']; + } + } + + if ($classname && class_exists($classname)) { $object = new $classname($this->db); if ($object->element === 'product') { // Special case for product because default valut of fetch are wrong