USP_DATALIST_PHONEFINDER

Returns a list of all PhoneFinder processes

Parameters

Parameter Parameter Type Mode Description
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@SITEFILTERMODE tinyint IN Sites
@SITESSELECTED xml IN
@SECURITYFEATUREID uniqueidentifier IN Input parameter indicating the ID of the feature to use for site security checking.
@SECURITYFEATURETYPE tinyint IN Input parameter indicating the type of the feature to use for site security checking.

Definition

Copy


CREATE procedure dbo.USP_DATALIST_PHONEFINDER
(
    @CURRENTAPPUSERID uniqueidentifier,
    @SITEFILTERMODE tinyint = 0,
    @SITESSELECTED xml = null,
    @SECURITYFEATUREID uniqueidentifier = null,
    @SECURITYFEATURETYPE tinyint = null
)
as
begin
    set nocount on;

    select
        PHONEFINDER.[ID],
        PHONEFINDER.[NAME],        
        PHONEFINDER.[FILEAVAILABLE],
        case when dbo.UFN_PHONEFINDER_GETLASTRUNDATE(PHONEFINDER.[ID]) is null then N'' else rtrim(left(PHONEFINDER.[STEP], len(PHONEFINDER.[STEP]) - 3)) end as [LASTACTIVITY],
        dbo.UFN_PHONEFINDER_GETLASTRUNDATE(PHONEFINDER.[ID]) as [LASTACTIVITYDATE],
        coalesce(SITE.NAME, 'All sites') as SITE
    from
        dbo.PHONEFINDER
        left outer join dbo.SITE on SITE.[ID] = PHONEFINDER.[SITEID]
    where
        (
          (
          PHONEFINDER.SITEID is null
          or
          (dbo.UFN_APPUSER_ISSYSADMIN(@CURRENTAPPUSERID) = 1 or exists (select 1 from dbo.UFN_SITESFORUSERONFEATURE(@CURRENTAPPUSERID,@SECURITYFEATUREID,@SECURITYFEATURETYPE) where SITEID=[SITE].[ID] or (SITEID is null and [SITE].[ID] is null)))
      )
            and
            (
                @SITEFILTERMODE = 0
                    or SITE.[ID] in
                    (
                        select SITEFILTER.[SITEID]
                        from dbo.UFN_SITE_BUILDDATALISTSITEFILTER(@CURRENTAPPUSERID, @SITEFILTERMODE, @SITESSELECTED) as [SITEFILTER]
                    )
            )
        )
    order by
        PHONEFINDER.[NAME];
end