Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.NotificationsExist ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create function "pears"."NotificationsExist"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "pTemplateid" char(50),in "pDeptid" char(2),in "pNotificationType" char(20),in "pRecipientType" char(20) ) returns tinyint begin if exists(select * from "NotificationTemplate" where "isnull"("Defunct",0) = 0 and "NotificationType" = "pTemplateID" and "isnull"("divisionid",'') = any(select "DivisionID" from "DivisionsAllowed") and "NotificationType" like "pNotificationType" and "RecipientType" like "pRecipientType" and("isnull"("ownerid","userstaffid") = "userstaffid") and((not exists(select * from "NotificationDepartment" as "d" where "d"."NotificationTemplateid" = "NotificationTemplate"."NotificationTemplateid")) or((not exists(select * from "NotificationDepartment" as "d" where "d"."NotificationTemplateid" = "NotificationTemplate"."NotificationTemplateid")) or(exists(select * from "NotificationDepartment" as "d" key join "department" as "dd" where "d"."NotificationTemplateid" = "NotificationTemplate"."NotificationTemplateid" and "dd"."departmentid" like "pdeptid" and "isnull"("dd"."DivisionID",'') = any(select "DivisionID" from "DivisionsAllowed")))))) then return 1 else return 0 end if end </code> database/functions/pears_notificationsexist.txt Last modified: 2026/08/07 19:24by 127.0.0.1