USP_DATALIST_MKTSOURCECODES
Displays a list of the available source code layouts.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@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. |
@INCLUDEINACTIVE | tinyint | IN | Include inactive |
@SITEFILTERMODE | tinyint | IN | |
@SITESSELECTED | xml | IN | |
@INACTIVEFILTER | bit | IN |
Definition
Copy
CREATE procedure dbo.[USP_DATALIST_MKTSOURCECODES]
(
@CURRENTAPPUSERID uniqueidentifier = null,
@SECURITYFEATUREID uniqueidentifier = null,
@SECURITYFEATURETYPE tinyint = null,
@INCLUDEINACTIVE tinyint = 0,
@SITEFILTERMODE tinyint = 0,
@SITESSELECTED xml = null,
@INACTIVEFILTER bit = 0
)
as
set nocount on;
-- To maintain backwards compatibility, override the inactivefilter filter if INCLUDEINACTIVE is set
if @INCLUDEINACTIVE = 1
set @INACTIVEFILTER = null;
select distinct
[MKTSOURCECODE].[ID],
[MKTSOURCECODE].[NAME],
[MKTSOURCECODE].[ISDEFAULT],
[MKTSOURCECODE].[ISACTIVE],
dbo.[UFN_MKTSOURCECODE_BUILDSAMPLECODE]([MKTSOURCECODE].[ID], 0) as [SAMPLECODE],
dbo.[UFN_MKTSOURCECODE_BUILDSAMPLECODE]([MKTSOURCECODE].[ID], 1) as [SOURCECODEDEFINITION],
dbo.[UFN_MKTSOURCECODE_INUSE]([MKTSOURCECODE].[ID]) as [INUSE],
dbo.[UFN_TRANSLATIONFUNCTION_SITE_GETNAME]([MKTSOURCECODE].[SITEID]) as [SITE],
[MKTSOURCECODE].[ISHISTORICAL]
from dbo.[MKTSOURCECODE]
where
(@INACTIVEFILTER is null
or (@INACTIVEFILTER = 0 and [MKTSOURCECODE].[ISACTIVE] = 1)
or (@INACTIVEFILTER = 1 and [MKTSOURCECODE].[ISACTIVE] = 0))
and (@SITEFILTERMODE = 0 or [MKTSOURCECODE].[SITEID] in (select [SITEID] from dbo.[UFN_SITE_BUILDDATALISTSITEFILTER](@CURRENTAPPUSERID, @SITEFILTERMODE, @SITESSELECTED)))
and (dbo.UFN_APPUSER_ISSYSADMIN(@CURRENTAPPUSERID) = 1 or exists (select 1 from dbo.UFN_SITESFORUSERONFEATURE(@CURRENTAPPUSERID,@SECURITYFEATUREID,@SECURITYFEATURETYPE) where SITEID=[MKTSOURCECODE].[SITEID] or (SITEID is null and [MKTSOURCECODE].[SITEID] is null)));
return 0;