|
|
|
@ -106,11 +106,7 @@ private |
|
|
|
|
def get_entries(limit) |
|
|
|
|
cost_statement = @query.statement(:cost_entries) |
|
|
|
|
time_statement = @query.statement(:time_entries) |
|
|
|
|
|
|
|
|
|
@entry_count = CostEntry.count(:conditions => cost_statement) + |
|
|
|
|
TimeEntry.count(:conditions => time_statement) |
|
|
|
|
@entry_pages = Paginator.new self, @entry_count, limit, params['page'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# at first get the entry ids to match the current query |
|
|
|
|
unless sort_clause.nil? |
|
|
|
|
(sort_column, sort_order) = sort_clause.split(" ") |
|
|
|
@ -134,7 +130,34 @@ private |
|
|
|
|
time_sort_column_sql += "," |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if @query.display_time_entries && !@query.display_cost_entries |
|
|
|
|
@entry_count = TimeEntry.count(cost_statement) |
|
|
|
|
@entry_pages = Paginator.new self, @entry_count, limit, params['page'] |
|
|
|
|
|
|
|
|
|
@entries = TimeEntry.find :all, {:order => (sort_clause if time_sort_column), |
|
|
|
|
:include => [:issue, :activity, :user], |
|
|
|
|
:conditions => cost_statement, |
|
|
|
|
:limit => limit, |
|
|
|
|
:offset => @entry_pages.current.offset} |
|
|
|
|
|
|
|
|
|
return |
|
|
|
|
elsif @query.display_cost_entries && !@query.display_time_entries |
|
|
|
|
@entry_count = CostEntry.count(cost_statement) |
|
|
|
|
@entry_pages = Paginator.new self, @entry_count, limit, params['page'] |
|
|
|
|
|
|
|
|
|
@entries = CostEntry.find :all, {:order => (sort_clause if cost_sort_column), |
|
|
|
|
:include => [:issue, :cost_type, :user], |
|
|
|
|
:conditions => cost_statement, |
|
|
|
|
:limit => limit, |
|
|
|
|
:offset => @entry_pages.current.offset} |
|
|
|
|
return |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
@entry_count = CostEntry.count(:conditions => cost_statement) + |
|
|
|
|
TimeEntry.count(:conditions => time_statement) |
|
|
|
|
@entry_pages = Paginator.new self, @entry_count, limit, params['page'] |
|
|
|
|
|
|
|
|
|
# TAKE extra care for SQL injection here!!! |
|
|
|
|
sql = " SELECT id, #{cost_sort_column_sql} 'cost_entry' AS entry_type" |
|
|
|
@ -169,7 +192,7 @@ private |
|
|
|
|
:conditions => {:id => cost_entry_ids}} |
|
|
|
|
|
|
|
|
|
time_entries = TimeEntry.find :all, {:order => (sort_clause if time_sort_column), |
|
|
|
|
:include => [:issue, :user], |
|
|
|
|
:include => [:issue, :activity, :user], |
|
|
|
|
:conditions => {:id => time_entry_ids}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|