質問編集履歴

1

ソース追加

2018/05/30 04:23

投稿

Ishi7322
Ishi7322

スコア6

test CHANGED
File without changes
test CHANGED
@@ -18,6 +18,58 @@
18
18
 
19
19
 
20
20
 
21
+ ```
22
+
23
+ @issue = Issue.new
24
+
25
+ if params[:copy_from]
26
+
27
+ begin
28
+
29
+ @issue.init_journal(User.current)
30
+
31
+ @copy_from = Issue.visible.find(params[:copy_from])
32
+
33
+ unless User.current.allowed_to?(:copy_issues, @copy_from.project)
34
+
35
+ raise ::Unauthorized
36
+
37
+ end
38
+
39
+ @link_copy = link_copy?(params[:link_copy]) || request.get?
40
+
41
+ @copy_attachments = params[:copy_attachments].present? || request.get?
42
+
43
+ @copy_subtasks = params[:copy_subtasks].present? || request.get?
44
+
45
+ @copy_watchers = User.current.allowed_to?(:add_issue_watchers, @project)
46
+
47
+ @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks, :watchers => @copy_watchers, :link => @link_copy)
48
+
49
+ @issue.parent_issue_id = @copy_from.parent_id
50
+
51
+ rescue ActiveRecord::RecordNotFound
52
+
53
+ render_404
54
+
55
+ return
56
+
57
+ end
58
+
59
+ end
60
+
61
+ @issue.project = @project
62
+
63
+   @issue.custom_field_values = {'4' => Date.today}
64
+
65
+ if request.get?
66
+
67
+ @issue.project ||= @issue.allowed_target_projects.first
68
+
69
+ end
70
+
71
+ ```
72
+
21
73
 
22
74
 
23
75
  カスタムフィールドの設定画面では以下のように定義しています。