@@ -1,5 +1,7 | |||||
1 | <h2><%= l(:label_home) %></h2> |
|
1 | <h2><%= l(:label_home) %></h2> | |
2 |
|
2 | |||
|
3 | <%= "Ö".downcase %> | |||
|
4 | ||||
3 | <div class="splitcontentleft"> |
|
5 | <div class="splitcontentleft"> | |
4 | <%= textilizable Setting.welcome_text %> |
|
6 | <%= textilizable Setting.welcome_text %> | |
5 | <% if @news.any? %> |
|
7 | <% if @news.any? %> |
@@ -86,7 +86,7 module Redmine | |||||
86 | columns = searchable_options[:columns] |
|
86 | columns = searchable_options[:columns] | |
87 | columns = columns[0..0] if options[:titles_only] |
|
87 | columns = columns[0..0] if options[:titles_only] | |
88 |
|
88 | |||
89 | token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE ?)"} |
|
89 | token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE LOWER(?))"} | |
90 |
|
90 | |||
91 | if !options[:titles_only] && searchable_options[:search_custom_fields] |
|
91 | if !options[:titles_only] && searchable_options[:search_custom_fields] | |
92 | searchable_custom_fields = CustomField.where(:type => "#{self.name}CustomField", :searchable => true) |
|
92 | searchable_custom_fields = CustomField.where(:type => "#{self.name}CustomField", :searchable => true) | |
@@ -97,7 +97,7 module Redmine | |||||
97 | fields_by_visibility.each do |visibility, fields| |
|
97 | fields_by_visibility.each do |visibility, fields| | |
98 | ids = fields.map(&:id).join(',') |
|
98 | ids = fields.map(&:id).join(',') | |
99 | sql = "#{table_name}.id IN (SELECT cfs.customized_id FROM #{CustomValue.table_name} cfs" + |
|
99 | sql = "#{table_name}.id IN (SELECT cfs.customized_id FROM #{CustomValue.table_name} cfs" + | |
100 | " WHERE cfs.customized_type='#{self.name}' AND cfs.customized_id=#{table_name}.id AND LOWER(cfs.value) LIKE ?" + |
|
100 | " WHERE cfs.customized_type='#{self.name}' AND cfs.customized_id=#{table_name}.id AND LOWER(cfs.value) LIKE LOWER(?)" + | |
101 | " AND cfs.custom_field_id IN (#{ids})" + |
|
101 | " AND cfs.custom_field_id IN (#{ids})" + | |
102 | " AND #{visibility})" |
|
102 | " AND #{visibility})" | |
103 | token_clauses << sql |
|
103 | token_clauses << sql | |
@@ -106,7 +106,7 module Redmine | |||||
106 |
|
106 | |||
107 | sql = (['(' + token_clauses.join(' OR ') + ')'] * tokens.size).join(options[:all_words] ? ' AND ' : ' OR ') |
|
107 | sql = (['(' + token_clauses.join(' OR ') + ')'] * tokens.size).join(options[:all_words] ? ' AND ' : ' OR ') | |
108 |
|
108 | |||
109 |
tokens_conditions = [sql, * (tokens.collect {|w| "%#{w |
|
109 | tokens_conditions = [sql, * (tokens.collect {|w| "%#{w}%"} * token_clauses.size).sort] | |
110 |
|
110 | |||
111 | scope = (searchable_options[:scope] || self) |
|
111 | scope = (searchable_options[:scope] || self) | |
112 | if scope.is_a? Proc |
|
112 | if scope.is_a? Proc |
@@ -1,3 +1,5 | |||||
|
1 | # encoding: utf-8 | |||
|
2 | # | |||
1 | # Redmine - project management software |
|
3 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2014 Jean-Philippe Lang |
|
4 | # Copyright (C) 2006-2014 Jean-Philippe Lang | |
3 | # |
|
5 | # | |
@@ -137,6 +139,13 class SearchTest < ActiveSupport::TestCase | |||||
137 | assert_equal issue, r.first |
|
139 | assert_equal issue, r.first | |
138 | end |
|
140 | end | |
139 |
|
141 | |||
|
142 | def test_search_should_not_use_ruby_downcase | |||
|
143 | issue = Issue.generate!(:subject => "Special chars: ÖÖ") | |||
|
144 | r = Issue.search_results('%ÖÖ%') | |||
|
145 | assert_equal 1, r.size | |||
|
146 | assert_equal issue, r.first | |||
|
147 | end | |||
|
148 | ||||
140 | private |
|
149 | private | |
141 |
|
150 | |||
142 | def remove_permission(role, permission) |
|
151 | def remove_permission(role, permission) |
General Comments 0
You need to be logged in to leave comments.
Login now