プロジェクト

全般

プロフィール

Vote #76564

完了

Project copy does not copy custom field settings

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Custom fields_14
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
14
version_id:
105
issue_org_id:
20360
author_id:
115781
assigned_to_id:
1
comments:
12
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
95
ステータス-->[Closed]

説明

When making a project copy by going to /redmine/projects/template/copy custom field check boxes on the new project form are not set, all are unchecked. After project copy all custom field values are lost.


journals

I think this is expected behavior. What do you expect?
--------------------------------------------------------------------------------
No, this is not expected behavior. I do have a project setup and want to use it as template. I do have chosen what trackers and custom field I want to use. I do have some issues created that do have values in custom field.

When I make a project copy all previously chosen custom fields are not checked on the new project form, if I proceed with copy, custom fields are to setup correctly and values for issues are not copied at all.

I would expect custom fields to be pre-selected in the same way as trackers are. Take a look in attached picture. Project settings on the left, project copy form on the right. Trackers are checked correctly, custom fields are not.

To copy my project template I need to have to web browsers open and manually set custom fields in the same way as in project setting. This is not expected.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
#20559 says 2.6.5 has same issue.
--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
Do you need more feedback?
--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
So, I tried to track it down and here are some observations.

The r1592 has changed how custom fields are handled.
In /app/views/projects/_form.html.erb a line determining if custom field checkbox should be checked has been changed to use <code class="Ruby">@project.all_issue_custom_fields</code>. Today the code looks like this:

<pre><code class="Ruby">
<%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field),
:disabled => (custom_field.is_for_all? ? "disabled" : nil),
:id => nil %>
</code></pre>

It seems that when project is copied the <code class="Ruby">@project.all_issue_custom_fields</code> returns nothing. The underlying SQL looks like this:

<pre><code class="SQL">
SELECT `custom_fields`.* FROM `custom_fields`
WHERE `custom_fields`.`type` IN ('IssueCustomField') AND
(is_for_all = 1 OR id IN (SELECT DISTINCT cfp.custom_field_id FROM custom_fields_projects cfp WHERE cfp.project_id = NULL))
ORDER BY `custom_fields`.`position` ASC
</code></pre>

Notice that it checks for <code class="SQL">cfp.project_id = NULL</code>, this seems to be wrong and suggests that at the time when <code class="Ruby">@project.all_issue_custom_fields</code> is called, the <code class="Ruby">@project.id</code> is not set.

The r11916 has changed the <code class="Ruby">@project.all_issue_custom_fields</code> to return a scope and include project id in WHERE causing the problem.
--------------------------------------------------------------------------------
Thanks for pointing this out, fixed in r14618.
--------------------------------------------------------------------------------

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


related_issues

duplicates,Closed,20559,Project copy does not copy custom field settings

Admin Redmine さんが3年以上前に更新

  • カテゴリCustom fields_14 にセット
  • 対象バージョン2.6.8_105 にセット

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

いいね!0
いいね!0