mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-26 13:31:45 +00:00
code layout clean up app/controllers/issues_controller.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19176 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
80b0ee2cf8
commit
f50d50f7b8
@ -599,7 +599,9 @@ class IssuesController < ApplicationController
|
|||||||
# Saves @issue and a time_entry from the parameters
|
# Saves @issue and a time_entry from the parameters
|
||||||
def save_issue_with_child_records
|
def save_issue_with_child_records
|
||||||
Issue.transaction do
|
Issue.transaction do
|
||||||
if params[:time_entry] && (params[:time_entry][:hours].present? || params[:time_entry][:comments].present?) && User.current.allowed_to?(:log_time, @issue.project)
|
if params[:time_entry] &&
|
||||||
|
(params[:time_entry][:hours].present? || params[:time_entry][:comments].present?) &&
|
||||||
|
User.current.allowed_to?(:log_time, @issue.project)
|
||||||
time_entry = @time_entry || TimeEntry.new
|
time_entry = @time_entry || TimeEntry.new
|
||||||
time_entry.project = @issue.project
|
time_entry.project = @issue.project
|
||||||
time_entry.issue = @issue
|
time_entry.issue = @issue
|
||||||
@ -608,10 +610,19 @@ class IssuesController < ApplicationController
|
|||||||
time_entry.safe_attributes = params[:time_entry]
|
time_entry.safe_attributes = params[:time_entry]
|
||||||
@issue.time_entries << time_entry
|
@issue.time_entries << time_entry
|
||||||
end
|
end
|
||||||
|
call_hook(
|
||||||
call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal})
|
:controller_issues_edit_before_save,
|
||||||
|
{:params => params, :issue => @issue,
|
||||||
|
:time_entry => time_entry,
|
||||||
|
:journal => @issue.current_journal}
|
||||||
|
)
|
||||||
if @issue.save
|
if @issue.save
|
||||||
call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal})
|
call_hook(
|
||||||
|
:controller_issues_edit_after_save,
|
||||||
|
{:params => params, :issue => @issue,
|
||||||
|
:time_entry => time_entry,
|
||||||
|
:journal => @issue.current_journal}
|
||||||
|
)
|
||||||
else
|
else
|
||||||
raise ActiveRecord::Rollback
|
raise ActiveRecord::Rollback
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user