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
5d0eeb9f
Commit
5d0eeb9f
authored
May 30, 2023
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cosine: Add "Cancel Workflow" action to WF portlet
parent
70497df3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
intranet-workflow-procs.tcl
tcl/intranet-workflow-procs.tcl
+24
-8
reset-case-2.tcl
www/reset-case-2.tcl
+6
-0
No files found.
tcl/intranet-workflow-procs.tcl
View file @
5d0eeb9f
...
...
@@ -550,6 +550,7 @@ ad_proc -public im_workflow_graph_component {
set debug_case_help
"Show extended debug information"
set start_new_case_help
"Create a new case of the same workflow and start it from scratch"
set nuke_case_help
"Nuke this workflow from the database without a trace"
set cancel_case_help
"Cancel this workflow. No further WF action will occur."
set restart_case_help
"Restart this workflow from the start, maintaining the journal"
append assignee_html
"
...
...
@@ -559,9 +560,9 @@ ad_proc -public im_workflow_graph_component {
[
lang::message::lookup
""
intranet-workflow.Debug_case
"Debug case"
]
[
im_gif help
$debug
_case_help
]
</a>
<li><a href='
[
export_vars -base
"/intranet-workflow/reset-case?"
{
return_url case_id
{
action
"c
opy"
}
{
action_pretty
"Copy
"
}}]
'>
[
lang::message::lookup
""
intranet-workflow.C
opy_Case
"Copy and start new
case"
]
[
im_gif help
$
start
_new
_case_help
]
<li><a href='
[
export_vars -base
"/intranet-workflow/reset-case?"
{
return_url case_id
{
action
"c
ancel"
}
{
action_pretty
"Cancel
"
}}]
'>
[
lang::message::lookup
""
intranet-workflow.C
ancel_Case
"Cancel
case"
]
[
im_gif help
$
cancel
_case_help
]
</a>
<li><a href='
[
export_vars -base
"/intranet-workflow/reset-case?"
{
return_url case_id
{
action
"nuke"
}
{
action_pretty
"Nuke"
}}]
'>
[
lang::message::lookup
""
intranet-workflow.Nuke_Case
"Nuke case"
]
...
...
@@ -571,6 +572,10 @@ ad_proc -public im_workflow_graph_component {
[
lang::message::lookup
""
intranet-workflow.Restart_Case
"Restart case"
]
[
im_gif help
$restart
_case_help
]
</a>
<li><a href='
[
export_vars -base
"/intranet-workflow/reset-case?"
{
return_url case_id
{
action
"copy"
}
{
action_pretty
"Copy"
}}]
'>
[
lang::message::lookup
""
intranet-workflow.Copy_Case
"Copy and start new case"
]
[
im_gif help
$start
_new_case_help
]
</a>
</ul>
</td></tr>
"
...
...
@@ -1718,24 +1723,31 @@ ad_proc im_workflow_object_permissions {
#
ad_proc im_workflow_cancel_workflow
{
-object_id:required
{
-object_id
""
}
{
-case_id
""
}
}
{
Cancel the workflow in case the underlying object gets closed,
such like a ticket of a deleted project.
}
{
set journal_id
""
set case_ids
[
list
$case
_id
]
if
{
""
ne
$object
_id
}
{
set case_ids
[
db_list case_ids
"select case_id from wf_cases where object_id = :object_id"
]
}
lappend case_ids 0
# 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
where case_id in (
[
join
$case
_ids
","
]
) 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
where case_id in (
[
join
$case
_ids
","
]
) and
state in ('started')
"
db_foreach cancel_started_tasks
$cancel
_tasks_sql
{
...
...
@@ -1750,12 +1762,16 @@ ad_proc im_workflow_cancel_workflow {
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
where case_id in (
[
join
$case
_ids
","
]
) 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"
}
# Cancel the case itself
db_dml cancel_case
"update wf_cases set state = 'canceled' where case_id in (
[
join
$case
_ids
","
]
)"
}
www/reset-case-2.tcl
View file @
5d0eeb9f
...
...
@@ -77,6 +77,12 @@ switch $action {
db_dml delete_case
"delete from wf_cases where case_id = :case_id"
}
"cancel"
{
ns_log Notice
"reset-case-2: Canceling case_id=
$case
_id"
im_workflow_new_journal -case_id
$case
_id -action
"cancel WF"
-action_pretty
"Cancel WF"
-message
"Canceling WF using 'Cancel Case' action in WF component"
im_workflow_cancel_workflow -case_id
$case
_id
}
"copy"
{
ns_log Notice
"reset-case-2: Copying case_id=
$case
_id"
# Start a new workflow case
...
...
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