Fixed that deleting a system activity with children in use raises an error (#13783).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11763 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-05-01 17:10:15 +00:00
parent 6c39a260a3
commit c5ac2d3966
3 changed files with 37 additions and 4 deletions
+6 -2
View File
@@ -24,11 +24,15 @@ class TimeEntryActivity < Enumeration
OptionName
end
def objects
TimeEntry.where(:activity_id => self_and_descendants(1).map(&:id))
end
def objects_count
time_entries.count
objects.count
end
def transfer_relations(to)
time_entries.update_all("activity_id = #{to.id}")
objects.update_all(:activity_id => to.id)
end
end