diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index 4cba075624..d9dd2d9855 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -148,6 +148,7 @@ class addressbook_hooks 'help' => 'Hides accounts completly from the adressbook.', 'xmlrpc' => True, 'admin' => false, + 'default'=> '0' ); $contacts = new Api\Contacts(); $fileas_options = $contacts->fileas_options(); diff --git a/api/src/Contacts.php b/api/src/Contacts.php index 26407f8fcd..12d421b747 100755 --- a/api/src/Contacts.php +++ b/api/src/Contacts.php @@ -185,6 +185,10 @@ class Contacts extends Contacts\Storage $this->now_su = DateTime::to('now','ts'); $this->prefs =& $GLOBALS['egw_info']['user']['preferences']['addressbook']; + if(!isset($this->prefs['hide_accounts'])) + { + $this->prefs['hide_accounts'] = '0'; + } // get the default addressbook from the users prefs $this->default_addressbook = $GLOBALS['egw_info']['user']['preferences']['addressbook']['add_default'] ? (int)$GLOBALS['egw_info']['user']['preferences']['addressbook']['add_default'] : $this->user; diff --git a/api/src/Contacts/Sql.php b/api/src/Contacts/Sql.php index beb60df717..2b75ffc4c0 100644 --- a/api/src/Contacts/Sql.php +++ b/api/src/Contacts/Sql.php @@ -194,7 +194,7 @@ class Sql extends Api\Storage 'COUNT(DISTINCT egw_addressbook.contact_id) AS org_count', "COUNT(DISTINCT CASE WHEN org_unit IS NULL THEN '' ELSE org_unit END) AS org_unit_count", "COUNT(DISTINCT CASE WHEN adr_one_locality IS NULL THEN '' ELSE adr_one_locality END) AS adr_one_locality_count", - ),$wildcard,false,$op/*'OR'*/,'UNION',$filter); + ),$wildcard,false,$op/*'OR'*/,'UNION',$filter,$join); // org by location parent::search($param['search'],array('org_name'), "GROUP BY org_name,$by ORDER BY org_name $sort,$by $sort", array( @@ -203,7 +203,7 @@ class Sql extends Api\Storage 'COUNT(DISTINCT egw_addressbook.contact_id) AS org_count', "COUNT(DISTINCT CASE WHEN org_unit IS NULL THEN '' ELSE org_unit END) AS org_unit_count", "COUNT(DISTINCT CASE WHEN adr_one_locality IS NULL THEN '' ELSE adr_one_locality END) AS adr_one_locality_count", - ),$wildcard,false,$op/*'OR'*/,'UNION',$filter); + ),$wildcard,false,$op/*'OR'*/,'UNION',$filter,$join); $append = "ORDER BY org_name $sort,is_main DESC,$by $sort"; } $rows = parent::search($param['search'],array('org_name'),$append,$extra,$wildcard,false,$op/*'OR'*/,