Commit 06604efc authored by Christof Damian 's avatar Christof Damian

task delete wizard: assign tasks related stuff (resources, dependencies, ...)

to another task when deleting
parent f959ef7e
......@@ -126,7 +126,6 @@ switch $action {
if {[catch {
foreach del_task_id $delete_task_list {
db_dml del_task_deps "delete from im_timesheet_task_dependencies where (task_id_one=:del_task_id or task_id_two=:del_task_id)"
im_exec_dml del_task "im_timesheet_task__delete(:del_task_id)"
}
......
......@@ -2,12 +2,32 @@ ad_page_contract {
} {
{ task_id:optional,multiple "" }
{ assign_to:optional,array "" }
project_id
return_url
}
#
# Using "/intranet-timesheet2-tasks/task-action"
# move task related things before it gets deleted
#
foreach old_id $task_id {
if {[info exists assign_to($old_id)]} {
set new_id $assign_to($old_id)
db_dml move_hours "UPDATE im_hours SET project_id=:new_id WHERE project_id=:old_id"
db_dml move_dependencies_one "UPDATE im_timesheet_task_dependencies SET task_id_one=:new_id WHERE task_id_one=:old_id"
db_dml move_dependencies_two "UPDATE im_timesheet_task_dependencies SET task_id_two=:new_id WHERE task_id_two=:old_id"
db_dml move_children "UPDATE im_projects SET parent_id=:new_id WHERE parent_id=:old_id"
db_dml move_resources "UPDATE acs_rels SET object_id_one=:new_id WHERE object_id_one=:old_id"
}
}
#
# Using "/intranet-timesheet2-tasks/task-action" to the deletion
#
# /task-action expects the task_id as an array
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment