pears.MasterRosterTempAllowed
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
Original SQL
CREATE FUNCTION "pears"."MasterRosterTempAllowed"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ IN "ppersid" CHAR(20),IN "pmastershiftid" CHAR(20) ) RETURNS INTEGER BEGIN DECLARE "ionly" INTEGER; DECLARE "iactive" INTEGER; IF "pmastershiftid" IS NULL THEN RETURN 1 END IF; IF "ppersid" = (SELECT "defaultpersonid" FROM "masterrostershift" WHERE "masterrostershiftid" = "pmastershiftid") THEN RETURN 1 END IF; SELECT "isnull"("r"."useonlypreferred",0),"isnull"("p"."active",0) INTO "ionly","iactive" FROM "masterrostershift" AS "s" KEY JOIN "masterroster" AS "r" LEFT OUTER JOIN "MasterRosterPreferredPerson" AS "p" ON "r"."MasterRosterID" = "p"."MasterRosterID" AND "p"."PersonID" = "ppersid" WHERE "s"."masterrostershiftid" = "pmastershiftid"; IF "ionly" = 0 THEN RETURN 1 ELSE RETURN "iactive" END IF END