fix contacts not found for regular (non-admin) users, if some users are hidden and search in all addressbooks (searching in a specific one worked)

This commit is contained in:
ralf 2024-11-18 19:26:50 +01:00
parent 50ff832c75
commit 50db13ea09

View File

@ -720,7 +720,8 @@ class Sql extends Api\Storage
if (!empty($filter['account_id']) && ($not_account_ids = array_search('!', $filter['account_id'])) !== false) if (!empty($filter['account_id']) && ($not_account_ids = array_search('!', $filter['account_id'])) !== false)
{ {
unset($filter['account_id'][$not_account_ids]); unset($filter['account_id'][$not_account_ids]);
$filter[] = $this->db->expression($this->table_name, ' NOT ', $this->table_name.'.', ['account_id' => $filter['account_id']]); $filter[] = '('.$this->table_name.'.account_id IS NULL OR '. // "NULL NOT IN (1, 2)" is false in SQL, need to check it explicit
$this->db->expression($this->table_name, ' NOT ', $this->table_name.'.', ['account_id' => $filter['account_id']]).')';
unset($filter['account_id']); unset($filter['account_id']);
} }