Description
Processes notifications for users belonging to a specified company.
Parameters
iiCompanyID | input | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/mfgnotification.p)
/* Following are notification roles associated with creation of associated component types */
vcRole = {&NOTIFICATION-EMPLOYEENOTIFY}.
if(vcComponentType = {&NOTIFICATION-SUPPLIER}) then vcRole = {&NOTIFICATION-SUPPLIERNOTIFY}.
if(vcComponentType = {&NOTIFICATION-CUSTOMER}) then vcRole = {&NOTIFICATION-CUSTOMERNOTIFY}.
if(vcComponentType = {&NOTIFICATION-ENDUSER}) then vcRole = {&NOTIFICATION-ENDUSERNOTIFY}.
<Q-7 run UsrCompanyByUserCompanyId (Start) in BUser >
<Q-8 run GetUserRoles (Start) in BUser >
<Q-9 run UserById (Start) in BUser >
<Q-10 run UsrByIdLoginIsActNameLng (Start) in BUser >
<Q-1 run UsrCompanyByUserCompanyId (all) (Read) (NoCache)
(input iiCompanyID, (CompanyId)
input ?, (CompanyCode)
input ?, (UsrLogin)
output dataset tqUsrCompanyByUserCompanyId) in BUser >
for each tqUsrCompanyByUserCompanyId:
find first tNotifications where
tNotifications.tiUserId = tqUsrCompanyByUserCompanyId.tiUsr_ID and
tNotifications.tcComponentDomain = vcComponentDomain no-error.
if(available(tNotifications)) then do:
next.
end.
<Q-2 run GetUserRoles (all) (Read) (NoCache)
(input tqUsrCompanyByUserCompanyId.tiUsr_ID, (UserId)
input iiCompanyID, (CompanyId)
output dataset tqGetUserRoles) in BUser >
for each tqGetUserRoles where tqGetUserRoles.tcRoleName = vcRole:
<Q-3 run UserById (all) (Read) (NoCache)
(input tqUsrCompanyByUserCompanyId.tiUsr_ID, (UsrId)
output dataset tqUserById) in BUser >
for each tqUserByID where
tqUserById.tcUsrMailAddress <> ? and
tqUserById.tcUsrMailAddress <> "":
<Q-4 run UsrByIdLoginIsActNameLng (all) (Read) (NoCache)
(input tqUsrCompanyByUserCompanyId.tiUsr_ID, (UsrId)
input ?, (UsrLogin)
input ?, (UsrIsActive)
input ?, (UsrName)
input ?, (LngId)
output dataset tqUsrByIdLoginIsActNameLng) in BUser >
vcLangCode = 'US':U.
find first tqUsrByIdLoginIsActNameLng no-error.
if(available(tqUsrByIdLoginIsActNameLng)) then do:
vcLangCode = tqUsrByIdLoginIsActNameLng.tcLngCode.
end.
/* Retrieve translated subject and content */
<M-5 run GetSubject
(input vcLangCode (icLangCode),
output vcSubjectText (ocSubjectText),
output viFcReturnSuper (oiReturnStatus)) in MfgNotification>
if(viFcReturnSuper < 0) then do:
oiReturnStatus = viFcReturnSuper.
return.
end.
<M-6 run GetContent
(input vcLangCode (icLangCode),
output vcContentText (ocContentText),
output viFcReturnSuper (oiReturnStatus)) in MfgNotification>
if(viFcReturnSuper < 0) then do:
oiReturnStatus = viFcReturnSuper.
return.
end.
/* Queue up e-mail data */
create tNotifications.
assign
tNotifications.tcEMailAddress = tqUserById.tcUsrMailAddress
tNotifications.tcSubject = vcSubjectText
tNotifications.tcContent = vcContentText
tNotifications.tiUserID = tqUsrCompanyByUserCompanyId.tiUsr_ID
tNotifications.tcComponentDomain = vcComponentDomain
tNotifications.tcRecipient = tqUsrByIdLoginIsActNameLng.tcUsrName.
end. /* for each tqUserByID */
end. /* for each tqGetUserRoles */
end. /* for each tqUserCompanyByUserCompanyID */
<Q-11 run UsrCompanyByUserCompanyId (Stop) in BUser >
<Q-12 run GetUserRoles (Stop) in BUser >
<Q-13 run UserById (Stop) in BUser >
<Q-14 run UsrByIdLoginIsActNameLng (Stop) in BUser >