diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1490e36c3ed..e607e8f214a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2054,6 +2054,7 @@ abstract class CommonObject } } + /** * Define delivery address * @deprecated @@ -7319,6 +7320,7 @@ abstract class CommonObject if (!empty($id)) $sql.= ' WHERE rowid = '.$id; elseif (!empty($ref)) $sql.= " WHERE ref = ".$this->quote($ref, $this->fields['ref']); else $sql.=' WHERE 1 = 1'; // usage with empty id and empty ref is very rare + if (empty($id) && isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.=' AND entity IN ('.getEntity($this->table_element).')'; if ($morewhere) $sql.= $morewhere; $sql.=' LIMIT 1'; // This is a fetch, to be sure to get only one record