summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-04-16 05:46:52 +0000
committerGo MAEDA <maeda@farend.jp>2023-04-16 05:46:52 +0000
commit1f5c8742e3dfcc3546f10f032c3b61a2f6b6d7a6 (patch)
treeb0c0b96bf34222f6c6c007f8dc622d2ea7c8775e /app/models
parentea1c8ea319184e2d610e4cfd936849e8e6e81eda (diff)
downloadredmine-1f5c8742e3dfcc3546f10f032c3b61a2f6b6d7a6.tar.gz
redmine-1f5c8742e3dfcc3546f10f032c3b61a2f6b6d7a6.zip
Fix "contains any of" operator is not taken into account in File and File description filters (#38435).
git-svn-id: https://svn.redmine.org/redmine/trunk@22195 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/issue_query.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index cd363b5c8..2aa60fcea 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -614,13 +614,13 @@ class IssueQuery < Query
when "*", "!*"
e = (operator == "*" ? "EXISTS" : "NOT EXISTS")
"#{e} (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id)"
- when "~", "!~"
- c = sql_contains("a.filename", value.first)
- e = (operator == "~" ? "EXISTS" : "NOT EXISTS")
- "#{e} (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND #{c})"
+ when "~", "!~", "|~"
+ c = sql_contains("a.filename", value.first, :all_words => (operator != "|~"))
+ e = (operator == "!~" ? "NOT EXISTS" : "EXISTS")
+ "#{e} (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND (#{c}))"
when "^", "$"
c = sql_contains("a.filename", value.first, (operator == "^" ? :starts_with : :ends_with) => true)
- "EXISTS (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND #{c})"
+ "EXISTS (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND (#{c}))"
end
end
@@ -630,15 +630,15 @@ class IssueQuery < Query
case operator
when '*', '!*'
(operator == '*' ? cond_description : "NOT (#{cond_description})")
- when '~', '!~'
+ when '~', '!~', '|~'
(operator == '~' ? '' : "#{cond_description} AND ") +
- sql_contains('a.description', value.first, :match => (operator == '~'))
+ sql_contains('a.description', value.first, :match => (operator != '!~'), :all_words => (operator != '|~'))
when '^', '$'
sql_contains('a.description', value.first, (operator == '^' ? :starts_with : :ends_with) => true)
else
'1=0'
end
- "EXISTS (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND #{c})"
+ "EXISTS (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND (#{c}))"
end
def sql_for_parent_id_field(field, operator, value)