プロジェクト

全般

プロフィール

Vote #81906

未完了

Chained custom field filter doesn't work for User fields

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
Confirmed
優先度:
通常
担当者:
-
カテゴリ:
Filters_59
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
59
version_id:
33
issue_org_id:
36940
author_id:
291
assigned_to_id:
0
comments:
2
status_id:
9
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
173
ステータス-->[Confirmed]

説明

A chained custom field filter doesn't work for fields with format User.

Steps to reproduce:

Create a user custom field A (the format doesn't matter) and check Used as a filter

Create an issue custom field B with format User and check Used as a filter

On the My account page set the custom value A for your own account to an arbitrary value

Create an issue and select <> for the custom field B

Filter the issue list by the filter B's A and use the value you set on the My account page

Expected result:

  • The issue is found

Actual result:

  • The issue is not found

The reason is that the SQL that filters the issues contains a @WHERE customized_type='User'@. However, the correct clause would be @WHERE customized_type='Principal'@.

Here is a patch to fix the issue:

--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -1166,7 +1166,7 @@ class Query < ActiveRecord::Base
     end
 
     filter = available_filters[field]
-    target_class = filter[:through].format.target_class
+    target_class = filter[:through].format.target_class.base_class
 
     "#{queried_table_name}.id #{not_in} IN (" +
       "SELECT customized_id FROM #{CustomValue.table_name}" +

Best regards,
Thomas


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんが約2年前に更新

  • カテゴリFilters_59 にセット
  • 対象バージョンCandidate for next minor release_33 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0