diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index a2836a3b46..db2cf51129 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -1900,6 +1900,7 @@ class addressbook_ui extends addressbook_bo break; } $query['order'] = 'n_family'; + // fall-through case 'n_family': $order = "n_family<>'' DESC,n_family $sort,n_given $sort,org_name $sort"; break; @@ -1919,6 +1920,10 @@ class addressbook_ui extends addressbook_bo break; case 'contact_id': $order = "egw_addressbook.$query[order] $sort"; + break; + case 'account_lid': + $order = "account_lid<>'' DESC,account_lid $sort,n_family $sort,n_given $sort"; + break; } if ($query['searchletter']) // only show contacts if the order-criteria starts with the given letter { diff --git a/api/src/Contacts/Sql.php b/api/src/Contacts/Sql.php index e5b1570279..b3bdcf2200 100644 --- a/api/src/Contacts/Sql.php +++ b/api/src/Contacts/Sql.php @@ -603,8 +603,9 @@ class Sql extends Api\Storage unset($filter['list']); } // 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' && - strpos($join,$GLOBALS['egw']->accounts->backend->table) === false && !array_key_exists('account_id',$filter)) + if ((is_array($owner) ? in_array(0, $owner) : !$owner) && + substr($this->account_repository,0,3) == 'sql' && + strpos($join,$GLOBALS['egw']->accounts->backend->table) === false) { $join .= self::ACCOUNT_ACTIVE_JOIN; $extra_cols[] = 'account_lid AS account_lid';