mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-09 15:38:27 +01:00
Backport 31732 - Fix incorrect address count when searching organisations (#8117)
This commit is contained in:
parent
c07bbde11d
commit
30c1634b9c
@ -143,7 +143,7 @@ class addressbook_sql extends so_sql
|
|||||||
if (!$by)
|
if (!$by)
|
||||||
{
|
{
|
||||||
$extra = array(
|
$extra = array(
|
||||||
'COUNT(org_name) AS org_count',
|
'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 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",
|
"COUNT(DISTINCT CASE WHEN adr_one_locality IS NULL THEN '' ELSE adr_one_locality END) AS adr_one_locality_count",
|
||||||
);
|
);
|
||||||
@ -158,7 +158,7 @@ class addressbook_sql extends so_sql
|
|||||||
parent::search($param['search'],array('org_name'),$append,array(
|
parent::search($param['search'],array('org_name'),$append,array(
|
||||||
"NULL AS $by",
|
"NULL AS $by",
|
||||||
'1 AS is_main',
|
'1 AS is_main',
|
||||||
'COUNT(org_name) AS org_count',
|
'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 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",
|
"COUNT(DISTINCT CASE WHEN adr_one_locality IS NULL THEN '' ELSE adr_one_locality END) AS adr_one_locality_count",
|
||||||
),'%',false,'OR','UNION',$filter);
|
),'%',false,'OR','UNION',$filter);
|
||||||
@ -167,7 +167,7 @@ class addressbook_sql extends so_sql
|
|||||||
parent::search($param['search'],array('org_name'),$append,array(
|
parent::search($param['search'],array('org_name'),$append,array(
|
||||||
"CASE WHEN $by IS NULL THEN '' ELSE $by END AS $by",
|
"CASE WHEN $by IS NULL THEN '' ELSE $by END AS $by",
|
||||||
'0 AS is_main',
|
'0 AS is_main',
|
||||||
'COUNT(org_name) AS org_count',
|
'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 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",
|
"COUNT(DISTINCT CASE WHEN adr_one_locality IS NULL THEN '' ELSE adr_one_locality END) AS adr_one_locality_count",
|
||||||
),'%',false,'OR','UNION',$filter);
|
),'%',false,'OR','UNION',$filter);
|
||||||
|
Loading…
Reference in New Issue
Block a user