fix fields for znuny view

This commit is contained in:
Timotheus Pokorra 2024-11-18 12:47:12 +01:00 committed by Dev und Test fuer hsadminng
parent cbb45b4d46
commit 141f761ded

View File

@ -9,19 +9,20 @@ SELECT
max(p.partnernumber::text) as number,
max(debitor.defaultprefix) as code,
c.emailaddresses->>'main' as login,
max(per.salutation) as salut,
max(per.givenname) as firstname,
max(per.familyname) as lastname,
max(per.title) as title,
max(per.tradename) as firma,
max(c.postaladdress->>'co') as co,
(CASE WHEN max(per.salutation) <> '' THEN max(per.salutation) ELSE NULL END) as salut,
(CASE WHEN max(per.givenname) <> '' THEN max(per.givenname) ELSE NULL END) as firstname,
(CASE WHEN max(per.familyname) <> '' THEN max(per.familyname) ELSE NULL END) as lastname,
(CASE WHEN max(per.title) <> '' THEN max(per.title) ELSE NULL END) as title,
(CASE WHEN max(per.tradename) <> '' THEN max(per.tradename) ELSE NULL END) as firma,
(CASE WHEN max(c.postaladdress->>'co') <> '' THEN max(c.postaladdress->>'co') ELSE NULL END) as co,
max(c.postaladdress->>'street') as street,
max(c.postaladdress->>'zipcode') as zipcode,
max(c.postaladdress->>'city') as city,
max(c.postaladdress->>'country') as country,
c.phonenumbers->>'phone_office' as phoneoffice,
concat_ws(', '::text, c.phonenumbers->>'phone_office', c.phonenumbers->>'phone_private') AS phone,
c.phonenumbers->>'phone_office' as phone_office,
c.phonenumbers->>'phone_private' as phone_private,
c.phonenumbers->>'phone_mobile' as mobile,
c.phonenumbers->>'phone_private' as phoneprivate,
c.phonenumbers->>'fax' as fax,
c.emailaddresses->>'main' as email,
string_agg(CASE WHEN relation.mark IS NULL THEN relation.type::text ELSE CONCAT(relation.type::text, ':', relation.mark::text) END, '/'::text) AS comment,