summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-09-20 20:25:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-09-20 20:25:16 +0000
commitaa096cb0cc96c0b7f12274dcf7bbd3d8e3e44948 (patch)
tree7a38acc0c27bfd0087a395d8da7b48ae4f2992ff /app/models
parent71e04370d8225aeedaee67049cbec4d8ecf4891e (diff)
downloadredmine-aa096cb0cc96c0b7f12274dcf7bbd3d8e3e44948.tar.gz
redmine-aa096cb0cc96c0b7f12274dcf7bbd3d8e3e44948.zip
Project copy does not copy custom field settings (#20360).
git-svn-id: http://svn.redmine.org/redmine/trunk@14618 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 8cd2bf993..18c4a20c9 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -526,11 +526,17 @@ class Project < ActiveRecord::Base
# Returns a scope of all custom fields enabled for project issues
# (explicitly associated custom fields and custom fields enabled for all projects)
def all_issue_custom_fields
- @all_issue_custom_fields ||= IssueCustomField.
- sorted.
- where("is_for_all = ? OR id IN (SELECT DISTINCT cfp.custom_field_id" +
- " FROM #{table_name_prefix}custom_fields_projects#{table_name_suffix} cfp" +
- " WHERE cfp.project_id = ?)", true, id)
+ if new_record?
+ @all_issue_custom_fields ||= IssueCustomField.
+ sorted.
+ where("is_for_all = ? OR id IN (?)", true, issue_custom_field_ids)
+ else
+ @all_issue_custom_fields ||= IssueCustomField.
+ sorted.
+ where("is_for_all = ? OR id IN (SELECT DISTINCT cfp.custom_field_id" +
+ " FROM #{table_name_prefix}custom_fields_projects#{table_name_suffix} cfp" +
+ " WHERE cfp.project_id = ?)", true, id)
+ end
end
def project