UFN_FACULTY_ISADVISINGSTUDENT

Indicates whether the specified faculty advises the specified student in a timeframe encompassing the given date.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@FACULTYID uniqueidentifier IN
@STUDENTID uniqueidentifier IN
@SPECIFIEDDATE date IN

Definition

Copy


create function dbo.UFN_FACULTY_ISADVISINGSTUDENT
(
    @FACULTYID uniqueidentifier,
    @STUDENTID uniqueidentifier,
    @SPECIFIEDDATE date = null
)
returns bit as 
/*
    SpecifiedDate can be left as null to check if the Faculty advises the specified student at any time.

    Also used by functions in the Blackbaud.AppFx.Security.Catalog.FacultyStudentRecordSecurityService.
    So we don't have the exact same sql copied in two places, this uses UFN_SECURITY_FACULTY_GRANTED_STUDENTS
      with parameters so only the pertinent parts of that sql run.
*/
begin
    --UFN_SECURITY_FACULTY_GRANTED_STUDENTS(FacultyID, Date, IncludeAdvisees, IncludeStudentsInClasses)

    if exists (select 1
                from dbo.UFN_SECURITY_FACULTY_GRANTED_STUDENTS(@FACULTYID, @SPECIFIEDDATE, 1, 0)
                where ID = @STUDENTID)
          return 1;

    return 0;
end