FIX Missing where on entity

This commit is contained in:
Laurent Destailleur 2019-08-03 16:32:35 +02:00
parent f4dd345c7a
commit acf8314935

View File

@ -7390,6 +7390,7 @@ abstract class CommonObject
if (!empty($id)) $sql.= ' WHERE rowid = '.$id; if (!empty($id)) $sql.= ' WHERE rowid = '.$id;
elseif (!empty($ref)) $sql.= " WHERE ref = ".$this->quote($ref, $this->fields['ref']); 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 else $sql.=' WHERE 1 = 1'; // usage with empty id and empty ref is very rare
if (empty($id) && $this->ismultientitymanaged == 1) $sql.=' AND entity IN ('.getEntity($this->table_element).')';
if ($morewhere) $sql.= $morewhere; if ($morewhere) $sql.= $morewhere;
$sql.=' LIMIT 1'; // This is a fetch, to be sure to get only one record $sql.=' LIMIT 1'; // This is a fetch, to be sure to get only one record