migrated from OI 9
This commit is contained in:
@ -15,8 +15,9 @@ COMPILE FUNCTION obj_Notes(Method,Parms)
|
||||
*/
|
||||
|
||||
|
||||
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, NextKey, SRP_Send_Mail, obj_Calendar, Database_Services
|
||||
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, NextKey, SRP_Send_Mail, obj_Calendar, Database_Services, SRP_Stopwatch
|
||||
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, RList, ErrMsg, obj_Notes_Sent, Btree.Extract, Send_Info, obj_Notes
|
||||
Declare subroutine Obj_Post_Log, SRP_Stopwatch
|
||||
|
||||
$INSERT MSG_EQUATES
|
||||
$INSERT NOTES_EQU
|
||||
@ -50,6 +51,7 @@ BEGIN CASE
|
||||
CASE Method = 'PostEMail' ; GOSUB PostEMail
|
||||
CASE Method = 'ForwardEMail' ; GOSUB ForwardEMail
|
||||
CASE Method = 'EMail' ; GOSUB EMail
|
||||
CASE Method = 'BulkCreate' ; GOSUB BulkCreate
|
||||
CASE 1
|
||||
ErrorMsg = 'Unknown Method ':QUOTE(Method):' passed to object.'
|
||||
|
||||
@ -410,7 +412,7 @@ RETURN
|
||||
* * * * * * *
|
||||
ForwardEMail:
|
||||
* * * * * * *
|
||||
debug
|
||||
|
||||
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
||||
ServiceKeyID = 'Obj_Notes*ForwardEMail'
|
||||
Lock hSysLists, ServiceKeyID then
|
||||
@ -593,4 +595,163 @@ NEXT I ;* End of Recipient Loop
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
BulkCreate:
|
||||
* * * * * * *
|
||||
* SRP_Stopwatch('Reset')
|
||||
Recipients = Parms[1,@RM]
|
||||
SentFrom = Parms[COL2()+1,@RM]
|
||||
Subject = Parms[COL2()+1,@RM]
|
||||
Message = Parms[COL2()+1,@RM]
|
||||
AttachWindow = Parms[COL2()+1,@RM]
|
||||
AttachKeys = Parms[COL2()+1,@RM]
|
||||
SendToGroup = Parms[COL2()+1,@RM]
|
||||
|
||||
IF NOT(ASSIGNED(Recipients)) THEN ErrorMsg = 'Unassigned Parameter "Recipients" passed to object. (':Method:')'
|
||||
IF NOT(ASSIGNED(SentFrom)) THEN ErrorMsg = 'Unassigned Parameter "SentFrom" passed to object. (':Method:')'
|
||||
IF NOT(ASSIGNED(Subject)) THEN ErrorMsg = 'Unassigned Parameter "Subject" passed to object. (':Method:')'
|
||||
IF NOT(ASSIGNED(Message)) THEN ErrorMsg = 'Unassigned Parameter "Message" passed to object. (':Method:')'
|
||||
|
||||
IF NOT(ASSIGNED(AttachWindow)) THEN AttachWindow = ''
|
||||
IF NOT(ASSIGNED(AttachKeys)) THEN AttachKeys = ''
|
||||
IF NOT(ASSIGNED(SendToGroup)) THEN SendToGroup = ''
|
||||
|
||||
IF ErrorMsg NE '' THEN RETURN
|
||||
|
||||
thisRecipients = ''
|
||||
RecipCnt = 0
|
||||
|
||||
FOR I = 1 TO COUNT(Recipients,@VM) + (Recipients NE '')
|
||||
Recipient = Recipients<1,I>
|
||||
IF Recipient NE '' THEN
|
||||
LOCATE Recipient IN thisRecipients USING @VM SETTING Pos ELSE
|
||||
thisRecipients = INSERT(thisRecipients,1,Pos,0,Recipient)
|
||||
RecipCnt += 1
|
||||
END
|
||||
END
|
||||
NEXT I
|
||||
|
||||
NextNoteKey = NextKey('NOTES')
|
||||
|
||||
NoteRec = ''
|
||||
NoteRec<notes_message_type$> = 'I'
|
||||
NoteRec<notes_entry_date$> = Date()
|
||||
NoteRec<notes_entry_time$> = Time()
|
||||
NoteRec<notes_send_to$> = thisRecipients
|
||||
NoteRec<notes_from$> = SentFrom
|
||||
NoteRec<notes_message$> = Message
|
||||
NoteRec<notes_entry_id$> = @USER4
|
||||
NoteRec<notes_subject$> = Subject
|
||||
NoteRec<notes_attach_window$> = AttachWindow
|
||||
NoteRec<notes_attach_keys$> = AttachKeys
|
||||
NoteRec<notes_msg_groups_ids$> = SendToGroup
|
||||
|
||||
OtParms = 'NOTES':@RM:NextNoteKey:@RM:@RM:NoteRec
|
||||
|
||||
Fields = notes_message_type$:@VM ; Values = 'I' :@VM
|
||||
Fields := notes_entry_date$:@VM ; Values := Date() :@VM
|
||||
Fields := notes_entry_time$:@VM ; Values := Time() :@VM
|
||||
Fields := notes_send_to$:@VM ; Values := thisRecipients :@VM
|
||||
Fields := notes_from$:@VM ; Values := SentFrom :@VM
|
||||
Fields := notes_message$:@VM ; Values := Message :@VM
|
||||
Fields := notes_entry_id$:@VM ; Values := @USER4 :@VM
|
||||
Fields := notes_subject$:@VM ; Values := Subject :@VM
|
||||
Fields := notes_attach_window$:@VM ; Values := AttachWindow :@VM
|
||||
Fields := notes_attach_keys$:@VM ; Values := AttachKeys :@VM
|
||||
Fields := notes_msg_groups_ids$ ; Values := SendToGroup
|
||||
|
||||
oblParms = 'NOTES' :@RM
|
||||
oblParms := NextNoteKey :@RM
|
||||
oblParms := Fields :@RM
|
||||
oblParms := Values :@RM
|
||||
oblParms := "TOP" :@VM: "TOP" :@VM: "TOP":@VM: "TOP" :@VM: "TOP":@VM: "TOP" :@VM: "TOP":@VM: "TOP" :@VM: "TOP":@VM: "TOP" :@VM: "TOP"
|
||||
|
||||
* SRP_Stopwatch('Start', 'NOTES Write')
|
||||
//Obj_Post_Log('Create', oblParms)
|
||||
obj_Tables('WriteRec',OtParms) ;* Writes the Note record to disk
|
||||
* SRP_Stopwatch('Stop', 'NOTES Write')
|
||||
CurrDTM = OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTHS')
|
||||
|
||||
RecipientsText = thisRecipients
|
||||
|
||||
SWAP @VM WITH ', ' IN RecipientsText
|
||||
|
||||
FOR I = 1 TO RecipCnt
|
||||
|
||||
thisRecipient = thisRecipients<1,I>
|
||||
|
||||
obj_Notes_Sent('Create',thisRecipient:@RM:NextNoteKey:@RM:CurrDTM) ;* Add to Notes Sent buffer table
|
||||
|
||||
UserRec = XLATE('LSL_USERS',thisRecipient,'','X')
|
||||
FwdFlag = UserRec<LSL_USERS_FWD_EMAIL$>
|
||||
eMailAddr = UserRec<LSL_USERS_EMAIL$>
|
||||
|
||||
IF FwdFlag = 1 AND eMailAddr NE '' THEN
|
||||
|
||||
Text = ''
|
||||
Text<-1> = 'OI eMail From: ':OCONV(SentFrom,'[XLATE_CONV,LSL_USERS*FIRST_LAST]'):' at ':CurrDTM
|
||||
Text<-1> = ''
|
||||
Text<-1> = 'Recipients: ':RecipientsText
|
||||
Text<-1> = ''
|
||||
Text<-1> = 'Subject: ':Subject
|
||||
Text<-1> = ''
|
||||
Text<-1> = 'Message: '
|
||||
Text<-1> = ''
|
||||
Text<-1> = Message
|
||||
Text<-1> = ''
|
||||
|
||||
IF AttachWindow NE '' THEN
|
||||
Text<-1> = ''
|
||||
Text<-1> = 'Attached Window: ':AttachWindow
|
||||
END
|
||||
|
||||
IF AttachKeys NE '' THEN
|
||||
Text<-1> = ''
|
||||
Text<-1> = 'Record Key: ':AttachKeys
|
||||
END
|
||||
|
||||
IF SendToGroup NE '' THEN
|
||||
Text<-1> = ''
|
||||
Text<-1> = 'Sent to Group: ':SendToGroup
|
||||
END
|
||||
|
||||
HeaderText = Text<1>
|
||||
|
||||
CONVERT \00\ TO ',' IN Text
|
||||
SWAP @VM WITH ':@VM:' IN Text
|
||||
SWAP @FM WITH CHAR(13):CHAR(10) IN Text
|
||||
SWAP @TM WITH CHAR(13):CHAR(10) IN Text
|
||||
|
||||
eMailBoxKey = NextNoteKey:'*':thisRecipient
|
||||
|
||||
eMailBoxRec = ''
|
||||
eMailBoxRec<EMAIL_BOX_EMAIL_ADDR$> = eMailAddr
|
||||
eMailBoxRec<EMAIL_BOX_EMAIL_TEXT$> = Text
|
||||
eMailBoxRec<EMAIL_BOX_EMAIL_HEADER$> = HeaderText
|
||||
eMailBoxRec<EMAIL_BOX_FROM_USER$> = SentFrom
|
||||
SRP_Stopwatch('Start', 'Email Write')
|
||||
ebParms = 'EMAIL_BOX':@RM:eMailBoxKey:@RM:@RM:eMailBoxRec
|
||||
//obj_Tables('WriteRec',ebParms)
|
||||
|
||||
Fields = EMAIL_BOX_EMAIL_ADDR$:@VM ; Values = eMailAddr :@VM
|
||||
Fields := EMAIL_BOX_EMAIL_TEXT$:@VM ; Values := Text :@VM
|
||||
Fields := EMAIL_BOX_EMAIL_HEADER$:@VM ; Values := HeaderText :@VM
|
||||
Fields := EMAIL_BOX_FROM_USER$:@VM ; Values := SentFrom :@VM
|
||||
|
||||
eblParms = 'EMAIL_BOX' :@RM
|
||||
eblParms := eMailBoxKey :@RM
|
||||
eblParms := Fields :@RM
|
||||
eblParms := Values :@RM
|
||||
eblParms := "TOP" :@VM: "TOP" :@VM: "TOP":@VM: "TOP"
|
||||
* obj_Tables('WriteRec',ebParms)
|
||||
Obj_Post_Log('Create' eblParms)
|
||||
* SRP_Stopwatch('Stop', 'Email Write')
|
||||
END ;* End of check for forwarding flag
|
||||
|
||||
NEXT I
|
||||
//SRP_Stopwatch('ShowAll')
|
||||
* Test = SRP_Stopwatch('GetAll')
|
||||
* debug
|
||||
RETURN
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user