Compatibility: Set cost_object to nil on issue move if the current cost object would be invalid in the new issue location

git-svn-id: https://dev.finn.de/svn/cockpit/trunk@536 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
hjust 15 years ago
parent 326b3fdd1e
commit 8fb245dd6a
  1. 7
      lib/costs_issue_observer.rb

@ -6,5 +6,12 @@ class CostsIssueObserver < ActiveRecord::Observer
CostEntry.update_all({:project_id => issue.project_id}, {:issue_id => id}) CostEntry.update_all({:project_id => issue.project_id}, {:issue_id => id})
end end
end end
def before_update(issue)
# FIXME: remove this method once controller_issues_move_before_save is in 0.9-stable
if issue.project_id_changed? && issue.cost_object_id && !issue.project.cost_object_ids.include?(issue.cost_object_id)
issue.cost_object = nil
end
end
end end
Loading…
Cancel
Save