forked from extern/egroupware
* Addressbook - fix SQL error with accounts hidden + Organisation by location / department
- Fix accounts missing if no preference for hide accounts set
This commit is contained in:
parent
8705ca2589
commit
e88afc07d0
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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'*/,
|
||||
|
Loading…
Reference in New Issue
Block a user