Merged r11762 and r11763 from trunk (#13783).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@11835 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2013-05-12 09:43:59 +00:00
1 parent 958f1accec
commit 2a6dadf787
5 files changed
+39 -5

No files matched your search

+1
View File
@@ -38,6 +38,7 @@ class Enumeration < ActiveRecord::Base
scope :shared, lambda { where(:project_id => nil) }
scope :sorted, lambda { order("#{table_name}.position ASC") }
scope :active, lambda { where(:active => true) }
scope :system, lambda { where(:project_id => nil) }
scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
def self.default
+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