fixed #9308 table_name pre/suffix support

git-svn-id: http://redmine.rubyforge.org/svn/trunk@337 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-03-15 22:11:02 +00:00
parent 192b9008bd
commit e6f58e4dcc
16 changed files with 70 additions and 73 deletions

View File

@ -19,7 +19,7 @@ class FeedsController < ApplicationController
session :off
def news
@news = News.find :all, :order => 'news.created_on DESC', :limit => 10, :include => [ :author, :project ]
@news = News.find :all, :order => "#{News.table_name}.created_on DESC", :limit => 10, :include => [ :author, :project ]
headers["Content-Type"] = "application/rss+xml"
end
end

View File

@ -28,11 +28,11 @@ class IssuesController < ApplicationController
@status_options = @issue.status.workflows.find(:all, :order => 'position', :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user
@custom_values = @issue.custom_values.find(:all, :include => :custom_field)
@journals_count = @issue.journals.count
@journals = @issue.journals.find(:all, :include => [:user, :details], :limit => 15, :order => "journals.created_on desc")
@journals = @issue.journals.find(:all, :include => [:user, :details], :limit => 15, :order => "#{Journal.table_name}.created_on desc")
end
def history
@journals = @issue.journals.find(:all, :include => [:user, :details], :order => "journals.created_on desc")
@journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on desc")
@journals_count = @journals.length
end

View File

@ -84,9 +84,9 @@ class ProjectsController < ApplicationController
@custom_values = @project.custom_values.find(:all, :include => :custom_field)
@members = @project.members.find(:all, :include => [:user, :role])
@subprojects = @project.children if @project.children.size > 0
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
@trackers = Tracker.find(:all, :order => 'position')
@open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN issue_statuses ON issue_statuses.id = issues.status_id", :conditions => ["project_id=? and issue_statuses.is_closed=?", @project.id, false])
@open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN #{IssueStatus.table_name} ON #{IssueStatus.table_name}.id = #{Issue.table_name}.status_id", :conditions => ["project_id=? and #{IssueStatus.table_name}.is_closed=?", @project.id, false])
@total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id])
end
@ -236,7 +236,7 @@ class ProjectsController < ApplicationController
# Show filtered/sorted issues list of @project
def list_issues
sort_init 'issues.id', 'desc'
sort_init "#{Issue.table_name}.id", "desc"
sort_update
retrieve_query
@ -264,7 +264,7 @@ class ProjectsController < ApplicationController
# Export filtered/sorted issues list to CSV
def export_issues_csv
sort_init 'issues.id', 'desc'
sort_init "#{Issue.table_name}.id", "desc"
sort_update
retrieve_query
@ -319,7 +319,7 @@ class ProjectsController < ApplicationController
# Export filtered/sorted issues to PDF
def export_issues_pdf
sort_init 'issues.id', 'desc'
sort_init "#{Issue.table_name}.id", "desc"
sort_update
retrieve_query
@ -393,7 +393,7 @@ class ProjectsController < ApplicationController
# Show news list of @project
def list_news
@news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
@news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "#{News.table_name}.created_on DESC"
render :action => "list_news", :layout => false if request.xhr?
end
@ -428,8 +428,8 @@ class ProjectsController < ApplicationController
@selected_tracker_ids ||= []
@fixed_issues = @project.issues.find(:all,
:include => [ :fixed_version, :status, :tracker ],
:conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true],
:order => "versions.effective_date DESC, issues.id DESC"
:conditions => [ "#{IssueStatus.table_name}.is_closed=? and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}) and #{Issue.table_name}.fixed_version_id is not null", true],
:order => "#{Version.table_name}.effective_date DESC, #{Issue.table_name}.id DESC"
) unless @selected_tracker_ids.empty?
@fixed_issues ||= []
end
@ -443,8 +443,8 @@ class ProjectsController < ApplicationController
end
@selected_tracker_ids ||= []
@versions = @project.versions.find(:all,
:conditions => [ "versions.effective_date>?", Date.today],
:order => "versions.effective_date ASC"
:conditions => [ "#{Version.table_name}.effective_date>?", Date.today],
:order => "#{Version.table_name}.effective_date ASC"
)
end
@ -464,7 +464,7 @@ class ProjectsController < ApplicationController
@events_by_day = {}
unless params[:show_issues] == "0"
@project.issues.find(:all, :include => [:author, :status], :conditions => ["issues.created_on>=? and issues.created_on<=?", @date_from, @date_to] ).each { |i|
@project.issues.find(:all, :include => [:author, :status], :conditions => ["#{Issue.table_name}.created_on>=? and #{Issue.table_name}.created_on<=?", @date_from, @date_to] ).each { |i|
@events_by_day[i.created_on.to_date] ||= []
@events_by_day[i.created_on.to_date] << i
}
@ -472,7 +472,7 @@ class ProjectsController < ApplicationController
end
unless params[:show_news] == "0"
@project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to], :include => :author ).each { |i|
@project.news.find(:all, :conditions => ["#{News.table_name}.created_on>=? and #{News.table_name}.created_on<=?", @date_from, @date_to], :include => :author ).each { |i|
@events_by_day[i.created_on.to_date] ||= []
@events_by_day[i.created_on.to_date] << i
}
@ -480,7 +480,7 @@ class ProjectsController < ApplicationController
end
unless params[:show_files] == "0"
Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
Attachment.find(:all, :select => "#{Attachment.table_name}.*", :joins => "LEFT JOIN #{Version.table_name} ON #{Version.table_name}.id = #{Attachment.table_name}.container_id", :conditions => ["#{Attachment.table_name}.container_type='Version' and #{Version.table_name}.project_id=? and #{Attachment.table_name}.created_on>=? and #{Attachment.table_name}.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
@events_by_day[i.created_on.to_date] ||= []
@events_by_day[i.created_on.to_date] << i
}
@ -488,11 +488,11 @@ class ProjectsController < ApplicationController
end
unless params[:show_documents] == "0"
@project.documents.find(:all, :conditions => ["documents.created_on>=? and documents.created_on<=?", @date_from, @date_to] ).each { |i|
@project.documents.find(:all, :conditions => ["#{Document.table_name}.created_on>=? and #{Document.table_name}.created_on<=?", @date_from, @date_to] ).each { |i|
@events_by_day[i.created_on.to_date] ||= []
@events_by_day[i.created_on.to_date] << i
}
Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN #{Document.table_name} ON #{Document.table_name}.id = #{Attachment.table_name}.container_id", :conditions => ["#{Attachment.table_name}.container_type='Document' and #{Document.table_name}.project_id=? and #{Attachment.table_name}.created_on>=? and #{Attachment.table_name}.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
@events_by_day[i.created_on.to_date] ||= []
@events_by_day[i.created_on.to_date] << i
}
@ -567,10 +567,10 @@ class ProjectsController < ApplicationController
operator = @all_words ? " AND " : " OR "
limit = 10
@results = []
@results += @project.issues.find(:all, :limit => limit, :include => :author, :conditions => [ (["(LOWER(issues.subject) like ? OR LOWER(issues.description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'issues'
@results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(news.title) like ? OR LOWER(news.description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news'
@results += @project.issues.find(:all, :limit => limit, :include => :author, :conditions => [ (["(LOWER(subject) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'issues'
@results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news'
@results += @project.documents.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'documents'
@results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(wiki_pages.title) like ? OR LOWER(wiki_contents.text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki')
@results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(title) like ? OR LOWER(text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki')
@question = @tokens.join(" ")
end
end

View File

@ -112,7 +112,7 @@ private
t.id as tracker_id,
count(i.id) as total
from
issues i, issue_statuses s, trackers t
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{Tracker.table_name} t
where
i.status_id=s.id
and i.tracker_id=t.id
@ -127,7 +127,7 @@ private
p.id as priority_id,
count(i.id) as total
from
issues i, issue_statuses s, enumerations p
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{Enumeration.table_name} p
where
i.status_id=s.id
and i.priority_id=p.id
@ -142,7 +142,7 @@ private
c.id as category_id,
count(i.id) as total
from
issues i, issue_statuses s, issue_categories c
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{IssueCategory.table_name} c
where
i.status_id=s.id
and i.category_id=c.id
@ -157,7 +157,7 @@ private
a.id as author_id,
count(i.id) as total
from
issues i, issue_statuses s, users a
#{Issue.table_name} i, #{IssueStatus.table_name} s, #{User.table_name} a
where
i.status_id=s.id
and i.author_id=a.id

View File

@ -79,8 +79,8 @@ class WikiController < ApplicationController
# show pages index, sorted by title
when 'page_index'
# eager load information about last updates, without loading text
@pages = @wiki.pages.find :all, :select => "wiki_pages.*, wiki_contents.updated_on",
:joins => "LEFT JOIN wiki_contents ON wiki_contents.page_id = wiki_pages.id",
@pages = @wiki.pages.find :all, :select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on",
:joins => "LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id",
:order => 'title'
# export wiki to a single html file
when 'export'

View File

@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueCustomField < CustomField
has_and_belongs_to_many :projects, :join_table => "custom_fields_projects", :foreign_key => "custom_field_id"
has_and_belongs_to_many :trackers, :join_table => "custom_fields_trackers", :foreign_key => "custom_field_id"
has_and_belongs_to_many :projects, :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :foreign_key => "custom_field_id"
has_and_belongs_to_many :trackers, :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :foreign_key => "custom_field_id"
has_many :issues, :through => :issue_custom_values
def type_name

View File

@ -24,6 +24,6 @@ class News < ActiveRecord::Base
# returns latest news for projects visible by user
def self.latest(user=nil, count=5)
find(:all, :limit => count, :conditions => Project.visible_by(user), :include => [ :author, :project ], :order => "news.created_on DESC")
find(:all, :limit => count, :conditions => Project.visible_by(user), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
end
end

View File

@ -16,18 +16,18 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Project < ActiveRecord::Base
has_many :versions, :dependent => :destroy, :order => "versions.effective_date DESC, versions.name DESC"
has_many :members, :dependent => :delete_all, :include => :user, :conditions => "users.status=#{User::STATUS_ACTIVE}"
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
has_many :members, :dependent => :delete_all, :include => :user, :conditions => "#{User.table_name}.status=#{User::STATUS_ACTIVE}"
has_many :users, :through => :members
has_many :custom_values, :dependent => :delete_all, :as => :customized
has_many :issues, :dependent => :destroy, :order => "issues.created_on DESC", :include => [:status, :tracker]
has_many :issues, :dependent => :destroy, :order => "#{Issue.table_name}.created_on DESC", :include => [:status, :tracker]
has_many :queries, :dependent => :delete_all
has_many :documents, :dependent => :destroy
has_many :news, :dependent => :delete_all, :include => :author
has_many :issue_categories, :dependent => :delete_all, :order => "issue_categories.name"
has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name"
has_one :repository, :dependent => :destroy
has_one :wiki, :dependent => :destroy
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_projects', :association_foreign_key => 'custom_field_id'
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_tree :order => "name", :counter_cache => true
validates_presence_of :name, :description
@ -39,28 +39,25 @@ class Project < ActiveRecord::Base
# returns latest created projects
# non public projects will be returned only if user is a member of those
def self.latest(user=nil, count=5)
find(:all, :limit => count, :conditions => visible_by(user), :order => "projects.created_on DESC")
find(:all, :limit => count, :conditions => visible_by(user), :order => "created_on DESC")
end
def self.visible_by(user=nil)
if user && !user.memberships.empty?
return ["projects.is_public = ? or projects.id IN (#{user.memberships.collect{|m| m.project_id}.join(',')})", true]
return ["#{Project.table_name}.is_public = ? or #{Project.table_name}.id IN (#{user.memberships.collect{|m| m.project_id}.join(',')})", true]
else
return ["projects.is_public = ?", true]
return ["#{Project.table_name}.is_public = ?", true]
end
end
# Returns an array of all custom fields enabled for project issues
# (explictly associated custom fields and custom fields enabled for all projects)
def custom_fields_for_issues(tracker)
tracker.custom_fields.find(:all, :include => :projects,
:conditions => ["is_for_all=? or project_id=?", true, self.id])
#(CustomField.for_all + custom_fields).uniq
all_custom_fields.select {|c| tracker.custom_fields.include? c }
end
def all_custom_fields
@all_custom_fields ||= IssueCustomField.find(:all, :include => :projects,
:conditions => ["is_for_all=? or project_id=?", true, self.id])
@all_custom_fields ||= (IssueCustomField.for_all + custom_fields).uniq
end
protected

View File

@ -124,42 +124,42 @@ class Query < ActiveRecord::Base
def statement
sql = "1=1"
sql << " AND issues.project_id=%d" % project.id if project
sql << " AND #{Issue.table_name}.project_id=%d" % project.id if project
filters.each_key do |field|
v = values_for field
next unless v and !v.empty?
sql = sql + " AND " unless sql.empty?
case operator_for field
when "="
sql = sql + "issues.#{field} IN (" + v.each(&:to_i).join(",") + ")"
sql = sql + "#{Issue.table_name}.#{field} IN (" + v.each(&:to_i).join(",") + ")"
when "!"
sql = sql + "issues.#{field} NOT IN (" + v.each(&:to_i).join(",") + ")"
sql = sql + "#{Issue.table_name}.#{field} NOT IN (" + v.each(&:to_i).join(",") + ")"
when "!*"
sql = sql + "issues.#{field} IS NULL"
sql = sql + "#{Issue.table_name}.#{field} IS NULL"
when "*"
sql = sql + "issues.#{field} IS NOT NULL"
sql = sql + "#{Issue.table_name}.#{field} IS NOT NULL"
when "o"
sql = sql + "issue_statuses.is_closed=#{connection.quoted_false}" if field == "status_id"
sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
when "c"
sql = sql + "issue_statuses.is_closed=#{connection.quoted_true}" if field == "status_id"
sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_true}" if field == "status_id"
when ">t-"
sql = sql + "issues.#{field} >= '%s'" % connection.quoted_date(Date.today - v.first.to_i)
sql = sql + "#{Issue.table_name}.#{field} >= '%s'" % connection.quoted_date(Date.today - v.first.to_i)
when "<t-"
sql = sql + "issues.#{field} <= '" + (Date.today - v.first.to_i).strftime("%Y-%m-%d") + "'"
sql = sql + "#{Issue.table_name}.#{field} <= '" + (Date.today - v.first.to_i).strftime("%Y-%m-%d") + "'"
when "t-"
sql = sql + "issues.#{field} = '" + (Date.today - v.first.to_i).strftime("%Y-%m-%d") + "'"
sql = sql + "#{Issue.table_name}.#{field} = '" + (Date.today - v.first.to_i).strftime("%Y-%m-%d") + "'"
when ">t+"
sql = sql + "issues.#{field} >= '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'"
sql = sql + "#{Issue.table_name}.#{field} >= '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'"
when "<t+"
sql = sql + "issues.#{field} <= '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'"
sql = sql + "#{Issue.table_name}.#{field} <= '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'"
when "t+"
sql = sql + "issues.#{field} = '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'"
sql = sql + "#{Issue.table_name}.#{field} = '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'"
when "t"
sql = sql + "issues.#{field} = '%s'" % connection.quoted_date(Date.today)
sql = sql + "#{Issue.table_name}.#{field} = '%s'" % connection.quoted_date(Date.today)
when "~"
sql = sql + "issues.#{field} LIKE '%#{connection.quote_string(v.first)}%'"
sql = sql + "#{Issue.table_name}.#{field} LIKE '%#{connection.quote_string(v.first)}%'"
when "!~"
sql = sql + "issues.#{field} NOT LIKE '%#{connection.quote_string(v.first)}%'"
sql = sql + "#{Issue.table_name}.#{field} NOT LIKE '%#{connection.quote_string(v.first)}%'"
end
end if filters and valid?
sql

View File

@ -19,7 +19,7 @@ class Tracker < ActiveRecord::Base
before_destroy :check_integrity
has_many :issues
has_many :workflows, :dependent => :delete_all
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id'
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_list
validates_presence_of :name

View File

@ -4,7 +4,7 @@
@date_from = Date.today - (Date.today.cwday-1)
@date_to = Date.today + (7-Date.today.cwday)
@issues = Issue.find :all,
:conditions => ["issues.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to],
:conditions => ["#{Issue.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to],
:include => [:project, :tracker] unless @user.projects.empty?
@issues ||= []
%>

View File

@ -3,6 +3,6 @@
<%= render(:partial => 'documents/document',
:collection => Document.find(:all,
:limit => 10,
:order => 'documents.created_on DESC',
:conditions => "documents.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
:order => "#{Document.table_name}.created_on DESC",
:conditions => "#{Document.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
:include => [:project])) unless @user.projects.empty? %>

View File

@ -3,7 +3,7 @@
:conditions => ["assigned_to_id=?", user.id],
:limit => 10,
:include => [ :status, :project, :tracker ],
:order => 'issues.updated_on DESC') %>
:order => "#{Issue.table_name}.updated_on DESC") %>
<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>
<% if assigned_issues.length > 0 %>
<p><%=lwr(:label_last_updates, assigned_issues.length)%></p>

View File

@ -3,7 +3,7 @@
:conditions => ["author_id=?", user.id],
:limit => 10,
:include => [ :status, :project, :tracker ],
:order => 'issues.updated_on DESC') %>
:order => "#{Issue.table_name}.updated_on DESC") %>
<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %>
<% if reported_issues.length > 0 %>
<p><%=lwr(:label_last_updates, reported_issues.length)%></p>

View File

@ -3,6 +3,6 @@
<%= render (:partial => 'news/news',
:collection => News.find(:all,
:limit => 10,
:order => 'news.created_on DESC',
:conditions => "news.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
:order => "#{News.table_name}.created_on DESC",
:conditions => "#{News.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
:include => [:project, :author])) unless @user.projects.empty? %>

View File

@ -46,13 +46,13 @@
<table class="list">
<thead><tr>
<th></th>
<%= sort_header_tag('issues.id', :caption => '#') %>
<%= sort_header_tag('issues.tracker_id', :caption => l(:field_tracker)) %>
<%= sort_header_tag('issue_statuses.name', :caption => l(:field_status)) %>
<%= sort_header_tag('issues.priority_id', :caption => l(:field_priority)) %>
<%= sort_header_tag("#{Issue.table_name}.id", :caption => '#') %>
<%= sort_header_tag("#{Issue.table_name}.tracker_id", :caption => l(:field_tracker)) %>
<%= sort_header_tag("#{IssueStatus.table_name}.name", :caption => l(:field_status)) %>
<%= sort_header_tag("#{Issue.table_name}.priority_id", :caption => l(:field_priority)) %>
<th><%=l(:field_subject)%></th>
<%= sort_header_tag('users.lastname', :caption => l(:field_author)) %>
<%= sort_header_tag('issues.updated_on', :caption => l(:field_updated_on)) %>
<%= sort_header_tag("#{User.table_name}.lastname", :caption => l(:field_author)) %>
<%= sort_header_tag("#{Issue.table_name}.updated_on", :caption => l(:field_updated_on)) %>
</tr></thead>
<tbody>
<% for issue in @issues %>