OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/lib/costs_issue_observer.rb

17 lines
516 B

class CostsIssueObserver < ActiveRecord::Observer
observe :issue
def after_update(issue)
if issue.project_id_changed?
CostEntry.update_all({:project_id => issue.project_id}, {:issue_id => id})
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