add_available_filter "issue_id", :type => :integer, :label => :label_issue
+ add_available_filter "any_searchable", :type => :search
+
Tracker.disabled_core_fields(trackers).each do |field|
delete_available_filter field
end
sql_for_field(field, operator, value, Project.table_name, "status")
end
+ def sql_for_any_searchable_field(field, operator, value)
+ question = value.first
+
+ # Fetch search results only from the selected and visible (sub-)projects
+ project_scope = Project.allowed_to(:view_issues)
+ if project
+ projects = project_scope.where(project_statement)
+ elsif has_filter?('project_id')
+ projects = project_scope.where(
+ sql_for_field('project_id', operator_for('project_id'), values_for('project_id'), Project.table_name, 'id')
+ )
+ else
+ projects = nil
+ end
+
+ fetcher = Redmine::Search::Fetcher.new(
+ question, User.current, ['issue'], projects, attachments: '0'
+ )
+ ids = fetcher.result_ids.map(&:last)
+ if ids.present?
+ sw = operator == '!~' ? 'NOT' : ''
+ "#{Issue.table_name}.id #{sw} IN (#{ids.join(',')})"
+ else
+ '1=0'
+ end
+ end
+
def find_assigned_to_id_filter_values(values)
Principal.visible.where(:id => values).map {|p| [p.name, p.id.to_s]}
end
:date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "><t-", "t-", "t", "ld", "w", "lw", "l2w", "m", "lm", "y", "!*", "*" ],
:string => [ "~", "=", "!~", "!", "^", "$", "!*", "*" ],
:text => [ "~", "!~", "^", "$", "!*", "*" ],
+ :search => [ "~", "!~" ],
:integer => [ "=", ">=", "<=", "><", "!*", "*" ],
:float => [ "=", ">=", "<=", "><", "!*", "*" ],
:relation => ["=", "!", "=p", "=!p", "!p", "*o", "!o", "!*", "*"],
field_default_issue_query: Default issue query
field_default_project_query: Default project query
field_default_time_entry_activity: Default spent time activity
+ field_any_searchable: Any searchable text
setting_app_title: Application title
setting_welcome_text: Welcome text
break;
case "string":
case "text":
+ case "search":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="30" class="value" /></span>'
);
assert_equal [1, 3], find_issues_with_query(query).map(&:id).sort
end
+ def test_fileter_any_searchable
+ User.current = User.find(1)
+ query = IssueQuery.new(
+ :name => '_',
+ :filters => {
+ 'any_searchable' => {
+ :operator => '~',
+ :values => ['recipe']
+ }
+ }
+ )
+ result = find_issues_with_query(query)
+ assert_equal [1, 2, 3], result.map(&:id).sort
+ end
+
+ def test_fileter_any_searchable_should_search_searchable_custom_fields
+ User.current = User.find(1)
+ query = IssueQuery.new(
+ :name => '_',
+ :filters => {
+ 'any_searchable' => {
+ :operator => '~',
+ :values => ['125']
+ }
+ }
+ )
+ result = find_issues_with_query(query)
+ assert_equal [1, 3], result.map(&:id).sort
+ end
+
def test_filter_updated_by
user = User.generate!
Journal.create!(:user_id => user.id, :journalized => Issue.find(2), :notes => 'Notes')