Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-workflow
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-workflow
Commits
beb54bb9
Commit
beb54bb9
authored
Nov 12, 2010
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added procedure to cancel entire workflows
parent
6fbf4544
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
intranet-workflow-procs.tcl
tcl/intranet-workflow-procs.tcl
+52
-0
No files found.
tcl/intranet-workflow-procs.tcl
View file @
beb54bb9
...
...
@@ -1434,3 +1434,55 @@ ad_proc im_workflow_object_permissions {
return
$perm
_set
}
# ---------------------------------------------------------------
# Cancel the workflow in case the underlying object gets closed,
# such like a ticket of a deleted project.
#
ad_proc im_workflow_cancel_workflow
{
-object_id:required
}
{
Cancel the workflow in case the underlying object gets closed,
such like a ticket of a deleted project.
}
{
set journal_id
""
# Delete all tokens of the case
db_dml delete_tokens
"
delete from wf_tokens
where case_id in (select case_id from wf_cases where object_id = :object_id) and
state in ('free', 'locked')
"
set cancel_tasks_sql
"
select task_id as wf_task_id
from wf_tasks
where case_id in (select case_id from wf_cases where object_id = :object_id) and
state in ('started')
"
db_foreach cancel_started_tasks
$cancel
_tasks_sql
{
ns_log Notice
"im_workflow_cancel_workflow: canceling task
$wf
_task_id"
set journal_id
[
im_workflow_task_action -task_id
$wf
_task_id -action
"cancel"
-message
"Canceling workflow"
]
}
# fraber 101112:
# ToDo: Validate that it's OK just to change the status of a task to
"canceled"
# in order to disable it. Or should the task be deleted?
#
set del_enabled_tasks_sql
"
select task_id as wf_task_id
from wf_tasks
where case_id in (select case_id from wf_cases where object_id = :object_id) and
state in ('enabled')
"
db_foreach cancel_started_tasks
$del
_enabled_tasks_sql
{
ns_log Notice
"im_workflow_cancel_workflow: deleting enabled task
$wf
_task_id"
db_dml del_task
"update wf_tasks set state = 'canceled' where task_id = :wf_task_id"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment