##// END OF EJS Templates
Refactor: Decouple building Issue and TimeEntry objects in #issue_update....
Eric Davis -
r3405:8699e5bbcd57
parent child
Show More
@@ -1,587 +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 def update
194 def update
195 update_issue_from_params
195 update_issue_from_params
196
196
197 if issue_update
197 if issue_update
198 respond_to do |format|
198 respond_to do |format|
199 format.html { redirect_back_or_default({:action => 'show', :id => @issue}) }
199 format.html { redirect_back_or_default({:action => 'show', :id => @issue}) }
200 format.xml { head :ok }
200 format.xml { head :ok }
201 end
201 end
202 else
202 else
203 respond_to do |format|
203 respond_to do |format|
204 format.html { render :action => 'edit' }
204 format.html { render :action => 'edit' }
205 format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }
205 format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }
206 end
206 end
207 end
207 end
208
208
209 rescue ActiveRecord::StaleObjectError
209 rescue ActiveRecord::StaleObjectError
210 # Optimistic locking exception
210 # Optimistic locking exception
211 flash.now[:error] = l(:notice_locking_conflict)
211 flash.now[:error] = l(:notice_locking_conflict)
212 # Remove the previously added attachments if issue was not updated
212 # Remove the previously added attachments if issue was not updated
213 attachments.each(&:destroy)
213 attachments.each(&:destroy)
214 end
214 end
215
215
216 def reply
216 def reply
217 journal = Journal.find(params[:journal_id]) if params[:journal_id]
217 journal = Journal.find(params[:journal_id]) if params[:journal_id]
218 if journal
218 if journal
219 user = journal.user
219 user = journal.user
220 text = journal.notes
220 text = journal.notes
221 else
221 else
222 user = @issue.author
222 user = @issue.author
223 text = @issue.description
223 text = @issue.description
224 end
224 end
225 content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
225 content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
226 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"
227 render(:update) { |page|
227 render(:update) { |page|
228 page.<< "$('notes').value = \"#{content}\";"
228 page.<< "$('notes').value = \"#{content}\";"
229 page.show 'update'
229 page.show 'update'
230 page << "Form.Element.focus('notes');"
230 page << "Form.Element.focus('notes');"
231 page << "Element.scrollTo('update');"
231 page << "Element.scrollTo('update');"
232 page << "$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;"
232 page << "$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;"
233 }
233 }
234 end
234 end
235
235
236 # Bulk edit a set of issues
236 # Bulk edit a set of issues
237 def bulk_edit
237 def bulk_edit
238 if request.post?
238 if request.post?
239 attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
239 attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
240 attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
240 attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
241 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]
242
242
243 unsaved_issue_ids = []
243 unsaved_issue_ids = []
244 @issues.each do |issue|
244 @issues.each do |issue|
245 journal = issue.init_journal(User.current, params[:notes])
245 journal = issue.init_journal(User.current, params[:notes])
246 issue.safe_attributes = attributes
246 issue.safe_attributes = attributes
247 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 })
248 unless issue.save
248 unless issue.save
249 # Keep unsaved issue ids to display them in flash error
249 # Keep unsaved issue ids to display them in flash error
250 unsaved_issue_ids << issue.id
250 unsaved_issue_ids << issue.id
251 end
251 end
252 end
252 end
253 if unsaved_issue_ids.empty?
253 if unsaved_issue_ids.empty?
254 flash[:notice] = l(:notice_successful_update) unless @issues.empty?
254 flash[:notice] = l(:notice_successful_update) unless @issues.empty?
255 else
255 else
256 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,
257 :total => @issues.size,
257 :total => @issues.size,
258 :ids => '#' + unsaved_issue_ids.join(', #'))
258 :ids => '#' + unsaved_issue_ids.join(', #'))
259 end
259 end
260 redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project})
260 redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project})
261 return
261 return
262 end
262 end
263 @available_statuses = Workflow.available_statuses(@project)
263 @available_statuses = Workflow.available_statuses(@project)
264 @custom_fields = @project.all_issue_custom_fields
264 @custom_fields = @project.all_issue_custom_fields
265 end
265 end
266
266
267 def move
267 def move
268 @copy = params[:copy_options] && params[:copy_options][:copy]
268 @copy = params[:copy_options] && params[:copy_options][:copy]
269 @allowed_projects = []
269 @allowed_projects = []
270 # 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
271 if User.current.admin?
271 if User.current.admin?
272 # admin is allowed to move issues to any active (visible) project
272 # admin is allowed to move issues to any active (visible) project
273 @allowed_projects = Project.find(:all, :conditions => Project.visible_by(User.current))
273 @allowed_projects = Project.find(:all, :conditions => Project.visible_by(User.current))
274 else
274 else
275 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)}}
276 end
276 end
277 @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]
278 @target_project ||= @project
278 @target_project ||= @project
279 @trackers = @target_project.trackers
279 @trackers = @target_project.trackers
280 @available_statuses = Workflow.available_statuses(@project)
280 @available_statuses = Workflow.available_statuses(@project)
281 if request.post?
281 if request.post?
282 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])
283 unsaved_issue_ids = []
283 unsaved_issue_ids = []
284 moved_issues = []
284 moved_issues = []
285 @issues.each do |issue|
285 @issues.each do |issue|
286 changed_attributes = {}
286 changed_attributes = {}
287 [: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|
288 unless params[valid_attribute].blank?
288 unless params[valid_attribute].blank?
289 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])
290 end
290 end
291 end
291 end
292 issue.init_journal(User.current)
292 issue.init_journal(User.current)
293 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 })
294 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})
295 moved_issues << r
295 moved_issues << r
296 else
296 else
297 unsaved_issue_ids << issue.id
297 unsaved_issue_ids << issue.id
298 end
298 end
299 end
299 end
300 if unsaved_issue_ids.empty?
300 if unsaved_issue_ids.empty?
301 flash[:notice] = l(:notice_successful_update) unless @issues.empty?
301 flash[:notice] = l(:notice_successful_update) unless @issues.empty?
302 else
302 else
303 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,
304 :total => @issues.size,
304 :total => @issues.size,
305 :ids => '#' + unsaved_issue_ids.join(', #'))
305 :ids => '#' + unsaved_issue_ids.join(', #'))
306 end
306 end
307 if params[:follow]
307 if params[:follow]
308 if @issues.size == 1 && moved_issues.size == 1
308 if @issues.size == 1 && moved_issues.size == 1
309 redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
309 redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
310 else
310 else
311 redirect_to :controller => 'issues', :action => 'index', :project_id => (@target_project || @project)
311 redirect_to :controller => 'issues', :action => 'index', :project_id => (@target_project || @project)
312 end
312 end
313 else
313 else
314 redirect_to :controller => 'issues', :action => 'index', :project_id => @project
314 redirect_to :controller => 'issues', :action => 'index', :project_id => @project
315 end
315 end
316 return
316 return
317 end
317 end
318 render :layout => false if request.xhr?
318 render :layout => false if request.xhr?
319 end
319 end
320
320
321 def destroy
321 def destroy
322 @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
322 @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
323 if @hours > 0
323 if @hours > 0
324 case params[:todo]
324 case params[:todo]
325 when 'destroy'
325 when 'destroy'
326 # nothing to do
326 # nothing to do
327 when 'nullify'
327 when 'nullify'
328 TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues])
328 TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues])
329 when 'reassign'
329 when 'reassign'
330 reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
330 reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
331 if reassign_to.nil?
331 if reassign_to.nil?
332 flash.now[:error] = l(:error_issue_not_found_in_project)
332 flash.now[:error] = l(:error_issue_not_found_in_project)
333 return
333 return
334 else
334 else
335 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])
336 end
336 end
337 else
337 else
338 unless params[:format] == 'xml'
338 unless params[:format] == 'xml'
339 # display the destroy form if it's a user request
339 # display the destroy form if it's a user request
340 return
340 return
341 end
341 end
342 end
342 end
343 end
343 end
344 @issues.each(&:destroy)
344 @issues.each(&:destroy)
345 respond_to do |format|
345 respond_to do |format|
346 format.html { redirect_to :action => 'index', :project_id => @project }
346 format.html { redirect_to :action => 'index', :project_id => @project }
347 format.xml { head :ok }
347 format.xml { head :ok }
348 end
348 end
349 end
349 end
350
350
351 def gantt
351 def gantt
352 @gantt = Redmine::Helpers::Gantt.new(params)
352 @gantt = Redmine::Helpers::Gantt.new(params)
353 retrieve_query
353 retrieve_query
354 @query.group_by = nil
354 @query.group_by = nil
355 if @query.valid?
355 if @query.valid?
356 events = []
356 events = []
357 # Issues that have start and due dates
357 # Issues that have start and due dates
358 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
358 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
359 :order => "start_date, due_date",
359 :order => "start_date, due_date",
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]
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]
361 )
361 )
362 # 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
363 events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
363 events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
364 :order => "start_date, effective_date",
364 :order => "start_date, effective_date",
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]
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]
366 )
366 )
367 # Versions
367 # Versions
368 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])
369
369
370 @gantt.events = events
370 @gantt.events = events
371 end
371 end
372
372
373 basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
373 basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
374
374
375 respond_to do |format|
375 respond_to do |format|
376 format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
376 format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
377 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')
378 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") }
379 end
379 end
380 end
380 end
381
381
382 def calendar
382 def calendar
383 if params[:year] and params[:year].to_i > 1900
383 if params[:year] and params[:year].to_i > 1900
384 @year = params[:year].to_i
384 @year = params[:year].to_i
385 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
386 @month = params[:month].to_i
386 @month = params[:month].to_i
387 end
387 end
388 end
388 end
389 @year ||= Date.today.year
389 @year ||= Date.today.year
390 @month ||= Date.today.month
390 @month ||= Date.today.month
391
391
392 @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)
393 retrieve_query
393 retrieve_query
394 @query.group_by = nil
394 @query.group_by = nil
395 if @query.valid?
395 if @query.valid?
396 events = []
396 events = []
397 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
397 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
398 :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]
399 )
399 )
400 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])
401
401
402 @calendar.events = events
402 @calendar.events = events
403 end
403 end
404
404
405 render :layout => false if request.xhr?
405 render :layout => false if request.xhr?
406 end
406 end
407
407
408 def context_menu
408 def context_menu
409 @issues = Issue.find_all_by_id(params[:ids], :include => :project)
409 @issues = Issue.find_all_by_id(params[:ids], :include => :project)
410 if (@issues.size == 1)
410 if (@issues.size == 1)
411 @issue = @issues.first
411 @issue = @issues.first
412 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
412 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
413 end
413 end
414 projects = @issues.collect(&:project).compact.uniq
414 projects = @issues.collect(&:project).compact.uniq
415 @project = projects.first if projects.size == 1
415 @project = projects.first if projects.size == 1
416
416
417 @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
417 @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
418 :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
418 :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
419 :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?))),
420 :move => (@project && User.current.allowed_to?(:move_issues, @project)),
420 :move => (@project && User.current.allowed_to?(:move_issues, @project)),
421 :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)),
422 :delete => (@project && User.current.allowed_to?(:delete_issues, @project))
422 :delete => (@project && User.current.allowed_to?(:delete_issues, @project))
423 }
423 }
424 if @project
424 if @project
425 @assignables = @project.assignable_users
425 @assignables = @project.assignable_users
426 @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)
427 @trackers = @project.trackers
427 @trackers = @project.trackers
428 end
428 end
429
429
430 @priorities = IssuePriority.all.reverse
430 @priorities = IssuePriority.all.reverse
431 @statuses = IssueStatus.find(:all, :order => 'position')
431 @statuses = IssueStatus.find(:all, :order => 'position')
432 @back = params[:back_url] || request.env['HTTP_REFERER']
432 @back = params[:back_url] || request.env['HTTP_REFERER']
433
433
434 render :layout => false
434 render :layout => false
435 end
435 end
436
436
437 def update_form
437 def update_form
438 if params[:id].blank?
438 if params[:id].blank?
439 @issue = Issue.new
439 @issue = Issue.new
440 @issue.project = @project
440 @issue.project = @project
441 else
441 else
442 @issue = @project.issues.visible.find(params[:id])
442 @issue = @project.issues.visible.find(params[:id])
443 end
443 end
444 @issue.attributes = params[:issue]
444 @issue.attributes = params[:issue]
445 @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
446 @priorities = IssuePriority.all
446 @priorities = IssuePriority.all
447
447
448 render :partial => 'attributes'
448 render :partial => 'attributes'
449 end
449 end
450
450
451 def preview
451 def preview
452 @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?
453 @attachements = @issue.attachments if @issue
453 @attachements = @issue.attachments if @issue
454 @text = params[:notes] || (params[:issue] ? params[:issue][:description] : nil)
454 @text = params[:notes] || (params[:issue] ? params[:issue][:description] : nil)
455 render :partial => 'common/preview'
455 render :partial => 'common/preview'
456 end
456 end
457
457
458 private
458 private
459 def find_issue
459 def find_issue
460 @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])
461 @project = @issue.project
461 @project = @issue.project
462 rescue ActiveRecord::RecordNotFound
462 rescue ActiveRecord::RecordNotFound
463 render_404
463 render_404
464 end
464 end
465
465
466 # Filter for bulk operations
466 # Filter for bulk operations
467 def find_issues
467 def find_issues
468 @issues = Issue.find_all_by_id(params[:id] || params[:ids])
468 @issues = Issue.find_all_by_id(params[:id] || params[:ids])
469 raise ActiveRecord::RecordNotFound if @issues.empty?
469 raise ActiveRecord::RecordNotFound if @issues.empty?
470 projects = @issues.collect(&:project).compact.uniq
470 projects = @issues.collect(&:project).compact.uniq
471 if projects.size == 1
471 if projects.size == 1
472 @project = projects.first
472 @project = projects.first
473 else
473 else
474 # TODO: let users bulk edit/move/destroy issues from different projects
474 # TODO: let users bulk edit/move/destroy issues from different projects
475 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'
476 return false
476 return false
477 end
477 end
478 rescue ActiveRecord::RecordNotFound
478 rescue ActiveRecord::RecordNotFound
479 render_404
479 render_404
480 end
480 end
481
481
482 def find_project
482 def find_project
483 project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
483 project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
484 @project = Project.find(project_id)
484 @project = Project.find(project_id)
485 rescue ActiveRecord::RecordNotFound
485 rescue ActiveRecord::RecordNotFound
486 render_404
486 render_404
487 end
487 end
488
488
489 def find_optional_project
489 def find_optional_project
490 @project = Project.find(params[:project_id]) unless params[:project_id].blank?
490 @project = Project.find(params[:project_id]) unless params[:project_id].blank?
491 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)
492 allowed ? true : deny_access
492 allowed ? true : deny_access
493 rescue ActiveRecord::RecordNotFound
493 rescue ActiveRecord::RecordNotFound
494 render_404
494 render_404
495 end
495 end
496
496
497 # Retrieve query from session or build a new query
497 # Retrieve query from session or build a new query
498 def retrieve_query
498 def retrieve_query
499 if !params[:query_id].blank?
499 if !params[:query_id].blank?
500 cond = "project_id IS NULL"
500 cond = "project_id IS NULL"
501 cond << " OR project_id = #{@project.id}" if @project
501 cond << " OR project_id = #{@project.id}" if @project
502 @query = Query.find(params[:query_id], :conditions => cond)
502 @query = Query.find(params[:query_id], :conditions => cond)
503 @query.project = @project
503 @query.project = @project
504 session[:query] = {:id => @query.id, :project_id => @query.project_id}
504 session[:query] = {:id => @query.id, :project_id => @query.project_id}
505 sort_clear
505 sort_clear
506 else
506 else
507 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)
508 # Give it a name, required to be valid
508 # Give it a name, required to be valid
509 @query = Query.new(:name => "_")
509 @query = Query.new(:name => "_")
510 @query.project = @project
510 @query.project = @project
511 if params[:fields] and params[:fields].is_a? Array
511 if params[:fields] and params[:fields].is_a? Array
512 params[:fields].each do |field|
512 params[:fields].each do |field|
513 @query.add_filter(field, params[:operators][field], params[:values][field])
513 @query.add_filter(field, params[:operators][field], params[:values][field])
514 end
514 end
515 else
515 else
516 @query.available_filters.keys.each do |field|
516 @query.available_filters.keys.each do |field|
517 @query.add_short_filter(field, params[field]) if params[field]
517 @query.add_short_filter(field, params[field]) if params[field]
518 end
518 end
519 end
519 end
520 @query.group_by = params[:group_by]
520 @query.group_by = params[:group_by]
521 @query.column_names = params[:query] && params[:query][:column_names]
521 @query.column_names = params[:query] && params[:query][:column_names]
522 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}
523 else
523 else
524 @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]
525 @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])
526 @query.project = @project
526 @query.project = @project
527 end
527 end
528 end
528 end
529 end
529 end
530
530
531 # Rescues an invalid query statement. Just in case...
531 # Rescues an invalid query statement. Just in case...
532 def query_statement_invalid(exception)
532 def query_statement_invalid(exception)
533 logger.error "Query::StatementInvalid: #{exception.message}" if logger
533 logger.error "Query::StatementInvalid: #{exception.message}" if logger
534 session.delete(:query)
534 session.delete(:query)
535 sort_clear
535 sort_clear
536 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."
537 end
537 end
538
538
539 # Used by #edit and #update to set some common instance variables
539 # Used by #edit and #update to set some common instance variables
540 # from the params
540 # from the params
541 # TODO: Refactor, not everything in here is needed by #edit
541 # TODO: Refactor, not everything in here is needed by #edit
542 def update_issue_from_params
542 def update_issue_from_params
543 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
543 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
544 @priorities = IssuePriority.all
544 @priorities = IssuePriority.all
545 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
545 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
546 @time_entry = TimeEntry.new
546 @time_entry = TimeEntry.new
547
547
548 @notes = params[:notes]
548 @notes = params[:notes]
549 @journal = @issue.init_journal(User.current, @notes)
549 @journal = @issue.init_journal(User.current, @notes)
550 # 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
551 if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
551 if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
552 attrs = params[:issue].dup
552 attrs = params[:issue].dup
553 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
554 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}
555 @issue.safe_attributes = attrs
555 @issue.safe_attributes = attrs
556 end
556 end
557
557
558 end
558 end
559
559
560 # TODO: Temporary utility method for #update. Should be split off
560 # TODO: Temporary utility method for #update. Should be split off
561 # and moved to the Issue model (accepts_nested_attributes_for maybe?)
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
562 # TODO: move attach_files to the model so this can be moved to the
563 # model also
563 # model also
564 def issue_update
564 def issue_update
565 if params[:time_entry] && params[:time_entry][:hours].present? && User.current.allowed_to?(:log_time, @project)
565 @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today)
566 @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today)
566 @time_entry.attributes = params[:time_entry]
567 @time_entry.attributes = params[:time_entry]
567 if (@time_entry.hours.nil? || @time_entry.valid?) && @issue.valid?
568 @issue.time_entries << @time_entry
569 end
570
571 if @issue.valid?
568 attachments = attach_files(@issue, params[:attachments])
572 attachments = attach_files(@issue, params[:attachments])
569 attachments.each {|a| @journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)}
573 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})
574 call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
571 if @issue.save
575 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?
576 if !@journal.new_record?
577 # Only send notification if something was actually changed
577 # Only send notification if something was actually changed
578 flash[:notice] = l(:notice_successful_update)
578 flash[:notice] = l(:notice_successful_update)
579 end
579 end
580 call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
580 call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal})
581 return true
581 return true
582 end
582 end
583 end
583 end
584 # failure, returns false
584 # failure, returns false
585
585
586 end
586 end
587 end
587 end
General Comments 0
You need to be logged in to leave comments. Login now