QA #892
openチケットインポート機能で「バージョン」が反映されない
Description
■現象/要望¶
Redmine3.4.4.stable を使用しています。
Redmine標準のチケットインポート機能を使用した場合、
下記の条件で「対象バージョン」がチケットに反映されません。
<発生条件>
該当のバージョンを作成したプロジェクト以外の
プロジェクト(バージョン共有範囲内)に対してインポートした場合に発生
対応方法があればご教示いただけないでしょうか。
■解決策¶
Redmine3.4.7/4.0にて標準対応済¶
CSV importer ignores shared version names of other projects
https://www.redmine.org/issues/30001
運用回避(ソースレベル修正無)¶
1.チケットインポート実施後に、チケット一覧上から一括で対象バージョンを設定する。
2.別ツールの利用
Redmine標準のCSVファイルインポート機能ではなく
Redmineチケット一括(Excelファイル利用、Versionの内部ID指定)を利用する。
http://blog.redmine.jp/articles/redmine-ticket-ikkatsu/
Redmineソース変更による対応¶
/app/models/issue_import.rb 125行目
def build_object(row, item)
if version = issue.project.versions.named(version_name).first
↓
version =
issue.project.versions.named(version_name).first ||
issue.project.shared_versions.named(version_name).first
if version
■対応状況¶
Redmine3.4.7/4.0にて標準対応済
3.4.6迄は下記コード対応可能(上記)
Redmine本家チケット
Defect #30001: CSV importer ignores shared version names of other projects
https://www.redmine.org/issues/30001
本家パッチ
http://www.redmine.org/issues/30001#note-9
■補足¶
Updated by 奈良 裕記 about 5 years ago
自分もプロジェクト階層間のVersion,Category利用が当然と考えており、指摘された点の必要性は同感です。
■現状分析
CSVインポート機能は、Redmine3.2.0の下記チケットにより導入された機能
Import Issues from delimited/CSV file
https://www.redmine.org/issues/950
97行目から抜粋
プロジェクトのバージョン継承機能は全く考慮せず、指定されたバージョン名称が現在のプロジェクト内に存在するかしか見ていません。
if issue.project && version_name = row_value(row, 'fixed_version')
if version = issue.project.versions.named(version_name).first
attributes['fixed_version_id'] = version.id
elsif create_versions?
version = issue.project.versions.build
version.name = version_name
if version.save
attributes['fixed_version_id'] = version.id
end
end
end
■暫定対応策
CSV以外に、Excelからチケットを一括投入するソフトがあります。
バージョンID(表示内容ではなく、内部ID))が判っていれば、Excelから登録する方法もあります。
このソフトは、Excel上でバージョンIDを設定してインポートしますから、
validationで引っ掛からなければ、たぶん大丈夫かと思います。
http://blog.redmine.jp/articles/redmine-ticket-ikkatsu/
バージョンID(表示内容ではなく、内部のID))
Updated by 奈良 裕記 about 5 years ago
下記箇所を変更して対処できないかな。
同じバージョン名称をスコープ内の別PJで定義されていた場合など、問題起こるかもしれませんが。。
if version = issue.project.versions.named(version_name).first
↓
if version = issue.assignable_versions.named(version_name).first
Updated by 前田 剛 about 5 years ago
Updated by h n about 5 years ago
奈良様、前田様
ご回答ありがとうございます。
取り急ぎはご教示いただいた
暫定対応策にて検討してみます。
Updated by 奈良 裕記 about 5 years ago
target_versionは、下記箇所の修正で一応OKの筈。
なお、openのversion以外は設定不可。
/app/models/issue_import.rb 125行目
def build_object(row, item)
if version = issue.project.versions.named(version_name).first
↓
if version = issue.project.shared_versions.named(version_name).first
Updated by 奈良 裕記 about 5 years ago
↓ カスタムフィールドのバージョン定義については、変更不要の見込み。
affected_version(customfield:version)は、下記箇所が関連しますが、
呼び出し元を十分確認しないとデグレードしそう。。
lib/redmine/field_format.rb
class VersionFormat < RecordList
add 'version'
...
def query_filter_values(custom_field, query)
versions = possible_values_records(custom_field, query.project, true)
Version.sort_by_status(versions).collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s, l("version_status_#{s.status}")] }
end
def possible_values_records(custom_field, object=nil, all_statuses=false)
...
elsif object.nil?
scope = ::Version.visible.where(:sharing => 'system')
filtered_versions_options(custom_field, scope, all_statuses)
...
def filtered_versions_options(custom_field, scope, all_statuses=false)
Updated by 奈良 裕記 about 5 years ago
- Description updated (diff)
- Assignee set to 奈良 裕記
Updated by 奈良 裕記 about 5 years ago
- Description updated (diff)
- Status changed from 新規 to 回答済