Modified PM Specs to use AD Groups to send notifications

This commit is contained in:
Infineon\Ouellette
2024-09-13 16:17:29 -07:00
parent c20f94a26f
commit d637ac8067
5 changed files with 7016 additions and 1890 deletions

View File

@ -7,15 +7,18 @@ COMPILE FUNCTION PM_Spec(EntID,Event,Parm1,Parm2,Parm3,Parm4,Parm5)
*/
DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, obj_Tables, Post_Event
DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, Btree.Extract, obj_AppWindow
DECLARE SUBROUTINE obj_Notes, Security_Err_Msg, End_Window, Forward_Event, Start_Window, Create_Note
DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, Btree.Extract, obj_AppWindow, Delete
DECLARE SUBROUTINE obj_Notes, Security_Err_Msg, End_Window, Forward_Event, Start_Window, Create_Note, Database_Services
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, obj_Popup, Popup
DECLARE FUNCTION Send_Message, Msg, NextKey
DECLARE FUNCTION Send_Message, Msg, NextKey, Database_Services, Msg, Error_Services
$INSERT MSG_EQUATES
$INSERT APPCOLORS
$INSERT PM_EQUATES
$Insert PM_Spec_Equates
EQU CRLF$ TO \0D0A\
EQU TAB$ TO \09\
@ -46,6 +49,8 @@ BEGIN CASE
CASE EntID = @WINDOW:'.LU_PMS_ID' AND Event = 'CLICK' ; GOSUB LUPMSId
CASE EntID = @WINDOW:'.LU_TOOL_ID' AND Event = 'CLICK' ; GOSUB LUToolID
CASE EntID = @WINDOW:'.LU_TIME_CD' AND Event = 'CLICK' ; GOSUB LUInterval
Case EntID = @Window:'.PUB_ADD_NOTIFY_GROUP' AND Event = 'CLICK'; GoSub AddNotificationGroup
Case EntID = @Window:'.PUB_DELETE_NOTIFY_GROUP'AND Event = 'CLICK'; GoSub DeleteNotificationGroup
CASE 1
ErrorMsg = 'Unknown Parameters ':EntID:' - ':Event:' passed to commuter'
@ -138,6 +143,10 @@ Refresh:
END
NEXT Line
NEXT I
ThisPMSpecRec = Database_Services('ReadDataRow', 'PM_SPEC', @ID, 1, 0, 0)
ADNotificationGroups = ThisPMSpecRec<PM_SPEC_AD_NOTIFICATION_GROUPS$>
Set_Property(@Window : '.EDT_NOTIFICATION_GROUPS', 'ARRAY', ADNotificationGroups)
RETURN
@ -262,3 +271,60 @@ PMKeyDC:
RETURN
AddNotificationGroup:
Def = ""
Def<MTEXT$> = "Enter in an existing Distribution List Name:"
Def<MTYPE$> = "RE"
Def<MICON$> = "?"
Group = Msg(@window, Def)
If Group NE '' then
//Save any uncommited changes
UpdatedRec = Get_Property (@Window, "ATRECORD")
Locate Group in UpdatedRec<PM_SPEC_AD_NOTIFICATION_GROUPS$> using @VM setting gPos then
Text = "Distribution list is already assigned."
Msg(@window, Text)
end else
UpdatedRec<PM_SPEC_AD_NOTIFICATION_GROUPS$, -1> = Group
Database_Services('WriteDataRow', 'PM_SPEC', @ID, UpdatedRec, 1, 0, 1)
if Error_Services('NoError') then
Set_Property (@Window, "ATRECORD", UpdatedRec)
Set_Property(@Window, 'SAVEWARN', 0)
Text = "Distribution list has been added."
Msg(@window, Text)
GoSub Refresh
end else
ErrMsg = Error_Services('GetMessage')
Text = "Error while adding to PM Spec record. " : ErrMsg
Msg(@window, Text)
end
end
end
return
DeleteNotificationGroup:
PMSpecID = @ID
NotifArray = Get_Property(@Window:'.EDT_NOTIFICATION_GROUPS', 'ARRAY')
SelectedPos = Get_Property(@Window: '.EDT_NOTIFICATION_GROUPS', "SELPOS")<2>
GroupToDelete = NotifArray<1,SelectedPos>
If GroupToDelete NE '' then
UpdatedRec = Get_Property (@Window, "ATRECORD")
Locate GroupToDelete in UpdatedRec<PM_SPEC_AD_NOTIFICATION_GROUPS$> using @VM setting gPos then
UpdatedRec = Delete(UpdatedRec, PM_SPEC_AD_NOTIFICATION_GROUPS$, gPos, 0)
Database_Services('WriteDataRow', 'PM_SPEC', PMSpecID, UpdatedRec, 1, 0, 1)
if Error_Services('NoError') then
Set_Property (@Window, "ATRECORD", UpdatedRec)
Set_Property(@Window, 'SAVEWARN', 0)
Text = "Distribution list has been removed."
Msg(@window, Text)
GoSub Refresh
end else
ErrMsg = Error_Services('GetMessage')
Text = "Error while deleting notification group PM Spec record. " : ErrMsg
Msg(@window, Text)
end
end
end
return