Change account filtering to give accounts when asked even if accounts are hidden in preferences

This commit is contained in:
nathangray 2018-04-26 14:34:09 -06:00
parent c7f3b70b85
commit 869d50d96f

View File

@ -552,18 +552,13 @@ class Sql extends Api\Storage
} }
// add join to show only active accounts (only if accounts are shown and in sql and we not already join the accounts table, eg. used by admin) // add join to show only active accounts (only if accounts are shown and in sql and we not already join the accounts table, eg. used by admin)
if ((is_array($owner) ? in_array(0, $owner) : !$owner) && substr($this->account_repository,0,3) == 'sql' && if ((is_array($owner) ? in_array(0, $owner) : !$owner) && substr($this->account_repository,0,3) == 'sql' &&
strpos($join,$GLOBALS['egw']->accounts->backend->table) === false && !array_key_exists('account_id',$filter) && strpos($join,$GLOBALS['egw']->accounts->backend->table) === false && !array_key_exists('account_id',$filter))
$GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts'] !== 'none')
{ {
$join .= self::ACCOUNT_ACTIVE_JOIN; $join .= self::ACCOUNT_ACTIVE_JOIN;
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts'] === '0') if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts'] === '0')
{ {
$filter[] = str_replace('UNIX_TIMESTAMP(NOW())',time(),self::ACOUNT_ACTIVE_FILTER); $filter[] = str_replace('UNIX_TIMESTAMP(NOW())',time(),self::ACOUNT_ACTIVE_FILTER);
} }
else
{
$filter[] = 'egw_accounts.account_id IS NULL';
}
} }
if ($join || ($criteria && is_string($criteria)) || ($criteria && is_array($criteria) && $order_by)) // search also adds a join for custom fields! if ($join || ($criteria && is_string($criteria)) || ($criteria && is_array($criteria) && $order_by)) // search also adds a join for custom fields!
{ {