Defect #41502 ยป fix-41502.patch
| app/models/project.rb | ||
|---|---|---|
| 1120 | 1120 |
attachment.copy(:container => new_version) |
| 1121 | 1121 |
end |
| 1122 | 1122 | |
| 1123 |
new_version.custom_field_values = version.custom_field_values.inject({}) do |h, v|
|
|
| 1124 |
h[v.custom_field_id] = v.value |
|
| 1125 |
h |
|
| 1126 |
end |
|
| 1127 | ||
| 1123 | 1128 |
self.versions << new_version |
| 1124 | 1129 |
end |
| 1125 | 1130 |
end |
| test/unit/project_copy_test.rb | ||
|---|---|---|
| 151 | 151 |
assert_equal assigned_version, copied_issue.fixed_version |
| 152 | 152 |
end |
| 153 | 153 | |
| 154 |
test "#copy should copy versions custom values" do |
|
| 155 |
field = VersionCustomField.generate!(:is_for_all => true) |
|
| 156 |
version = Version.generate!(:project => @source_project, :name => 'Version for custom field copy') |
|
| 157 |
version.custom_field_values = {field.id => 'version custom field value'}
|
|
| 158 |
version.save! |
|
| 159 |
assert_equal 'version custom field value', version.reload.custom_field_value(field) |
|
| 160 | ||
| 161 |
assert @project.copy(@source_project) |
|
| 162 |
copy = @project.versions.find_by_name('Version for custom field copy')
|
|
| 163 |
assert copy |
|
| 164 |
assert_equal 'version custom field value', copy.reload.custom_field_value(field) |
|
| 165 |
end |
|
| 166 | ||
| 154 | 167 |
def test_copy_issues_should_reassign_version_custom_fields_to_copied_versions |
| 155 | 168 |
User.current = User.find(1) |
| 156 | 169 |
CustomField.destroy_all |