From e6f58e4dcc2f7552109da139857a19b81c6f1fe1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 15 Mar 2007 22:11:02 +0000 Subject: [PATCH] fixed #9308 table_name pre/suffix support git-svn-id: http://redmine.rubyforge.org/svn/trunk@337 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/feeds_controller.rb | 2 +- app/controllers/issues_controller.rb | 4 +-- app/controllers/projects_controller.rb | 36 +++++++++++++-------------- app/controllers/reports_controller.rb | 8 +++--- app/controllers/wiki_controller.rb | 4 +-- app/models/issue_custom_field.rb | 4 +-- app/models/news.rb | 2 +- app/models/project.rb | 23 ++++++++--------- app/models/query.rb | 32 ++++++++++++------------ app/models/tracker.rb | 2 +- app/views/my/blocks/_calendar.rhtml | 2 +- app/views/my/blocks/_documents.rhtml | 4 +-- app/views/my/blocks/_issuesassignedtome.rhtml | 2 +- app/views/my/blocks/_issuesreportedbyme.rhtml | 2 +- app/views/my/blocks/_news.rhtml | 4 +-- app/views/projects/list_issues.rhtml | 12 ++++----- 16 files changed, 70 insertions(+), 73 deletions(-) diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb index d984c225..7a454d80 100644 --- a/app/controllers/feeds_controller.rb +++ b/app/controllers/feeds_controller.rb @@ -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 diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 8c78692d..c67f711f 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 70a07c85..fe483681 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 37c6cf12..fa00f7c3 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -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 diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 88c5b4e4..f8466902 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -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' diff --git a/app/models/issue_custom_field.rb b/app/models/issue_custom_field.rb index 7759c905..d087768a 100644 --- a/app/models/issue_custom_field.rb +++ b/app/models/issue_custom_field.rb @@ -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 diff --git a/app/models/news.rb b/app/models/news.rb index 84851730..cd130e96 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index 3cf5a816..3579921b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/models/query.rb b/app/models/query.rb index b6c9b680..fbf48927 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -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 " :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 diff --git a/app/views/my/blocks/_calendar.rhtml b/app/views/my/blocks/_calendar.rhtml index 4c583e49..fe0b1f86 100644 --- a/app/views/my/blocks/_calendar.rhtml +++ b/app/views/my/blocks/_calendar.rhtml @@ -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 ||= [] %> diff --git a/app/views/my/blocks/_documents.rhtml b/app/views/my/blocks/_documents.rhtml index a1bb0b36..a34be936 100644 --- a/app/views/my/blocks/_documents.rhtml +++ b/app/views/my/blocks/_documents.rhtml @@ -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? %> \ No newline at end of file diff --git a/app/views/my/blocks/_issuesassignedtome.rhtml b/app/views/my/blocks/_issuesassignedtome.rhtml index e52e0fad..35760a5a 100644 --- a/app/views/my/blocks/_issuesassignedtome.rhtml +++ b/app/views/my/blocks/_issuesassignedtome.rhtml @@ -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 %>

<%=lwr(:label_last_updates, assigned_issues.length)%>

diff --git a/app/views/my/blocks/_issuesreportedbyme.rhtml b/app/views/my/blocks/_issuesreportedbyme.rhtml index 4e173d3c..3c6eb4a3 100644 --- a/app/views/my/blocks/_issuesreportedbyme.rhtml +++ b/app/views/my/blocks/_issuesreportedbyme.rhtml @@ -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 %>

<%=lwr(:label_last_updates, reported_issues.length)%>

diff --git a/app/views/my/blocks/_news.rhtml b/app/views/my/blocks/_news.rhtml index 30085cf4..4c7e2729 100644 --- a/app/views/my/blocks/_news.rhtml +++ b/app/views/my/blocks/_news.rhtml @@ -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? %> \ No newline at end of file diff --git a/app/views/projects/list_issues.rhtml b/app/views/projects/list_issues.rhtml index 6f6e031f..7de1b144 100644 --- a/app/views/projects/list_issues.rhtml +++ b/app/views/projects/list_issues.rhtml @@ -46,13 +46,13 @@ - <%= 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)) %> - <%= 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)) %> <% for issue in @issues %> -- 2.11.0
<%=l(:field_subject)%>