The requested changes are too big and content was truncated. Show full diff
@@ -1,545 +1,551 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2016 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2016 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class IssuesController < ApplicationController |
|
18 | class IssuesController < ApplicationController | |
19 | default_search_scope :issues |
|
19 | default_search_scope :issues | |
20 |
|
20 | |||
21 | before_action :find_issue, :only => [:show, :edit, :update] |
|
21 | before_action :find_issue, :only => [:show, :edit, :update] | |
22 | before_action :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] |
|
22 | before_action :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] | |
23 | before_action :authorize, :except => [:index, :new, :create] |
|
23 | before_action :authorize, :except => [:index, :new, :create] | |
24 | before_action :find_optional_project, :only => [:index, :new, :create] |
|
24 | before_action :find_optional_project, :only => [:index, :new, :create] | |
25 | before_action :build_new_issue_from_params, :only => [:new, :create] |
|
25 | before_action :build_new_issue_from_params, :only => [:new, :create] | |
26 | accept_rss_auth :index, :show |
|
26 | accept_rss_auth :index, :show | |
27 | accept_api_auth :index, :show, :create, :update, :destroy |
|
27 | accept_api_auth :index, :show, :create, :update, :destroy | |
28 |
|
28 | |||
29 | rescue_from Query::StatementInvalid, :with => :query_statement_invalid |
|
29 | rescue_from Query::StatementInvalid, :with => :query_statement_invalid | |
30 |
|
30 | |||
31 | helper :journals |
|
31 | helper :journals | |
32 | helper :projects |
|
32 | helper :projects | |
33 | helper :custom_fields |
|
33 | helper :custom_fields | |
34 | helper :issue_relations |
|
34 | helper :issue_relations | |
35 | helper :watchers |
|
35 | helper :watchers | |
36 | helper :attachments |
|
36 | helper :attachments | |
37 | helper :queries |
|
37 | helper :queries | |
38 | include QueriesHelper |
|
38 | include QueriesHelper | |
39 | helper :repositories |
|
39 | helper :repositories | |
40 | helper :sort |
|
40 | helper :sort | |
41 | include SortHelper |
|
41 | include SortHelper | |
42 | helper :timelog |
|
42 | helper :timelog | |
43 |
|
43 | |||
44 | def index |
|
44 | def index | |
45 | retrieve_query |
|
45 | retrieve_query | |
46 | sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) |
|
46 | sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) | |
47 | sort_update(@query.sortable_columns) |
|
47 | sort_update(@query.sortable_columns) | |
48 | @query.sort_criteria = sort_criteria.to_a |
|
48 | @query.sort_criteria = sort_criteria.to_a | |
49 |
|
49 | |||
50 | if @query.valid? |
|
50 | if @query.valid? | |
51 | case params[:format] |
|
51 | case params[:format] | |
52 | when 'csv', 'pdf' |
|
52 | when 'csv', 'pdf' | |
53 | @limit = Setting.issues_export_limit.to_i |
|
53 | @limit = Setting.issues_export_limit.to_i | |
54 | if params[:columns] == 'all' |
|
54 | if params[:columns] == 'all' | |
55 | @query.column_names = @query.available_inline_columns.map(&:name) |
|
55 | @query.column_names = @query.available_inline_columns.map(&:name) | |
56 | end |
|
56 | end | |
57 | when 'atom' |
|
57 | when 'atom' | |
58 | @limit = Setting.feeds_limit.to_i |
|
58 | @limit = Setting.feeds_limit.to_i | |
59 | when 'xml', 'json' |
|
59 | when 'xml', 'json' | |
60 | @offset, @limit = api_offset_and_limit |
|
60 | @offset, @limit = api_offset_and_limit | |
61 | @query.column_names = %w(author) |
|
61 | @query.column_names = %w(author) | |
62 | else |
|
62 | else | |
63 | @limit = per_page_option |
|
63 | @limit = per_page_option | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | @issue_count = @query.issue_count |
|
66 | @issue_count = @query.issue_count | |
67 | @issue_pages = Paginator.new @issue_count, @limit, params['page'] |
|
67 | @issue_pages = Paginator.new @issue_count, @limit, params['page'] | |
68 | @offset ||= @issue_pages.offset |
|
68 | @offset ||= @issue_pages.offset | |
69 | @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], |
|
69 | @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], | |
70 | :order => sort_clause, |
|
70 | :order => sort_clause, | |
71 | :offset => @offset, |
|
71 | :offset => @offset, | |
72 | :limit => @limit) |
|
72 | :limit => @limit) | |
73 | @issue_count_by_group = @query.issue_count_by_group |
|
73 | @issue_count_by_group = @query.issue_count_by_group | |
74 |
|
74 | |||
75 | respond_to do |format| |
|
75 | respond_to do |format| | |
76 | format.html { render :template => 'issues/index', :layout => !request.xhr? } |
|
76 | format.html { render :template => 'issues/index', :layout => !request.xhr? } | |
77 | format.api { |
|
77 | format.api { | |
78 | Issue.load_visible_relations(@issues) if include_in_api_response?('relations') |
|
78 | Issue.load_visible_relations(@issues) if include_in_api_response?('relations') | |
79 | } |
|
79 | } | |
80 | format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } |
|
80 | format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } | |
81 | format.csv { send_data(query_to_csv(@issues, @query, params[:csv]), :type => 'text/csv; header=present', :filename => 'issues.csv') } |
|
81 | format.csv { send_data(query_to_csv(@issues, @query, params[:csv]), :type => 'text/csv; header=present', :filename => 'issues.csv') } | |
82 | format.pdf { send_file_headers! :type => 'application/pdf', :filename => 'issues.pdf' } |
|
82 | format.pdf { send_file_headers! :type => 'application/pdf', :filename => 'issues.pdf' } | |
83 | end |
|
83 | end | |
84 | else |
|
84 | else | |
85 | respond_to do |format| |
|
85 | respond_to do |format| | |
86 | format.html { render(:template => 'issues/index', :layout => !request.xhr?) } |
|
86 | format.html { render(:template => 'issues/index', :layout => !request.xhr?) } | |
87 | format.any(:atom, :csv, :pdf) { head 422 } |
|
87 | format.any(:atom, :csv, :pdf) { head 422 } | |
88 | format.api { render_validation_errors(@query) } |
|
88 | format.api { render_validation_errors(@query) } | |
89 | end |
|
89 | end | |
90 | end |
|
90 | end | |
91 | rescue ActiveRecord::RecordNotFound |
|
91 | rescue ActiveRecord::RecordNotFound | |
92 | render_404 |
|
92 | render_404 | |
93 | end |
|
93 | end | |
94 |
|
94 | |||
95 | def show |
|
95 | def show | |
96 | @journals = @issue.journals. |
|
96 | @journals = @issue.journals. | |
97 | preload(:details). |
|
97 | preload(:details). | |
98 | preload(:user => :email_address). |
|
98 | preload(:user => :email_address). | |
99 | reorder(:created_on, :id).to_a |
|
99 | reorder(:created_on, :id).to_a | |
100 | @journals.each_with_index {|j,i| j.indice = i+1} |
|
100 | @journals.each_with_index {|j,i| j.indice = i+1} | |
101 | @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) |
|
101 | @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) | |
102 | Journal.preload_journals_details_custom_fields(@journals) |
|
102 | Journal.preload_journals_details_custom_fields(@journals) | |
103 | @journals.select! {|journal| journal.notes? || journal.visible_details.any?} |
|
103 | @journals.select! {|journal| journal.notes? || journal.visible_details.any?} | |
104 | @journals.reverse! if User.current.wants_comments_in_reverse_order? |
|
104 | @journals.reverse! if User.current.wants_comments_in_reverse_order? | |
105 |
|
105 | |||
106 | @changesets = @issue.changesets.visible.preload(:repository, :user).to_a |
|
106 | @changesets = @issue.changesets.visible.preload(:repository, :user).to_a | |
107 | @changesets.reverse! if User.current.wants_comments_in_reverse_order? |
|
107 | @changesets.reverse! if User.current.wants_comments_in_reverse_order? | |
108 |
|
108 | |||
109 | @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } |
|
109 | @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } | |
110 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) |
|
110 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) | |
111 | @priorities = IssuePriority.active |
|
111 | @priorities = IssuePriority.active | |
112 | @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) |
|
112 | @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) | |
113 | @relation = IssueRelation.new |
|
113 | @relation = IssueRelation.new | |
114 |
|
114 | |||
115 | respond_to do |format| |
|
115 | respond_to do |format| | |
116 | format.html { |
|
116 | format.html { | |
117 | retrieve_previous_and_next_issue_ids |
|
117 | retrieve_previous_and_next_issue_ids | |
118 | render :template => 'issues/show' |
|
118 | render :template => 'issues/show' | |
119 | } |
|
119 | } | |
120 | format.api |
|
120 | format.api | |
121 | format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } |
|
121 | format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } | |
122 | format.pdf { |
|
122 | format.pdf { | |
123 | send_file_headers! :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf" |
|
123 | send_file_headers! :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf" | |
124 | } |
|
124 | } | |
125 | end |
|
125 | end | |
126 | end |
|
126 | end | |
127 |
|
127 | |||
128 | def new |
|
128 | def new | |
129 | respond_to do |format| |
|
129 | respond_to do |format| | |
130 | format.html { render :action => 'new', :layout => !request.xhr? } |
|
130 | format.html { render :action => 'new', :layout => !request.xhr? } | |
131 | format.js |
|
131 | format.js | |
132 | end |
|
132 | end | |
133 | end |
|
133 | end | |
134 |
|
134 | |||
135 | def create |
|
135 | def create | |
136 | unless User.current.allowed_to?(:add_issues, @issue.project, :global => true) |
|
136 | unless User.current.allowed_to?(:add_issues, @issue.project, :global => true) | |
137 | raise ::Unauthorized |
|
137 | raise ::Unauthorized | |
138 | end |
|
138 | end | |
139 | call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue }) |
|
139 | call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue }) | |
140 | @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) |
|
140 | @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) | |
141 | if @issue.save |
|
141 | if @issue.save | |
142 | call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) |
|
142 | call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) | |
143 | respond_to do |format| |
|
143 | respond_to do |format| | |
144 | format.html { |
|
144 | format.html { | |
145 | render_attachment_warning_if_needed(@issue) |
|
145 | render_attachment_warning_if_needed(@issue) | |
146 | flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject)) |
|
146 | flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject)) | |
147 | redirect_after_create |
|
147 | redirect_after_create | |
148 | } |
|
148 | } | |
149 | format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) } |
|
149 | format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) } | |
150 | end |
|
150 | end | |
151 | return |
|
151 | return | |
152 | else |
|
152 | else | |
153 | respond_to do |format| |
|
153 | respond_to do |format| | |
154 |
format.html { |
|
154 | format.html { | |
|
155 | if @issue.project.nil? | |||
|
156 | render_error :status => 422 | |||
|
157 | else | |||
|
158 | render :action => 'new' | |||
|
159 | end | |||
|
160 | } | |||
155 | format.api { render_validation_errors(@issue) } |
|
161 | format.api { render_validation_errors(@issue) } | |
156 | end |
|
162 | end | |
157 | end |
|
163 | end | |
158 | end |
|
164 | end | |
159 |
|
165 | |||
160 | def edit |
|
166 | def edit | |
161 | return unless update_issue_from_params |
|
167 | return unless update_issue_from_params | |
162 |
|
168 | |||
163 | respond_to do |format| |
|
169 | respond_to do |format| | |
164 | format.html { } |
|
170 | format.html { } | |
165 | format.js |
|
171 | format.js | |
166 | end |
|
172 | end | |
167 | end |
|
173 | end | |
168 |
|
174 | |||
169 | def update |
|
175 | def update | |
170 | return unless update_issue_from_params |
|
176 | return unless update_issue_from_params | |
171 | @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) |
|
177 | @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) | |
172 | saved = false |
|
178 | saved = false | |
173 | begin |
|
179 | begin | |
174 | saved = save_issue_with_child_records |
|
180 | saved = save_issue_with_child_records | |
175 | rescue ActiveRecord::StaleObjectError |
|
181 | rescue ActiveRecord::StaleObjectError | |
176 | @conflict = true |
|
182 | @conflict = true | |
177 | if params[:last_journal_id] |
|
183 | if params[:last_journal_id] | |
178 | @conflict_journals = @issue.journals_after(params[:last_journal_id]).to_a |
|
184 | @conflict_journals = @issue.journals_after(params[:last_journal_id]).to_a | |
179 | @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) |
|
185 | @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) | |
180 | end |
|
186 | end | |
181 | end |
|
187 | end | |
182 |
|
188 | |||
183 | if saved |
|
189 | if saved | |
184 | render_attachment_warning_if_needed(@issue) |
|
190 | render_attachment_warning_if_needed(@issue) | |
185 | flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? |
|
191 | flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? | |
186 |
|
192 | |||
187 | respond_to do |format| |
|
193 | respond_to do |format| | |
188 | format.html { redirect_back_or_default issue_path(@issue, previous_and_next_issue_ids_params) } |
|
194 | format.html { redirect_back_or_default issue_path(@issue, previous_and_next_issue_ids_params) } | |
189 | format.api { render_api_ok } |
|
195 | format.api { render_api_ok } | |
190 | end |
|
196 | end | |
191 | else |
|
197 | else | |
192 | respond_to do |format| |
|
198 | respond_to do |format| | |
193 | format.html { render :action => 'edit' } |
|
199 | format.html { render :action => 'edit' } | |
194 | format.api { render_validation_errors(@issue) } |
|
200 | format.api { render_validation_errors(@issue) } | |
195 | end |
|
201 | end | |
196 | end |
|
202 | end | |
197 | end |
|
203 | end | |
198 |
|
204 | |||
199 | # Bulk edit/copy a set of issues |
|
205 | # Bulk edit/copy a set of issues | |
200 | def bulk_edit |
|
206 | def bulk_edit | |
201 | @issues.sort! |
|
207 | @issues.sort! | |
202 | @copy = params[:copy].present? |
|
208 | @copy = params[:copy].present? | |
203 | @notes = params[:notes] |
|
209 | @notes = params[:notes] | |
204 |
|
210 | |||
205 | if @copy |
|
211 | if @copy | |
206 | unless User.current.allowed_to?(:copy_issues, @projects) |
|
212 | unless User.current.allowed_to?(:copy_issues, @projects) | |
207 | raise ::Unauthorized |
|
213 | raise ::Unauthorized | |
208 | end |
|
214 | end | |
209 | else |
|
215 | else | |
210 | unless @issues.all?(&:attributes_editable?) |
|
216 | unless @issues.all?(&:attributes_editable?) | |
211 | raise ::Unauthorized |
|
217 | raise ::Unauthorized | |
212 | end |
|
218 | end | |
213 | end |
|
219 | end | |
214 |
|
220 | |||
215 | @allowed_projects = Issue.allowed_target_projects |
|
221 | @allowed_projects = Issue.allowed_target_projects | |
216 | if params[:issue] |
|
222 | if params[:issue] | |
217 | @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id].to_s} |
|
223 | @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id].to_s} | |
218 | if @target_project |
|
224 | if @target_project | |
219 | target_projects = [@target_project] |
|
225 | target_projects = [@target_project] | |
220 | end |
|
226 | end | |
221 | end |
|
227 | end | |
222 | target_projects ||= @projects |
|
228 | target_projects ||= @projects | |
223 |
|
229 | |||
224 | if @copy |
|
230 | if @copy | |
225 | # Copied issues will get their default statuses |
|
231 | # Copied issues will get their default statuses | |
226 | @available_statuses = [] |
|
232 | @available_statuses = [] | |
227 | else |
|
233 | else | |
228 | @available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&) |
|
234 | @available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&) | |
229 | end |
|
235 | end | |
230 | @custom_fields = @issues.map{|i|i.editable_custom_fields}.reduce(:&) |
|
236 | @custom_fields = @issues.map{|i|i.editable_custom_fields}.reduce(:&) | |
231 | @assignables = target_projects.map(&:assignable_users).reduce(:&) |
|
237 | @assignables = target_projects.map(&:assignable_users).reduce(:&) | |
232 | @trackers = target_projects.map {|p| Issue.allowed_target_trackers(p) }.reduce(:&) |
|
238 | @trackers = target_projects.map {|p| Issue.allowed_target_trackers(p) }.reduce(:&) | |
233 | @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&) |
|
239 | @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&) | |
234 | @categories = target_projects.map {|p| p.issue_categories}.reduce(:&) |
|
240 | @categories = target_projects.map {|p| p.issue_categories}.reduce(:&) | |
235 | if @copy |
|
241 | if @copy | |
236 | @attachments_present = @issues.detect {|i| i.attachments.any?}.present? |
|
242 | @attachments_present = @issues.detect {|i| i.attachments.any?}.present? | |
237 | @subtasks_present = @issues.detect {|i| !i.leaf?}.present? |
|
243 | @subtasks_present = @issues.detect {|i| !i.leaf?}.present? | |
238 | end |
|
244 | end | |
239 |
|
245 | |||
240 | @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&) |
|
246 | @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&) | |
241 |
|
247 | |||
242 | @issue_params = params[:issue] || {} |
|
248 | @issue_params = params[:issue] || {} | |
243 | @issue_params[:custom_field_values] ||= {} |
|
249 | @issue_params[:custom_field_values] ||= {} | |
244 | end |
|
250 | end | |
245 |
|
251 | |||
246 | def bulk_update |
|
252 | def bulk_update | |
247 | @issues.sort! |
|
253 | @issues.sort! | |
248 | @copy = params[:copy].present? |
|
254 | @copy = params[:copy].present? | |
249 |
|
255 | |||
250 | attributes = parse_params_for_bulk_update(params[:issue]) |
|
256 | attributes = parse_params_for_bulk_update(params[:issue]) | |
251 | copy_subtasks = (params[:copy_subtasks] == '1') |
|
257 | copy_subtasks = (params[:copy_subtasks] == '1') | |
252 | copy_attachments = (params[:copy_attachments] == '1') |
|
258 | copy_attachments = (params[:copy_attachments] == '1') | |
253 |
|
259 | |||
254 | if @copy |
|
260 | if @copy | |
255 | unless User.current.allowed_to?(:copy_issues, @projects) |
|
261 | unless User.current.allowed_to?(:copy_issues, @projects) | |
256 | raise ::Unauthorized |
|
262 | raise ::Unauthorized | |
257 | end |
|
263 | end | |
258 | target_projects = @projects |
|
264 | target_projects = @projects | |
259 | if attributes['project_id'].present? |
|
265 | if attributes['project_id'].present? | |
260 | target_projects = Project.where(:id => attributes['project_id']).to_a |
|
266 | target_projects = Project.where(:id => attributes['project_id']).to_a | |
261 | end |
|
267 | end | |
262 | unless User.current.allowed_to?(:add_issues, target_projects) |
|
268 | unless User.current.allowed_to?(:add_issues, target_projects) | |
263 | raise ::Unauthorized |
|
269 | raise ::Unauthorized | |
264 | end |
|
270 | end | |
265 | else |
|
271 | else | |
266 | unless @issues.all?(&:attributes_editable?) |
|
272 | unless @issues.all?(&:attributes_editable?) | |
267 | raise ::Unauthorized |
|
273 | raise ::Unauthorized | |
268 | end |
|
274 | end | |
269 | end |
|
275 | end | |
270 |
|
276 | |||
271 | unsaved_issues = [] |
|
277 | unsaved_issues = [] | |
272 | saved_issues = [] |
|
278 | saved_issues = [] | |
273 |
|
279 | |||
274 | if @copy && copy_subtasks |
|
280 | if @copy && copy_subtasks | |
275 | # Descendant issues will be copied with the parent task |
|
281 | # Descendant issues will be copied with the parent task | |
276 | # Don't copy them twice |
|
282 | # Don't copy them twice | |
277 | @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}} |
|
283 | @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}} | |
278 | end |
|
284 | end | |
279 |
|
285 | |||
280 | @issues.each do |orig_issue| |
|
286 | @issues.each do |orig_issue| | |
281 | orig_issue.reload |
|
287 | orig_issue.reload | |
282 | if @copy |
|
288 | if @copy | |
283 | issue = orig_issue.copy({}, |
|
289 | issue = orig_issue.copy({}, | |
284 | :attachments => copy_attachments, |
|
290 | :attachments => copy_attachments, | |
285 | :subtasks => copy_subtasks, |
|
291 | :subtasks => copy_subtasks, | |
286 | :link => link_copy?(params[:link_copy]) |
|
292 | :link => link_copy?(params[:link_copy]) | |
287 | ) |
|
293 | ) | |
288 | else |
|
294 | else | |
289 | issue = orig_issue |
|
295 | issue = orig_issue | |
290 | end |
|
296 | end | |
291 | journal = issue.init_journal(User.current, params[:notes]) |
|
297 | journal = issue.init_journal(User.current, params[:notes]) | |
292 | issue.safe_attributes = attributes |
|
298 | issue.safe_attributes = attributes | |
293 | call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue }) |
|
299 | call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue }) | |
294 | if issue.save |
|
300 | if issue.save | |
295 | saved_issues << issue |
|
301 | saved_issues << issue | |
296 | else |
|
302 | else | |
297 | unsaved_issues << orig_issue |
|
303 | unsaved_issues << orig_issue | |
298 | end |
|
304 | end | |
299 | end |
|
305 | end | |
300 |
|
306 | |||
301 | if unsaved_issues.empty? |
|
307 | if unsaved_issues.empty? | |
302 | flash[:notice] = l(:notice_successful_update) unless saved_issues.empty? |
|
308 | flash[:notice] = l(:notice_successful_update) unless saved_issues.empty? | |
303 | if params[:follow] |
|
309 | if params[:follow] | |
304 | if @issues.size == 1 && saved_issues.size == 1 |
|
310 | if @issues.size == 1 && saved_issues.size == 1 | |
305 | redirect_to issue_path(saved_issues.first) |
|
311 | redirect_to issue_path(saved_issues.first) | |
306 | elsif saved_issues.map(&:project).uniq.size == 1 |
|
312 | elsif saved_issues.map(&:project).uniq.size == 1 | |
307 | redirect_to project_issues_path(saved_issues.map(&:project).first) |
|
313 | redirect_to project_issues_path(saved_issues.map(&:project).first) | |
308 | end |
|
314 | end | |
309 | else |
|
315 | else | |
310 | redirect_back_or_default _project_issues_path(@project) |
|
316 | redirect_back_or_default _project_issues_path(@project) | |
311 | end |
|
317 | end | |
312 | else |
|
318 | else | |
313 | @saved_issues = @issues |
|
319 | @saved_issues = @issues | |
314 | @unsaved_issues = unsaved_issues |
|
320 | @unsaved_issues = unsaved_issues | |
315 | @issues = Issue.visible.where(:id => @unsaved_issues.map(&:id)).to_a |
|
321 | @issues = Issue.visible.where(:id => @unsaved_issues.map(&:id)).to_a | |
316 | bulk_edit |
|
322 | bulk_edit | |
317 | render :action => 'bulk_edit' |
|
323 | render :action => 'bulk_edit' | |
318 | end |
|
324 | end | |
319 | end |
|
325 | end | |
320 |
|
326 | |||
321 | def destroy |
|
327 | def destroy | |
322 | raise Unauthorized unless @issues.all?(&:deletable?) |
|
328 | raise Unauthorized unless @issues.all?(&:deletable?) | |
323 | @hours = TimeEntry.where(:issue_id => @issues.map(&:id)).sum(:hours).to_f |
|
329 | @hours = TimeEntry.where(:issue_id => @issues.map(&:id)).sum(:hours).to_f | |
324 | if @hours > 0 |
|
330 | if @hours > 0 | |
325 | case params[:todo] |
|
331 | case params[:todo] | |
326 | when 'destroy' |
|
332 | when 'destroy' | |
327 | # nothing to do |
|
333 | # nothing to do | |
328 | when 'nullify' |
|
334 | when 'nullify' | |
329 | TimeEntry.where(['issue_id IN (?)', @issues]).update_all('issue_id = NULL') |
|
335 | TimeEntry.where(['issue_id IN (?)', @issues]).update_all('issue_id = NULL') | |
330 | when 'reassign' |
|
336 | when 'reassign' | |
331 | reassign_to = @project.issues.find_by_id(params[:reassign_to_id]) |
|
337 | reassign_to = @project.issues.find_by_id(params[:reassign_to_id]) | |
332 | if reassign_to.nil? |
|
338 | if reassign_to.nil? | |
333 | flash.now[:error] = l(:error_issue_not_found_in_project) |
|
339 | flash.now[:error] = l(:error_issue_not_found_in_project) | |
334 | return |
|
340 | return | |
335 | else |
|
341 | else | |
336 | TimeEntry.where(['issue_id IN (?)', @issues]). |
|
342 | TimeEntry.where(['issue_id IN (?)', @issues]). | |
337 | update_all("issue_id = #{reassign_to.id}") |
|
343 | update_all("issue_id = #{reassign_to.id}") | |
338 | end |
|
344 | end | |
339 | else |
|
345 | else | |
340 | # display the destroy form if it's a user request |
|
346 | # display the destroy form if it's a user request | |
341 | return unless api_request? |
|
347 | return unless api_request? | |
342 | end |
|
348 | end | |
343 | end |
|
349 | end | |
344 | @issues.each do |issue| |
|
350 | @issues.each do |issue| | |
345 | begin |
|
351 | begin | |
346 | issue.reload.destroy |
|
352 | issue.reload.destroy | |
347 | rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists |
|
353 | rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists | |
348 | # nothing to do, issue was already deleted (eg. by a parent) |
|
354 | # nothing to do, issue was already deleted (eg. by a parent) | |
349 | end |
|
355 | end | |
350 | end |
|
356 | end | |
351 | respond_to do |format| |
|
357 | respond_to do |format| | |
352 | format.html { redirect_back_or_default _project_issues_path(@project) } |
|
358 | format.html { redirect_back_or_default _project_issues_path(@project) } | |
353 | format.api { render_api_ok } |
|
359 | format.api { render_api_ok } | |
354 | end |
|
360 | end | |
355 | end |
|
361 | end | |
356 |
|
362 | |||
357 | # Overrides Redmine::MenuManager::MenuController::ClassMethods for |
|
363 | # Overrides Redmine::MenuManager::MenuController::ClassMethods for | |
358 | # when the "New issue" tab is enabled |
|
364 | # when the "New issue" tab is enabled | |
359 | def current_menu_item |
|
365 | def current_menu_item | |
360 | if Setting.new_item_menu_tab == '1' && [:new, :create].include?(action_name.to_sym) |
|
366 | if Setting.new_item_menu_tab == '1' && [:new, :create].include?(action_name.to_sym) | |
361 | :new_issue |
|
367 | :new_issue | |
362 | else |
|
368 | else | |
363 | super |
|
369 | super | |
364 | end |
|
370 | end | |
365 | end |
|
371 | end | |
366 |
|
372 | |||
367 | private |
|
373 | private | |
368 |
|
374 | |||
369 | def retrieve_previous_and_next_issue_ids |
|
375 | def retrieve_previous_and_next_issue_ids | |
370 | if params[:prev_issue_id].present? || params[:next_issue_id].present? |
|
376 | if params[:prev_issue_id].present? || params[:next_issue_id].present? | |
371 | @prev_issue_id = params[:prev_issue_id].presence.try(:to_i) |
|
377 | @prev_issue_id = params[:prev_issue_id].presence.try(:to_i) | |
372 | @next_issue_id = params[:next_issue_id].presence.try(:to_i) |
|
378 | @next_issue_id = params[:next_issue_id].presence.try(:to_i) | |
373 | @issue_position = params[:issue_position].presence.try(:to_i) |
|
379 | @issue_position = params[:issue_position].presence.try(:to_i) | |
374 | @issue_count = params[:issue_count].presence.try(:to_i) |
|
380 | @issue_count = params[:issue_count].presence.try(:to_i) | |
375 | else |
|
381 | else | |
376 | retrieve_query_from_session |
|
382 | retrieve_query_from_session | |
377 | if @query |
|
383 | if @query | |
378 | sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) |
|
384 | sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) | |
379 | sort_update(@query.sortable_columns, 'issues_index_sort') |
|
385 | sort_update(@query.sortable_columns, 'issues_index_sort') | |
380 | limit = 500 |
|
386 | limit = 500 | |
381 | issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version]) |
|
387 | issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version]) | |
382 | if (idx = issue_ids.index(@issue.id)) && idx < limit |
|
388 | if (idx = issue_ids.index(@issue.id)) && idx < limit | |
383 | if issue_ids.size < 500 |
|
389 | if issue_ids.size < 500 | |
384 | @issue_position = idx + 1 |
|
390 | @issue_position = idx + 1 | |
385 | @issue_count = issue_ids.size |
|
391 | @issue_count = issue_ids.size | |
386 | end |
|
392 | end | |
387 | @prev_issue_id = issue_ids[idx - 1] if idx > 0 |
|
393 | @prev_issue_id = issue_ids[idx - 1] if idx > 0 | |
388 | @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1) |
|
394 | @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1) | |
389 | end |
|
395 | end | |
390 | end |
|
396 | end | |
391 | end |
|
397 | end | |
392 | end |
|
398 | end | |
393 |
|
399 | |||
394 | def previous_and_next_issue_ids_params |
|
400 | def previous_and_next_issue_ids_params | |
395 | { |
|
401 | { | |
396 | :prev_issue_id => params[:prev_issue_id], |
|
402 | :prev_issue_id => params[:prev_issue_id], | |
397 | :next_issue_id => params[:next_issue_id], |
|
403 | :next_issue_id => params[:next_issue_id], | |
398 | :issue_position => params[:issue_position], |
|
404 | :issue_position => params[:issue_position], | |
399 | :issue_count => params[:issue_count] |
|
405 | :issue_count => params[:issue_count] | |
400 | }.reject {|k,v| k.blank?} |
|
406 | }.reject {|k,v| k.blank?} | |
401 | end |
|
407 | end | |
402 |
|
408 | |||
403 | # Used by #edit and #update to set some common instance variables |
|
409 | # Used by #edit and #update to set some common instance variables | |
404 | # from the params |
|
410 | # from the params | |
405 | def update_issue_from_params |
|
411 | def update_issue_from_params | |
406 | @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) |
|
412 | @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) | |
407 | if params[:time_entry] |
|
413 | if params[:time_entry] | |
408 | @time_entry.safe_attributes = params[:time_entry] |
|
414 | @time_entry.safe_attributes = params[:time_entry] | |
409 | end |
|
415 | end | |
410 |
|
416 | |||
411 | @issue.init_journal(User.current) |
|
417 | @issue.init_journal(User.current) | |
412 |
|
418 | |||
413 | issue_attributes = params[:issue] |
|
419 | issue_attributes = params[:issue] | |
414 | if issue_attributes && params[:conflict_resolution] |
|
420 | if issue_attributes && params[:conflict_resolution] | |
415 | case params[:conflict_resolution] |
|
421 | case params[:conflict_resolution] | |
416 | when 'overwrite' |
|
422 | when 'overwrite' | |
417 | issue_attributes = issue_attributes.dup |
|
423 | issue_attributes = issue_attributes.dup | |
418 | issue_attributes.delete(:lock_version) |
|
424 | issue_attributes.delete(:lock_version) | |
419 | when 'add_notes' |
|
425 | when 'add_notes' | |
420 | issue_attributes = issue_attributes.slice(:notes, :private_notes) |
|
426 | issue_attributes = issue_attributes.slice(:notes, :private_notes) | |
421 | when 'cancel' |
|
427 | when 'cancel' | |
422 | redirect_to issue_path(@issue) |
|
428 | redirect_to issue_path(@issue) | |
423 | return false |
|
429 | return false | |
424 | end |
|
430 | end | |
425 | end |
|
431 | end | |
426 | @issue.safe_attributes = issue_attributes |
|
432 | @issue.safe_attributes = issue_attributes | |
427 | @priorities = IssuePriority.active |
|
433 | @priorities = IssuePriority.active | |
428 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) |
|
434 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) | |
429 | true |
|
435 | true | |
430 | end |
|
436 | end | |
431 |
|
437 | |||
432 | # Used by #new and #create to build a new issue from the params |
|
438 | # Used by #new and #create to build a new issue from the params | |
433 | # The new issue will be copied from an existing one if copy_from parameter is given |
|
439 | # The new issue will be copied from an existing one if copy_from parameter is given | |
434 | def build_new_issue_from_params |
|
440 | def build_new_issue_from_params | |
435 | @issue = Issue.new |
|
441 | @issue = Issue.new | |
436 | if params[:copy_from] |
|
442 | if params[:copy_from] | |
437 | begin |
|
443 | begin | |
438 | @issue.init_journal(User.current) |
|
444 | @issue.init_journal(User.current) | |
439 | @copy_from = Issue.visible.find(params[:copy_from]) |
|
445 | @copy_from = Issue.visible.find(params[:copy_from]) | |
440 | unless User.current.allowed_to?(:copy_issues, @copy_from.project) |
|
446 | unless User.current.allowed_to?(:copy_issues, @copy_from.project) | |
441 | raise ::Unauthorized |
|
447 | raise ::Unauthorized | |
442 | end |
|
448 | end | |
443 | @link_copy = link_copy?(params[:link_copy]) || request.get? |
|
449 | @link_copy = link_copy?(params[:link_copy]) || request.get? | |
444 | @copy_attachments = params[:copy_attachments].present? || request.get? |
|
450 | @copy_attachments = params[:copy_attachments].present? || request.get? | |
445 | @copy_subtasks = params[:copy_subtasks].present? || request.get? |
|
451 | @copy_subtasks = params[:copy_subtasks].present? || request.get? | |
446 | @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks, :link => @link_copy) |
|
452 | @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks, :link => @link_copy) | |
447 | @issue.parent_issue_id = @copy_from.parent_id |
|
453 | @issue.parent_issue_id = @copy_from.parent_id | |
448 | rescue ActiveRecord::RecordNotFound |
|
454 | rescue ActiveRecord::RecordNotFound | |
449 | render_404 |
|
455 | render_404 | |
450 | return |
|
456 | return | |
451 | end |
|
457 | end | |
452 | end |
|
458 | end | |
453 | @issue.project = @project |
|
459 | @issue.project = @project | |
454 | if request.get? |
|
460 | if request.get? | |
455 | @issue.project ||= @issue.allowed_target_projects.first |
|
461 | @issue.project ||= @issue.allowed_target_projects.first | |
456 | end |
|
462 | end | |
457 | @issue.author ||= User.current |
|
463 | @issue.author ||= User.current | |
458 | @issue.start_date ||= User.current.today if Setting.default_issue_start_date_to_creation_date? |
|
464 | @issue.start_date ||= User.current.today if Setting.default_issue_start_date_to_creation_date? | |
459 |
|
465 | |||
460 | attrs = (params[:issue] || {}).deep_dup |
|
466 | attrs = (params[:issue] || {}).deep_dup | |
461 | if action_name == 'new' && params[:was_default_status] == attrs[:status_id] |
|
467 | if action_name == 'new' && params[:was_default_status] == attrs[:status_id] | |
462 | attrs.delete(:status_id) |
|
468 | attrs.delete(:status_id) | |
463 | end |
|
469 | end | |
464 | if action_name == 'new' && params[:form_update_triggered_by] == 'issue_project_id' |
|
470 | if action_name == 'new' && params[:form_update_triggered_by] == 'issue_project_id' | |
465 | # Discard submitted version when changing the project on the issue form |
|
471 | # Discard submitted version when changing the project on the issue form | |
466 | # so we can use the default version for the new project |
|
472 | # so we can use the default version for the new project | |
467 | attrs.delete(:fixed_version_id) |
|
473 | attrs.delete(:fixed_version_id) | |
468 | end |
|
474 | end | |
469 | @issue.safe_attributes = attrs |
|
475 | @issue.safe_attributes = attrs | |
470 |
|
476 | |||
471 | if @issue.project |
|
477 | if @issue.project | |
472 | @issue.tracker ||= @issue.allowed_target_trackers.first |
|
478 | @issue.tracker ||= @issue.allowed_target_trackers.first | |
473 | if @issue.tracker.nil? |
|
479 | if @issue.tracker.nil? | |
474 | if @issue.project.trackers.any? |
|
480 | if @issue.project.trackers.any? | |
475 | # None of the project trackers is allowed to the user |
|
481 | # None of the project trackers is allowed to the user | |
476 | render_error :message => l(:error_no_tracker_allowed_for_new_issue_in_project), :status => 403 |
|
482 | render_error :message => l(:error_no_tracker_allowed_for_new_issue_in_project), :status => 403 | |
477 | else |
|
483 | else | |
478 | # Project has no trackers |
|
484 | # Project has no trackers | |
479 | render_error l(:error_no_tracker_in_project) |
|
485 | render_error l(:error_no_tracker_in_project) | |
480 | end |
|
486 | end | |
481 | return false |
|
487 | return false | |
482 | end |
|
488 | end | |
483 | if @issue.status.nil? |
|
489 | if @issue.status.nil? | |
484 | render_error l(:error_no_default_issue_status) |
|
490 | render_error l(:error_no_default_issue_status) | |
485 | return false |
|
491 | return false | |
486 | end |
|
492 | end | |
487 | else |
|
493 | elsif request.get? | |
488 | render_error :message => l(:error_no_projects_with_tracker_allowed_for_new_issue), :status => 403 |
|
494 | render_error :message => l(:error_no_projects_with_tracker_allowed_for_new_issue), :status => 403 | |
489 | return false |
|
495 | return false | |
490 | end |
|
496 | end | |
491 |
|
497 | |||
492 | @priorities = IssuePriority.active |
|
498 | @priorities = IssuePriority.active | |
493 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) |
|
499 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) | |
494 | end |
|
500 | end | |
495 |
|
501 | |||
496 | # Saves @issue and a time_entry from the parameters |
|
502 | # Saves @issue and a time_entry from the parameters | |
497 | def save_issue_with_child_records |
|
503 | def save_issue_with_child_records | |
498 | Issue.transaction do |
|
504 | Issue.transaction do | |
499 | if params[:time_entry] && (params[:time_entry][:hours].present? || params[:time_entry][:comments].present?) && User.current.allowed_to?(:log_time, @issue.project) |
|
505 | if params[:time_entry] && (params[:time_entry][:hours].present? || params[:time_entry][:comments].present?) && User.current.allowed_to?(:log_time, @issue.project) | |
500 | time_entry = @time_entry || TimeEntry.new |
|
506 | time_entry = @time_entry || TimeEntry.new | |
501 | time_entry.project = @issue.project |
|
507 | time_entry.project = @issue.project | |
502 | time_entry.issue = @issue |
|
508 | time_entry.issue = @issue | |
503 | time_entry.user = User.current |
|
509 | time_entry.user = User.current | |
504 | time_entry.spent_on = User.current.today |
|
510 | time_entry.spent_on = User.current.today | |
505 | time_entry.attributes = params[:time_entry] |
|
511 | time_entry.attributes = params[:time_entry] | |
506 | @issue.time_entries << time_entry |
|
512 | @issue.time_entries << time_entry | |
507 | end |
|
513 | end | |
508 |
|
514 | |||
509 | call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal}) |
|
515 | call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal}) | |
510 | if @issue.save |
|
516 | if @issue.save | |
511 | call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal}) |
|
517 | call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal}) | |
512 | else |
|
518 | else | |
513 | raise ActiveRecord::Rollback |
|
519 | raise ActiveRecord::Rollback | |
514 | end |
|
520 | end | |
515 | end |
|
521 | end | |
516 | end |
|
522 | end | |
517 |
|
523 | |||
518 | # Returns true if the issue copy should be linked |
|
524 | # Returns true if the issue copy should be linked | |
519 | # to the original issue |
|
525 | # to the original issue | |
520 | def link_copy?(param) |
|
526 | def link_copy?(param) | |
521 | case Setting.link_copied_issue |
|
527 | case Setting.link_copied_issue | |
522 | when 'yes' |
|
528 | when 'yes' | |
523 | true |
|
529 | true | |
524 | when 'no' |
|
530 | when 'no' | |
525 | false |
|
531 | false | |
526 | when 'ask' |
|
532 | when 'ask' | |
527 | param == '1' |
|
533 | param == '1' | |
528 | end |
|
534 | end | |
529 | end |
|
535 | end | |
530 |
|
536 | |||
531 | # Redirects user after a successful issue creation |
|
537 | # Redirects user after a successful issue creation | |
532 | def redirect_after_create |
|
538 | def redirect_after_create | |
533 | if params[:continue] |
|
539 | if params[:continue] | |
534 | attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} |
|
540 | attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} | |
535 | if params[:project_id] |
|
541 | if params[:project_id] | |
536 | redirect_to new_project_issue_path(@issue.project, :issue => attrs) |
|
542 | redirect_to new_project_issue_path(@issue.project, :issue => attrs) | |
537 | else |
|
543 | else | |
538 | attrs.merge! :project_id => @issue.project_id |
|
544 | attrs.merge! :project_id => @issue.project_id | |
539 | redirect_to new_issue_path(:issue => attrs) |
|
545 | redirect_to new_issue_path(:issue => attrs) | |
540 | end |
|
546 | end | |
541 | else |
|
547 | else | |
542 | redirect_to issue_path(@issue) |
|
548 | redirect_to issue_path(@issue) | |
543 | end |
|
549 | end | |
544 | end |
|
550 | end | |
545 | end |
|
551 | end |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now