##// END OF EJS Templates
Refactor: Extracted saving logic out of #update and into a utility method...
Eric Davis -
r3383:ddec53b9a247
parent child
Show More
@@ -1,582 +1,587
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2008 Jean-Philippe Lang
2 # Copyright (C) 2006-2008 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 menu_item :new_issue, :only => :new
19 menu_item :new_issue, :only => :new
20 default_search_scope :issues
20 default_search_scope :issues
21
21
22 before_filter :find_issue, :only => [:show, :edit, :update, :reply]
22 before_filter :find_issue, :only => [:show, :edit, :update, :reply]
23 before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
23 before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
24 before_filter :find_project, :only => [:new, :update_form, :preview]
24 before_filter :find_project, :only => [:new, :update_form, :preview]
25 before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :context_menu]
25 before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :context_menu]
26 before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
26 before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
27 accept_key_auth :index, :show, :changes
27 accept_key_auth :index, :show, :changes
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 include ProjectsHelper
33 include ProjectsHelper
34 helper :custom_fields
34 helper :custom_fields
35 include CustomFieldsHelper
35 include CustomFieldsHelper
36 helper :issue_relations
36 helper :issue_relations
37 include IssueRelationsHelper
37 include IssueRelationsHelper
38 helper :watchers
38 helper :watchers
39 include WatchersHelper
39 include WatchersHelper
40 helper :attachments
40 helper :attachments
41 include AttachmentsHelper
41 include AttachmentsHelper
42 helper :queries
42 helper :queries
43 include QueriesHelper
43 include QueriesHelper
44 helper :sort
44 helper :sort
45 include SortHelper
45 include SortHelper
46 include IssuesHelper
46 include IssuesHelper
47 helper :timelog
47 helper :timelog
48 include Redmine::Export::PDF
48 include Redmine::Export::PDF
49
49
50 verify :method => [:post, :delete],
50 verify :method => [:post, :delete],
51 :only => :destroy,
51 :only => :destroy,
52 :render => { :nothing => true, :status => :method_not_allowed }
52 :render => { :nothing => true, :status => :method_not_allowed }
53
53
54 def index
54 def index
55 retrieve_query
55 retrieve_query
56 sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
56 sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
57 sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.available_columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h}))
57 sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.available_columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h}))
58
58
59 if @query.valid?
59 if @query.valid?
60 limit = case params[:format]
60 limit = case params[:format]
61 when 'csv', 'pdf'
61 when 'csv', 'pdf'
62 Setting.issues_export_limit.to_i
62 Setting.issues_export_limit.to_i
63 when 'atom'
63 when 'atom'
64 Setting.feeds_limit.to_i
64 Setting.feeds_limit.to_i
65 else
65 else
66 per_page_option
66 per_page_option
67 end
67 end
68
68
69 @issue_count = @query.issue_count
69 @issue_count = @query.issue_count
70 @issue_pages = Paginator.new self, @issue_count, limit, params['page']
70 @issue_pages = Paginator.new self, @issue_count, limit, params['page']
71 @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
71 @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
72 :order => sort_clause,
72 :order => sort_clause,
73 :offset => @issue_pages.current.offset,
73 :offset => @issue_pages.current.offset,
74 :limit => limit)
74 :limit => limit)
75 @issue_count_by_group = @query.issue_count_by_group
75 @issue_count_by_group = @query.issue_count_by_group
76
76
77 respond_to do |format|
77 respond_to do |format|
78 format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? }
78 format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? }
79 format.xml { render :layout => false }
79 format.xml { render :layout => false }
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(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') }
81 format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') }
82 format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') }
82 format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') }
83 end
83 end
84 else
84 else
85 # Send html if the query is not valid
85 # Send html if the query is not valid
86 render(:template => 'issues/index.rhtml', :layout => !request.xhr?)
86 render(:template => 'issues/index.rhtml', :layout => !request.xhr?)
87 end
87 end
88 rescue ActiveRecord::RecordNotFound
88 rescue ActiveRecord::RecordNotFound
89 render_404
89 render_404
90 end
90 end
91
91
92 def changes
92 def changes
93 retrieve_query
93 retrieve_query
94 sort_init 'id', 'desc'
94 sort_init 'id', 'desc'
95 sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.available_columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h}))
95 sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.available_columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h}))
96
96
97 if @query.valid?
97 if @query.valid?
98 @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC",
98 @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC",
99 :limit => 25)
99 :limit => 25)
100 end
100 end
101 @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name)
101 @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name)
102 render :layout => false, :content_type => 'application/atom+xml'
102 render :layout => false, :content_type => 'application/atom+xml'
103 rescue ActiveRecord::RecordNotFound
103 rescue ActiveRecord::RecordNotFound
104 render_404
104 render_404
105 end
105 end
106
106
107 def show
107 def show
108 @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC")
108 @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC")
109 @journals.each_with_index {|j,i| j.indice = i+1}
109 @journals.each_with_index {|j,i| j.indice = i+1}
110 @journals.reverse! if User.current.wants_comments_in_reverse_order?
110 @journals.reverse! if User.current.wants_comments_in_reverse_order?
111 @changesets = @issue.changesets.visible.all
111 @changesets = @issue.changesets.visible.all
112 @changesets.reverse! if User.current.wants_comments_in_reverse_order?
112 @changesets.reverse! if User.current.wants_comments_in_reverse_order?
113 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
113 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
114 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
114 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
115 @priorities = IssuePriority.all
115 @priorities = IssuePriority.all
116 @time_entry = TimeEntry.new
116 @time_entry = TimeEntry.new
117 respond_to do |format|
117 respond_to do |format|
118 format.html { render :template => 'issues/show.rhtml' }
118 format.html { render :template => 'issues/show.rhtml' }
119 format.xml { render :layout => false }
119 format.xml { render :layout => false }
120 format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }
120 format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }
121 format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
121 format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
122 end
122 end
123 end
123 end
124
124
125 # Add a new issue
125 # Add a new issue
126 # The new issue will be created from an existing one if copy_from parameter is given
126 # The new issue will be created from an existing one if copy_from parameter is given
127 def new
127 def new
128 @issue = Issue.new
128 @issue = Issue.new
129 @issue.copy_from(params[:copy_from]) if params[:copy_from]
129 @issue.copy_from(params[:copy_from]) if params[:copy_from]
130 @issue.project = @project
130 @issue.project = @project
131 # Tracker must be set before custom field values
131 # Tracker must be set before custom field values
132 @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
132 @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
133 if @issue.tracker.nil?
133 if @issue.tracker.nil?
134 render_error l(:error_no_tracker_in_project)
134 render_error l(:error_no_tracker_in_project)
135 return
135 return
136 end
136 end
137 if params[:issue].is_a?(Hash)
137 if params[:issue].is_a?(Hash)
138 @issue.safe_attributes = params[:issue]
138 @issue.safe_attributes = params[:issue]
139 @issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)
139 @issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)
140 end
140 end
141 @issue.author = User.current
141 @issue.author = User.current
142
142
143 default_status = IssueStatus.default
143 default_status = IssueStatus.default
144 unless default_status
144 unless default_status
145 render_error l(:error_no_default_issue_status)
145 render_error l(:error_no_default_issue_status)
146 return
146 return
147 end
147 end
148 @issue.status = default_status
148 @issue.status = default_status
149 @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq
149 @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq
150
150
151 if request.get? || request.xhr?
151 if request.get? || request.xhr?
152 @issue.start_date ||= Date.today
152 @issue.start_date ||= Date.today
153 else
153 else
154 requested_status = IssueStatus.find_by_id(params[:issue][:status_id])
154 requested_status = IssueStatus.find_by_id(params[:issue][:status_id])
155 # Check that the user is allowed to apply the requested status
155 # Check that the user is allowed to apply the requested status
156 @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status
156 @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status
157 call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
157 call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
158 if @issue.save
158 if @issue.save
159 attach_files(@issue, params[:attachments])
159 attach_files(@issue, params[:attachments])
160 flash[:notice] = l(:notice_successful_create)
160 flash[:notice] = l(:notice_successful_create)
161 call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
161 call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
162 respond_to do |format|
162 respond_to do |format|
163 format.html {
163 format.html {
164 redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker } :
164 redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker } :
165 { :action => 'show', :id => @issue })
165 { :action => 'show', :id => @issue })
166 }
166 }
167 format.xml { render :action => 'show', :status => :created, :location => url_for(:controller => 'issues', :action => 'show', :id => @issue) }
167 format.xml { render :action => 'show', :status => :created, :location => url_for(:controller => 'issues', :action => 'show', :id => @issue) }
168 end
168 end
169 return
169 return
170 else
170 else
171 respond_to do |format|
171 respond_to do |format|
172 format.html { }
172 format.html { }
173 format.xml { render(:xml => @issue.errors, :status => :unprocessable_entity); return }
173 format.xml { render(:xml => @issue.errors, :status => :unprocessable_entity); return }
174 end
174 end
175 end
175 end
176 end
176 end
177 @priorities = IssuePriority.all
177 @priorities = IssuePriority.all
178 render :layout => !request.xhr?
178 render :layout => !request.xhr?
179 end
179 end
180
180
181 # Attributes that can be updated on workflow transition (without :edit permission)
181 # Attributes that can be updated on workflow transition (without :edit permission)
182 # TODO: make it configurable (at least per role)
182 # TODO: make it configurable (at least per role)
183 UPDATABLE_ATTRS_ON_TRANSITION = %w(status_id assigned_to_id fixed_version_id done_ratio) unless const_defined?(:UPDATABLE_ATTRS_ON_TRANSITION)
183 UPDATABLE_ATTRS_ON_TRANSITION = %w(status_id assigned_to_id fixed_version_id done_ratio) unless const_defined?(:UPDATABLE_ATTRS_ON_TRANSITION)
184
184
185 def edit
185 def edit
186 update_issue_from_params
186 update_issue_from_params
187
187
188 respond_to do |format|
188 respond_to do |format|
189 format.html { }
189 format.html { }
190 format.xml { }
190 format.xml { }
191 end
191 end
192 end
192 end
193
193
194 #--
195 # Start converting to the Rails REST controllers
196 #++
197 def update
194 def update
198 update_issue_from_params
195 update_issue_from_params
199
196
200 if request.get?
197 if issue_update
201 # nop
202 else
203 @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today)
204 @time_entry.attributes = params[:time_entry]
205 if (@time_entry.hours.nil? || @time_entry.valid?) && @issue.valid?
206 attachments = attach_files(@issue, params[:attachments])
207 attachments.each {|a| @journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)}
208 call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
209 if @issue.save
210 # Log spend time
211 if User.current.allowed_to?(:log_time, @project)
212 @time_entry.save
213 end
214 if !@journal.new_record?
215 # Only send notification if something was actually changed
216 flash[:notice] = l(:notice_successful_update)
217 end
218 call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
219 respond_to do |format|
198 respond_to do |format|
220 format.html { redirect_back_or_default({:action => 'show', :id => @issue}) }
199 format.html { redirect_back_or_default({:action => 'show', :id => @issue}) }
221 format.xml { head :ok }
200 format.xml { head :ok }
222 end
201 end
223 return
202 else
224 end
225 end
226 # failure
227 respond_to do |format|
203 respond_to do |format|
228 format.html { render :action => 'edit' }
204 format.html { render :action => 'edit' }
229 format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }
205 format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }
230 end
206 end
231 end
207 end
208
232 rescue ActiveRecord::StaleObjectError
209 rescue ActiveRecord::StaleObjectError
233 # Optimistic locking exception
210 # Optimistic locking exception
234 flash.now[:error] = l(:notice_locking_conflict)
211 flash.now[:error] = l(:notice_locking_conflict)
235 # Remove the previously added attachments if issue was not updated
212 # Remove the previously added attachments if issue was not updated
236 attachments.each(&:destroy)
213 attachments.each(&:destroy)
237 end
214 end
238
215
239 def reply
216 def reply
240 journal = Journal.find(params[:journal_id]) if params[:journal_id]
217 journal = Journal.find(params[:journal_id]) if params[:journal_id]
241 if journal
218 if journal
242 user = journal.user
219 user = journal.user
243 text = journal.notes
220 text = journal.notes
244 else
221 else
245 user = @issue.author
222 user = @issue.author
246 text = @issue.description
223 text = @issue.description
247 end
224 end
248 content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
225 content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
249 content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
226 content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
250 render(:update) { |page|
227 render(:update) { |page|
251 page.<< "$('notes').value = \"#{content}\";"
228 page.<< "$('notes').value = \"#{content}\";"
252 page.show 'update'
229 page.show 'update'
253 page << "Form.Element.focus('notes');"
230 page << "Form.Element.focus('notes');"
254 page << "Element.scrollTo('update');"
231 page << "Element.scrollTo('update');"
255 page << "$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;"
232 page << "$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;"
256 }
233 }
257 end
234 end
258
235
259 # Bulk edit a set of issues
236 # Bulk edit a set of issues
260 def bulk_edit
237 def bulk_edit
261 if request.post?
238 if request.post?
262 attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
239 attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
263 attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
240 attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
264 attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values]
241 attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values]
265
242
266 unsaved_issue_ids = []
243 unsaved_issue_ids = []
267 @issues.each do |issue|
244 @issues.each do |issue|
268 journal = issue.init_journal(User.current, params[:notes])
245 journal = issue.init_journal(User.current, params[:notes])
269 issue.safe_attributes = attributes
246 issue.safe_attributes = attributes
270 call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
247 call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
271 unless issue.save
248 unless issue.save
272 # Keep unsaved issue ids to display them in flash error
249 # Keep unsaved issue ids to display them in flash error
273 unsaved_issue_ids << issue.id
250 unsaved_issue_ids << issue.id
274 end
251 end
275 end
252 end
276 if unsaved_issue_ids.empty?
253 if unsaved_issue_ids.empty?
277 flash[:notice] = l(:notice_successful_update) unless @issues.empty?
254 flash[:notice] = l(:notice_successful_update) unless @issues.empty?
278 else
255 else
279 flash[:error] = l(:notice_failed_to_save_issues, :count => unsaved_issue_ids.size,
256 flash[:error] = l(:notice_failed_to_save_issues, :count => unsaved_issue_ids.size,
280 :total => @issues.size,
257 :total => @issues.size,
281 :ids => '#' + unsaved_issue_ids.join(', #'))
258 :ids => '#' + unsaved_issue_ids.join(', #'))
282 end
259 end
283 redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project})
260 redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project})
284 return
261 return
285 end
262 end
286 @available_statuses = Workflow.available_statuses(@project)
263 @available_statuses = Workflow.available_statuses(@project)
287 @custom_fields = @project.all_issue_custom_fields
264 @custom_fields = @project.all_issue_custom_fields
288 end
265 end
289
266
290 def move
267 def move
291 @copy = params[:copy_options] && params[:copy_options][:copy]
268 @copy = params[:copy_options] && params[:copy_options][:copy]
292 @allowed_projects = []
269 @allowed_projects = []
293 # find projects to which the user is allowed to move the issue
270 # find projects to which the user is allowed to move the issue
294 if User.current.admin?
271 if User.current.admin?
295 # admin is allowed to move issues to any active (visible) project
272 # admin is allowed to move issues to any active (visible) project
296 @allowed_projects = Project.find(:all, :conditions => Project.visible_by(User.current))
273 @allowed_projects = Project.find(:all, :conditions => Project.visible_by(User.current))
297 else
274 else
298 User.current.memberships.each {|m| @allowed_projects << m.project if m.roles.detect {|r| r.allowed_to?(:move_issues)}}
275 User.current.memberships.each {|m| @allowed_projects << m.project if m.roles.detect {|r| r.allowed_to?(:move_issues)}}
299 end
276 end
300 @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
277 @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
301 @target_project ||= @project
278 @target_project ||= @project
302 @trackers = @target_project.trackers
279 @trackers = @target_project.trackers
303 @available_statuses = Workflow.available_statuses(@project)
280 @available_statuses = Workflow.available_statuses(@project)
304 if request.post?
281 if request.post?
305 new_tracker = params[:new_tracker_id].blank? ? nil : @target_project.trackers.find_by_id(params[:new_tracker_id])
282 new_tracker = params[:new_tracker_id].blank? ? nil : @target_project.trackers.find_by_id(params[:new_tracker_id])
306 unsaved_issue_ids = []
283 unsaved_issue_ids = []
307 moved_issues = []
284 moved_issues = []
308 @issues.each do |issue|
285 @issues.each do |issue|
309 changed_attributes = {}
286 changed_attributes = {}
310 [:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute|
287 [:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute|
311 unless params[valid_attribute].blank?
288 unless params[valid_attribute].blank?
312 changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute])
289 changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute])
313 end
290 end
314 end
291 end
315 issue.init_journal(User.current)
292 issue.init_journal(User.current)
316 call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy })
293 call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy })
317 if r = issue.move_to(@target_project, new_tracker, {:copy => @copy, :attributes => changed_attributes})
294 if r = issue.move_to(@target_project, new_tracker, {:copy => @copy, :attributes => changed_attributes})
318 moved_issues << r
295 moved_issues << r
319 else
296 else
320 unsaved_issue_ids << issue.id
297 unsaved_issue_ids << issue.id
321 end
298 end
322 end
299 end
323 if unsaved_issue_ids.empty?
300 if unsaved_issue_ids.empty?
324 flash[:notice] = l(:notice_successful_update) unless @issues.empty?
301 flash[:notice] = l(:notice_successful_update) unless @issues.empty?
325 else
302 else
326 flash[:error] = l(:notice_failed_to_save_issues, :count => unsaved_issue_ids.size,
303 flash[:error] = l(:notice_failed_to_save_issues, :count => unsaved_issue_ids.size,
327 :total => @issues.size,
304 :total => @issues.size,
328 :ids => '#' + unsaved_issue_ids.join(', #'))
305 :ids => '#' + unsaved_issue_ids.join(', #'))
329 end
306 end
330 if params[:follow]
307 if params[:follow]
331 if @issues.size == 1 && moved_issues.size == 1
308 if @issues.size == 1 && moved_issues.size == 1
332 redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
309 redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
333 else
310 else
334 redirect_to :controller => 'issues', :action => 'index', :project_id => (@target_project || @project)
311 redirect_to :controller => 'issues', :action => 'index', :project_id => (@target_project || @project)
335 end
312 end
336 else
313 else
337 redirect_to :controller => 'issues', :action => 'index', :project_id => @project
314 redirect_to :controller => 'issues', :action => 'index', :project_id => @project
338 end
315 end
339 return
316 return
340 end
317 end
341 render :layout => false if request.xhr?
318 render :layout => false if request.xhr?
342 end
319 end
343
320
344 def destroy
321 def destroy
345 @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
322 @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
346 if @hours > 0
323 if @hours > 0
347 case params[:todo]
324 case params[:todo]
348 when 'destroy'
325 when 'destroy'
349 # nothing to do
326 # nothing to do
350 when 'nullify'
327 when 'nullify'
351 TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues])
328 TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues])
352 when 'reassign'
329 when 'reassign'
353 reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
330 reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
354 if reassign_to.nil?
331 if reassign_to.nil?
355 flash.now[:error] = l(:error_issue_not_found_in_project)
332 flash.now[:error] = l(:error_issue_not_found_in_project)
356 return
333 return
357 else
334 else
358 TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues])
335 TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues])
359 end
336 end
360 else
337 else
361 unless params[:format] == 'xml'
338 unless params[:format] == 'xml'
362 # display the destroy form if it's a user request
339 # display the destroy form if it's a user request
363 return
340 return
364 end
341 end
365 end
342 end
366 end
343 end
367 @issues.each(&:destroy)
344 @issues.each(&:destroy)
368 respond_to do |format|
345 respond_to do |format|
369 format.html { redirect_to :action => 'index', :project_id => @project }
346 format.html { redirect_to :action => 'index', :project_id => @project }
370 format.xml { head :ok }
347 format.xml { head :ok }
371 end
348 end
372 end
349 end
373
350
374 def gantt
351 def gantt
375 @gantt = Redmine::Helpers::Gantt.new(params)
352 @gantt = Redmine::Helpers::Gantt.new(params)
376 retrieve_query
353 retrieve_query
377 @query.group_by = nil
354 @query.group_by = nil
378 if @query.valid?
355 if @query.valid?
379 events = []
356 events = []
380 # Issues that have start and due dates
357 # Issues that have start and due dates
381 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
358 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
382 :order => "start_date, due_date",
359 :order => "start_date, due_date",
383 :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
360 :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
384 )
361 )
385 # Issues that don't have a due date but that are assigned to a version with a date
362 # Issues that don't have a due date but that are assigned to a version with a date
386 events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
363 events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
387 :order => "start_date, effective_date",
364 :order => "start_date, effective_date",
388 :conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
365 :conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
389 )
366 )
390 # Versions
367 # Versions
391 events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @gantt.date_from, @gantt.date_to])
368 events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @gantt.date_from, @gantt.date_to])
392
369
393 @gantt.events = events
370 @gantt.events = events
394 end
371 end
395
372
396 basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
373 basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
397
374
398 respond_to do |format|
375 respond_to do |format|
399 format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
376 format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
400 format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
377 format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
401 format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
378 format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
402 end
379 end
403 end
380 end
404
381
405 def calendar
382 def calendar
406 if params[:year] and params[:year].to_i > 1900
383 if params[:year] and params[:year].to_i > 1900
407 @year = params[:year].to_i
384 @year = params[:year].to_i
408 if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
385 if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
409 @month = params[:month].to_i
386 @month = params[:month].to_i
410 end
387 end
411 end
388 end
412 @year ||= Date.today.year
389 @year ||= Date.today.year
413 @month ||= Date.today.month
390 @month ||= Date.today.month
414
391
415 @calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
392 @calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
416 retrieve_query
393 retrieve_query
417 @query.group_by = nil
394 @query.group_by = nil
418 if @query.valid?
395 if @query.valid?
419 events = []
396 events = []
420 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
397 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
421 :conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
398 :conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
422 )
399 )
423 events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
400 events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
424
401
425 @calendar.events = events
402 @calendar.events = events
426 end
403 end
427
404
428 render :layout => false if request.xhr?
405 render :layout => false if request.xhr?
429 end
406 end
430
407
431 def context_menu
408 def context_menu
432 @issues = Issue.find_all_by_id(params[:ids], :include => :project)
409 @issues = Issue.find_all_by_id(params[:ids], :include => :project)
433 if (@issues.size == 1)
410 if (@issues.size == 1)
434 @issue = @issues.first
411 @issue = @issues.first
435 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
412 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
436 end
413 end
437 projects = @issues.collect(&:project).compact.uniq
414 projects = @issues.collect(&:project).compact.uniq
438 @project = projects.first if projects.size == 1
415 @project = projects.first if projects.size == 1
439
416
440 @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
417 @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
441 :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
418 :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
442 :update => (@project && (User.current.allowed_to?(:edit_issues, @project) || (User.current.allowed_to?(:change_status, @project) && @allowed_statuses && !@allowed_statuses.empty?))),
419 :update => (@project && (User.current.allowed_to?(:edit_issues, @project) || (User.current.allowed_to?(:change_status, @project) && @allowed_statuses && !@allowed_statuses.empty?))),
443 :move => (@project && User.current.allowed_to?(:move_issues, @project)),
420 :move => (@project && User.current.allowed_to?(:move_issues, @project)),
444 :copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
421 :copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
445 :delete => (@project && User.current.allowed_to?(:delete_issues, @project))
422 :delete => (@project && User.current.allowed_to?(:delete_issues, @project))
446 }
423 }
447 if @project
424 if @project
448 @assignables = @project.assignable_users
425 @assignables = @project.assignable_users
449 @assignables << @issue.assigned_to if @issue && @issue.assigned_to && !@assignables.include?(@issue.assigned_to)
426 @assignables << @issue.assigned_to if @issue && @issue.assigned_to && !@assignables.include?(@issue.assigned_to)
450 @trackers = @project.trackers
427 @trackers = @project.trackers
451 end
428 end
452
429
453 @priorities = IssuePriority.all.reverse
430 @priorities = IssuePriority.all.reverse
454 @statuses = IssueStatus.find(:all, :order => 'position')
431 @statuses = IssueStatus.find(:all, :order => 'position')
455 @back = params[:back_url] || request.env['HTTP_REFERER']
432 @back = params[:back_url] || request.env['HTTP_REFERER']
456
433
457 render :layout => false
434 render :layout => false
458 end
435 end
459
436
460 def update_form
437 def update_form
461 if params[:id].blank?
438 if params[:id].blank?
462 @issue = Issue.new
439 @issue = Issue.new
463 @issue.project = @project
440 @issue.project = @project
464 else
441 else
465 @issue = @project.issues.visible.find(params[:id])
442 @issue = @project.issues.visible.find(params[:id])
466 end
443 end
467 @issue.attributes = params[:issue]
444 @issue.attributes = params[:issue]
468 @allowed_statuses = ([@issue.status] + @issue.status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq
445 @allowed_statuses = ([@issue.status] + @issue.status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq
469 @priorities = IssuePriority.all
446 @priorities = IssuePriority.all
470
447
471 render :partial => 'attributes'
448 render :partial => 'attributes'
472 end
449 end
473
450
474 def preview
451 def preview
475 @issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank?
452 @issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank?
476 @attachements = @issue.attachments if @issue
453 @attachements = @issue.attachments if @issue
477 @text = params[:notes] || (params[:issue] ? params[:issue][:description] : nil)
454 @text = params[:notes] || (params[:issue] ? params[:issue][:description] : nil)
478 render :partial => 'common/preview'
455 render :partial => 'common/preview'
479 end
456 end
480
457
481 private
458 private
482 def find_issue
459 def find_issue
483 @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category])
460 @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category])
484 @project = @issue.project
461 @project = @issue.project
485 rescue ActiveRecord::RecordNotFound
462 rescue ActiveRecord::RecordNotFound
486 render_404
463 render_404
487 end
464 end
488
465
489 # Filter for bulk operations
466 # Filter for bulk operations
490 def find_issues
467 def find_issues
491 @issues = Issue.find_all_by_id(params[:id] || params[:ids])
468 @issues = Issue.find_all_by_id(params[:id] || params[:ids])
492 raise ActiveRecord::RecordNotFound if @issues.empty?
469 raise ActiveRecord::RecordNotFound if @issues.empty?
493 projects = @issues.collect(&:project).compact.uniq
470 projects = @issues.collect(&:project).compact.uniq
494 if projects.size == 1
471 if projects.size == 1
495 @project = projects.first
472 @project = projects.first
496 else
473 else
497 # TODO: let users bulk edit/move/destroy issues from different projects
474 # TODO: let users bulk edit/move/destroy issues from different projects
498 render_error 'Can not bulk edit/move/destroy issues from different projects'
475 render_error 'Can not bulk edit/move/destroy issues from different projects'
499 return false
476 return false
500 end
477 end
501 rescue ActiveRecord::RecordNotFound
478 rescue ActiveRecord::RecordNotFound
502 render_404
479 render_404
503 end
480 end
504
481
505 def find_project
482 def find_project
506 project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
483 project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
507 @project = Project.find(project_id)
484 @project = Project.find(project_id)
508 rescue ActiveRecord::RecordNotFound
485 rescue ActiveRecord::RecordNotFound
509 render_404
486 render_404
510 end
487 end
511
488
512 def find_optional_project
489 def find_optional_project
513 @project = Project.find(params[:project_id]) unless params[:project_id].blank?
490 @project = Project.find(params[:project_id]) unless params[:project_id].blank?
514 allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
491 allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
515 allowed ? true : deny_access
492 allowed ? true : deny_access
516 rescue ActiveRecord::RecordNotFound
493 rescue ActiveRecord::RecordNotFound
517 render_404
494 render_404
518 end
495 end
519
496
520 # Retrieve query from session or build a new query
497 # Retrieve query from session or build a new query
521 def retrieve_query
498 def retrieve_query
522 if !params[:query_id].blank?
499 if !params[:query_id].blank?
523 cond = "project_id IS NULL"
500 cond = "project_id IS NULL"
524 cond << " OR project_id = #{@project.id}" if @project
501 cond << " OR project_id = #{@project.id}" if @project
525 @query = Query.find(params[:query_id], :conditions => cond)
502 @query = Query.find(params[:query_id], :conditions => cond)
526 @query.project = @project
503 @query.project = @project
527 session[:query] = {:id => @query.id, :project_id => @query.project_id}
504 session[:query] = {:id => @query.id, :project_id => @query.project_id}
528 sort_clear
505 sort_clear
529 else
506 else
530 if api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)
507 if api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)
531 # Give it a name, required to be valid
508 # Give it a name, required to be valid
532 @query = Query.new(:name => "_")
509 @query = Query.new(:name => "_")
533 @query.project = @project
510 @query.project = @project
534 if params[:fields] and params[:fields].is_a? Array
511 if params[:fields] and params[:fields].is_a? Array
535 params[:fields].each do |field|
512 params[:fields].each do |field|
536 @query.add_filter(field, params[:operators][field], params[:values][field])
513 @query.add_filter(field, params[:operators][field], params[:values][field])
537 end
514 end
538 else
515 else
539 @query.available_filters.keys.each do |field|
516 @query.available_filters.keys.each do |field|
540 @query.add_short_filter(field, params[field]) if params[field]
517 @query.add_short_filter(field, params[field]) if params[field]
541 end
518 end
542 end
519 end
543 @query.group_by = params[:group_by]
520 @query.group_by = params[:group_by]
544 @query.column_names = params[:query] && params[:query][:column_names]
521 @query.column_names = params[:query] && params[:query][:column_names]
545 session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
522 session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
546 else
523 else
547 @query = Query.find_by_id(session[:query][:id]) if session[:query][:id]
524 @query = Query.find_by_id(session[:query][:id]) if session[:query][:id]
548 @query ||= Query.new(:name => "_", :project => @project, :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names])
525 @query ||= Query.new(:name => "_", :project => @project, :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names])
549 @query.project = @project
526 @query.project = @project
550 end
527 end
551 end
528 end
552 end
529 end
553
530
554 # Rescues an invalid query statement. Just in case...
531 # Rescues an invalid query statement. Just in case...
555 def query_statement_invalid(exception)
532 def query_statement_invalid(exception)
556 logger.error "Query::StatementInvalid: #{exception.message}" if logger
533 logger.error "Query::StatementInvalid: #{exception.message}" if logger
557 session.delete(:query)
534 session.delete(:query)
558 sort_clear
535 sort_clear
559 render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
536 render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
560 end
537 end
561
538
562 # Used by #edit and #update to set some common instance variables
539 # Used by #edit and #update to set some common instance variables
563 # from the params
540 # from the params
564 # TODO: Refactor, not everything in here is needed by #edit
541 # TODO: Refactor, not everything in here is needed by #edit
565 def update_issue_from_params
542 def update_issue_from_params
566 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
543 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
567 @priorities = IssuePriority.all
544 @priorities = IssuePriority.all
568 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
545 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
569 @time_entry = TimeEntry.new
546 @time_entry = TimeEntry.new
570
547
571 @notes = params[:notes]
548 @notes = params[:notes]
572 @journal = @issue.init_journal(User.current, @notes)
549 @journal = @issue.init_journal(User.current, @notes)
573 # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
550 # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
574 if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
551 if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
575 attrs = params[:issue].dup
552 attrs = params[:issue].dup
576 attrs.delete_if {|k,v| !UPDATABLE_ATTRS_ON_TRANSITION.include?(k) } unless @edit_allowed
553 attrs.delete_if {|k,v| !UPDATABLE_ATTRS_ON_TRANSITION.include?(k) } unless @edit_allowed
577 attrs.delete(:status_id) unless @allowed_statuses.detect {|s| s.id.to_s == attrs[:status_id].to_s}
554 attrs.delete(:status_id) unless @allowed_statuses.detect {|s| s.id.to_s == attrs[:status_id].to_s}
578 @issue.safe_attributes = attrs
555 @issue.safe_attributes = attrs
579 end
556 end
580
557
581 end
558 end
559
560 # TODO: Temporary utility method for #update. Should be split off
561 # and moved to the Issue model (accepts_nested_attributes_for maybe?)
562 # TODO: move attach_files to the model so this can be moved to the
563 # model also
564 def issue_update
565 @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today)
566 @time_entry.attributes = params[:time_entry]
567 if (@time_entry.hours.nil? || @time_entry.valid?) && @issue.valid?
568 attachments = attach_files(@issue, params[:attachments])
569 attachments.each {|a| @journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)}
570 call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
571 if @issue.save
572 # Log spend time
573 if User.current.allowed_to?(:log_time, @project)
574 @time_entry.save
575 end
576 if !@journal.new_record?
577 # Only send notification if something was actually changed
578 flash[:notice] = l(:notice_successful_update)
579 end
580 call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
581 return true
582 end
583 end
584 # failure, returns false
585
586 end
582 end
587 end
General Comments 0
You need to be logged in to leave comments. Login now