Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion api/src/Mail/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -1483,9 +1483,10 @@ public static function delete($acc_id, $account_id=null)
* @param int|boolean $offset =false offset or false to return all
* @param int $num_rows =0 number of rows to return, 0=default from prefs (if $offset !== false)
* @param boolean $replace_placeholders =true should placeholders like {{n_fn}} be replaced
* @param boolean $only_visible = false if set to true it skips the accounts with a name starting with a dot(.)
* @return \Iterator with acc_id => acc_name or Account objects
*/
public static function search($only_current_user=true, $just_name=true, $order_by=null, $offset=false, $num_rows=0, $replace_placeholders=true)
public static function search($only_current_user=true, $just_name=true, $order_by=null, $offset=false, $num_rows=0, $replace_placeholders=true, $only_visible = false)
{
//error_log(__METHOD__."($only_current_user, $just_name, '$order_by', $offset, $num_rows)");
$where = array();
Expand All @@ -1501,6 +1502,9 @@ public static function search($only_current_user=true, $just_name=true, $order_b
'account_id' => $account_id ? self::memberships($account_id) : 0
));
}
if($only_visible){
$where[] = self::$db->strpos("egw_ea_accounts.acc_name","'.'" )." NOT IN (1) ";
}
if (empty($order_by) || !preg_match('/^[a-z_]+ (ASC|DESC)$/i', $order_by))
{
// for current user prefer account with ident_email matching user email or domain
Expand Down
2 changes: 1 addition & 1 deletion mail/inc/class.mail_tree.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ static function getAccountsRootNode($_profileID = null, $_noCheckbox = false, $_
{
$roots = array(Tree::ID => 0, Tree::CHILDREN => array());

foreach(Mail\Account::search(true, 'params') as $acc_id => $params)
foreach(Mail\Account::search(true, 'params', null, false, 0, true, true) as $acc_id => $params)
{
try {
$accObj = new Mail\Account($params);
Expand Down