Commit 749bf6af by Hiếu Lê

Auto delete subtask when change tracker from User Story to Support

parent 2ce4366e
...@@ -192,6 +192,9 @@ class IssuesController < ApplicationController ...@@ -192,6 +192,9 @@ class IssuesController < ApplicationController
if original_tracker_id != 12 if original_tracker_id != 12
auto_create_subtasks(@issue) auto_create_subtasks(@issue)
end end
if original_tracker_id == 12
auto_delete_subtasks(@issue)
end
else else
respond_to do |format| respond_to do |format|
...@@ -622,5 +625,14 @@ class IssuesController < ApplicationController ...@@ -622,5 +625,14 @@ class IssuesController < ApplicationController
subtask.save! subtask.save!
end end
end end
# Auto delete 8 subtasks (13/08/2018)
def auto_delete_subtasks(issue)
exclude_project_ids = [106, 107, 108, 109, 110, 111] #2zigexn
return if exclude_project_ids.include?(issue.project_id)
return if @issue.tracker_id != 3 #Support
#Remove subtasks when change from User Story to Support
Issue.where(tracker_id: 8, parent_id: @issue.id).delete_all
end
end end
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