summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-21 09:59:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-21 09:59:12 +0000
commit4abc3179f588f03aba2e5c9d7a5fb29570dc2614 (patch)
treef2a00628a0075f11a0a6015b7b27cfe355bc16ad /app/controllers
parent402d73914634e0e0a2ec06cc94e7b3ec13275546 (diff)
downloadredmine-4abc3179f588f03aba2e5c9d7a5fb29570dc2614.tar.gz
redmine-4abc3179f588f03aba2e5c9d7a5fb29570dc2614.zip
Filter parent task issues in auto complete by open/closed status depending on the subtask status (#24877).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@16243 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/auto_completes_controller.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb
index 3fe572ab6..ab46465ac 100644
--- a/app/controllers/auto_completes_controller.rb
+++ b/app/controllers/auto_completes_controller.rb
@@ -21,11 +21,20 @@ class AutoCompletesController < ApplicationController
def issues
@issues = []
q = (params[:q] || params[:term]).to_s.strip
+ status = params[:status].to_s
+ issue_id = params[:issue_id].to_s
if q.present?
scope = Issue.cross_project_scope(@project, params[:scope]).visible
+ if status.present?
+ scope = scope.open(status == 'o')
+ end
+ if issue_id.present?
+ scope = scope.where("#{Issue.table_name}.id <> ?", issue_id.to_i)
+ end
if q.match(/\A#?(\d+)\z/)
@issues << scope.find_by_id($1.to_i)
end
+
@issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order("#{Issue.table_name}.id DESC").limit(10).to_a
@issues.compact!
end