summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-27 09:12:42 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-27 09:12:42 +0000
commitba37a2c47686770048f66a1af6f4294f4168089b (patch)
treeea366efdfc9ef074e096f7b900b34d61121bc8d5 /app
parent335a16e4fd28ce464fb45e79fac456b5d6bf88fa (diff)
downloadredmine-ba37a2c47686770048f66a1af6f4294f4168089b.tar.gz
redmine-ba37a2c47686770048f66a1af6f4294f4168089b.zip
Show statuses of project trackers only (#5385).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@16575 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/issue_query.rb2
-rw-r--r--app/models/project.rb12
-rw-r--r--app/models/query.rb10
3 files changed, 23 insertions, 1 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index 6d1298c1f..ae5597134 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -82,7 +82,7 @@ class IssueQuery < Query
def initialize_available_filters
add_available_filter "status_id",
- :type => :list_status, :values => lambda { IssueStatus.sorted.collect{|s| [s.name, s.id.to_s] } }
+ :type => :list_status, :values => lambda { issue_statuses }
add_available_filter("project_id",
:type => :list, :values => lambda { project_values }
diff --git a/app/models/project.rb b/app/models/project.rb
index 420306889..37a610980 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -324,6 +324,7 @@ class Project < ActiveRecord::Base
@shared_versions = nil
@rolled_up_versions = nil
@rolled_up_trackers = nil
+ @rolled_up_statuses = nil
@rolled_up_custom_fields = nil
@all_issue_custom_fields = nil
@all_time_entry_custom_fields = nil
@@ -452,6 +453,17 @@ class Project < ActiveRecord::Base
sorted
end
+ def rolled_up_statuses
+ issue_status_ids = WorkflowTransition.
+ where(:tracker_id => trackers).
+ distinct.
+ pluck(:old_status_id, :new_status_id).
+ flatten.
+ uniq
+
+ IssueStatus.where(:id => issue_status_ids).sorted
+ end
+
# Closes open and locked project versions that are completed
def close_completed_versions
Version.transaction do
diff --git a/app/models/query.rb b/app/models/query.rb
index 863bdbc4a..7d6b37f36 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -551,6 +551,16 @@ class Query < ActiveRecord::Base
Version.sort_by_status(versions).collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s, l("version_status_#{s.status}")] }
end
+ # Returns a scope of issue statuses that are available as columns for filters
+ def issue_statuses
+ if project
+ statuses = project.rolled_up_statuses
+ else
+ statuses = IssueStatus.all.sorted
+ end
+ statuses.collect{|s| [s.name, s.id.to_s]}
+ end
+
# Returns a scope of issue custom fields that are available as columns or filters
def issue_custom_fields
if project