Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow hiding mail accounts from the mail accounts tree of the mail ap… #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion api/src/Mail/Account.php
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
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