Database SQL Operation: OrganisationUnit.searchOrgUnitByUser
Description: | Method to search for all active organization units associated with a user. |
Sterotype: | nsmulti |
SELECT
OrganisationUnit.organisationUnitID,
OrganisationUnit.name
INTO
:organisationUnitID,
:name
FROM
OrganisationUnit,
PositionHolderLink,
OrgUnitPositionLink
WHERE PositionHolderLink.organisationStructureID = :orgStructureID
AND PositionHolderLink.userName = :userName
AND OrgUnitPositionLink.organisationStructureID = PositionHolderLink.organisationStructureID
AND OrgUnitPositionLink.positionID = PositionHolderLink.positionID
AND OrgUnitPositionLink.organisationUnitID = OrganisationUnit.organisationUnitID
AND PositionHolderLink.recordStatus = :statusCode
AND PositionHolderLink.fromDate <= :effectiveDate
AND
(
PositionHolderLink.toDate >= :effectiveDate
OR PositionHolderLink.toDate IS NULL
)
|