Skip to content
Snippets Groups Projects
Commit 6d5ed5e0 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

use Sqlbuilder for commrestriction

parent 976f9fbd
No related branches found
No related tags found
No related merge requests found
......@@ -434,9 +434,13 @@ ContactUtils.getCommRestrictionCondition = function (pMedium, pNoRestriction, pS
// check contactid
.or("COMMRESTRICTION.CONTACT_ID = CONTACT.CONTACTID")
// or the contact id of the organisation
.or("COMMRESTRICTION.CONTACT_ID = (select orgContact.CONTACTID from CONTACT anyContact \n\
join CONTACT orgContact on anyContact.ORGANISATION_ID = orgContact.ORGANISATION_ID \n\
and orgContact.PERSON_ID is null where anyContact.CONTACTID = CONTACT.CONTACTID)")
.or("COMMRESTRICTION.CONTACT_ID", newSelect("orgContact.CONTACTID")
.from("CONTACT anyContact")
.join("CONTACT orgContact", newWhere("anyContact.ORGANISATION_ID = orgContact.ORGANISATION_ID")
.and("orgContact.PERSON_ID is null")
)
.where("anyContact.CONTACTID = CONTACT.CONTACTID")
)
)
var cond = "exists ?";
if (pNoRestriction)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment