FIX PR feedback: in addFileIntoDatabaseIndex, return error if $object is set with an ID but without a table_element
This commit is contained in:
parent
407f314498
commit
924cff44f3
@ -1789,8 +1789,13 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
|
||||
|
||||
if (is_object($object) && $object->id > 0) {
|
||||
$ecmfile->src_object_id = $object->id;
|
||||
if (isset($object->table_element)) $ecmfile->src_object_type = $object->table_element;
|
||||
if (isset($object->src_object_description)) $ecmfile->description = $object->src_object_description;
|
||||
if (isset($object->table_element)) {
|
||||
$ecmfile->src_object_type = $object->table_element;
|
||||
if (isset($object->src_object_description)) $ecmfile->description = $object->src_object_description;
|
||||
} else {
|
||||
dol_syslog('Error: object ' . get_class($object) . ' has no table_element attribute.');
|
||||
return -1;
|
||||
}
|
||||
if (isset($object->src_object_keywords)) $ecmfile->keywords = $object->src_object_keywords;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user