add view for znuny
This commit is contained in:
parent
4aecd38095
commit
fc70524111
@ -0,0 +1,39 @@
|
||||
CREATE OR REPLACE VIEW hs_integration.ticket_customer_user AS
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
1 AS valid
|
||||
FROM hs_office.partner p
|
||||
JOIN hs_office.relation AS pRel
|
||||
ON pRel.type = 'PARTNER'
|
||||
AND pRel.uuid = p.partnerRelUuid
|
||||
JOIN hs_office.relation AS dRel
|
||||
ON dRel.type = 'DEBITOR'
|
||||
AND dRel.anchorUuid = pRel.holderUuid
|
||||
JOIN hs_office.debitor AS debitor
|
||||
ON debitor.debitorreluuid = dRel.uuid
|
||||
AND debitor.debitornumbersuffix = '00'
|
||||
JOIN hs_office.relation AS rs1 ON rs1.uuid = p.partnerreluuid AND rs1.type = 'PARTNER'
|
||||
JOIN hs_office.relation AS relation ON relation.anchoruuid = rs1.holderuuid
|
||||
JOIN hs_office.contact AS c ON c.uuid = relation.contactuuid
|
||||
JOIN hs_office.person AS per ON per.uuid = relation.holderuuid
|
||||
where debitor.defaultprefix != 'hsh'
|
||||
and relation.type != 'DEBITOR'
|
||||
group by c.emailaddresses, c.phonenumbers;
|
@ -174,4 +174,6 @@ databaseChangeLog:
|
||||
- include:
|
||||
file: db/changelog/9-hs-global/9100-hs-integration-schema.sql
|
||||
- include:
|
||||
file: db/changelog/9-hs-global/9110-integration-kimai.sql
|
||||
file: db/changelog/9-hs-global/9110-integration-kimai.sql
|
||||
- include:
|
||||
file: db/changelog/9-hs-global/9120-integration-znuny.sql
|
Loading…
Reference in New Issue
Block a user