Adds named scopes for time entries index.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8084 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -45,7 +45,18 @@ class TimeEntry < ActiveRecord::Base
|
||||
:include => :project,
|
||||
:conditions => Project.allowed_to_condition(args.shift || User.current, :view_time_entries, *args)
|
||||
}}
|
||||
|
||||
named_scope :on_issue, lambda {|issue| {
|
||||
:include => :issue,
|
||||
:conditions => "#{Issue.table_name}.root_id = #{issue.root_id} AND #{Issue.table_name}.lft >= #{issue.lft} AND #{Issue.table_name}.rgt <= #{issue.rgt}"
|
||||
}}
|
||||
named_scope :on_project, lambda {|project, include_subprojects| {
|
||||
:include => :project,
|
||||
:conditions => project.project_condition(include_subprojects)
|
||||
}}
|
||||
named_scope :spent_between, lambda {|from, to| {
|
||||
:conditions => ["#{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", from, to]
|
||||
}}
|
||||
|
||||
def after_initialize
|
||||
if new_record? && self.activity.nil?
|
||||
if default_activity = TimeEntryActivity.default
|
||||
|
||||
Reference in New Issue
Block a user