Fix inconsistant link element (#30258)

This commit is contained in:
John BOTELLA 2024-07-04 08:56:39 +02:00 committed by GitHub
parent 5660bf5b4f
commit ac136ec1ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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