{-----------------------------------------------------------------------
'
'
procedure for the taskmanager
'
'----------------------------------------------------------------------------------}
{....................................AGENT INFO..............................................}
start_agent_info
AgentName = "TASKMANAGER"
AgentDescr = ""
AgentLanguage = ""
__timer_interval = 0
__is_registered = 1
__delete_on_termination = 0
end_agent_info
{....................................PRODUCTION
CODE..................................................}
{..............................................................................new
task}
start_bpm_activity "new task"
start_bpm_subactivity "new
task to assign"
rec = bpm_getrecid()
if (rec = 0)
then
call
OpenForm("ptAppend","TASK_E01.FM","WORK.TASK",1,"?=TASK")
else
expr
= strcat(rec,"=TASK")
call
OpenForm("ptEdit","TASK_E01.FM","WORK.TASK",1,expr)
endif
end_bpm_subactivity
start_bpm_validation
result = 1
rec = bpm_getrecid(1)
if (rec = 0)
then
call
message("You havent created a new task!")
result
= 0
endif
if (rec >
0) then
user
= LookUp("TASK","TASK",rec,"TOUSER","")
pos
= LookUp("TASK","TASK",rec,"TOPOSITION","")
if
(user = "") and (pos = "") then
call message("The task must be assigned to a user or to
a position!")
result = 1
endif
if
(user <> "") and (pos <> "") then
call message("The task has been assigned to a user AND
to a position!")
result = 1
endif
endif
end_bpm_validation
end_bpm_activity
{..................................................................................working
on task}
start_bpm_activity "working on task"
start_bpm_subactivity "task
elements"
rec =
__params[1]
expr = strcat(rec,"=TASK")
call OnOpenForm_DisableAllFields()
call OnOpenForm_EnableField("COMM")
call OpenForm("ptEdit","TASK_E02.FM","WORK.TASK",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................check
the task work}
start_bpm_activity "check the task
work"
start_bpm_subactivity "task
elements"
rec =
__params[1]
expr = strcat(rec,"=TASK")
call OnOpenForm_DisableField("DESCR")
call OpenForm("ptEdit","TASK_E01.FM","WORK.TASK",1,expr)
end_bpm_subactivity
start_bpm_validation
result = 1
rec = bpm_getrecid(1)
if (rec = 0)
then
call
message("You have not examined the task!")
result
= 0
endif
if (rec >
0) then
user
= LookUp("TASK","TASK",rec,"TOUSER","")
pos
= LookUp("TASK","TASK",rec,"TOPOSITION","")
if
(user = "") and (pos = "") then
call message("The task must be assigned to a user or to
a position!")
result = 1
endif
if
(user <> "") and (pos <> "") then
call message("The task has been assigned to a user AND
to a position!")
result = 1
endif
endif
end_bpm_validation
end_bpm_activity
{.....................................CONTROL
CODE......................................................}
{.................................ACTION
CODE................................................
Every user can activate a new task.
The task can be assigned to another user, position into
the the company
or to himself.
The task goes for completion to the user or position assigned.
After that returns to the task issuer.
The task issuer can repassing again the task util its completed
(by checking the "Finished" check box)
}
start_action
call bpm_setprocedureowner("JOHN")
{.....set
the procedure owner}
callwait bpm_assign_job ( "new task" , __activation_user
, "" , 0) {....start the new task}
task_id = bpm_getrecid(1,__au_step)
{......subactivity, activity}
comm = LookUp("TASK","TASK",task_id,"DESCR","")
call bpm_setprocedurecomment(comm)
{.....set the procedures comment}
for i = 1 to 1000
user = LookUp("TASK","TASK",task_id,"TOUSER","")
pos = LookUp("TASK","TASK",task_id,"TOPOSITION","")
finished = LookUp("TASK","TASK",task_id,"FINISHED","")
if (finished = 1) then
i = 1000
else
if (user <> "") then
{...the user works on the task}
callwait bpm_assign_job
( "working on task" , user , "" , 0 , task_id )
endif
if (pos <> "") then {...the
users with position works on the task}
callwait bpm_assign_job
( "working on task" , "" , pos , 0 , task_id )
endif
{.....the task issuer examines
if the task is completed, or reassinges it again (to the same
or different person}
callwait bpm_assign_job ( "check
the task work" , __activation_user , "" , 0 , task_id )
endif
next
{------------------------------------
end of procedure ---------------------------------------------}
end_action |