UFN_SPROPPCHILD_VALID_CONDITION_FOR_GROUP
Validates that the condition code on the child sponsorship opportunity is valid based on the sponsorship group.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | |
@CONDITIONCODEID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_SPROPPCHILD_VALID_CONDITION_FOR_GROUP
(
@ID uniqueidentifier,
@CONDITIONCODEID uniqueidentifier
)
returns bit
with execute as caller
as begin
declare @CONDITIONVAL tinyint;
select
@CONDITIONVAL = SG.HASCONDITIONCODE
from
SPONSORSHIPOPPORTUNITY SO
inner join SPONSORSHIPOPPORTUNITYGROUP SG on SO.SPONSORSHIPOPPORTUNITYGROUPID = SG.ID
where
SO.ID = @ID;
/* 0 = Any, 1 = has condition is true, 2 = has condition is false */
if @CONDITIONVAL = 0 or ((@CONDITIONVAL = 1 AND @CONDITIONCODEID IS NOT NULL) OR (@CONDITIONCODEID IS NULL AND @CONDITIONVAL = 2))
return 1;
return 0;
end