mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-27 19:21:11 +00:00
Code cleanup.
git-svn-id: http://svn.redmine.org/redmine/trunk@13513 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0b6a159622
commit
46d4d75ccd
@ -418,22 +418,18 @@ class IssuesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
@issue.project = @project
|
@issue.project = @project
|
||||||
|
@issue.author ||= User.current
|
||||||
|
@issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
|
||||||
else
|
else
|
||||||
@issue = @project.issues.visible.find(params[:id])
|
@issue = @project.issues.visible.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
@issue.project = @project
|
@issue.safe_attributes = params[:issue]
|
||||||
@issue.author ||= User.current
|
@issue.tracker ||= @project.trackers.first
|
||||||
# Tracker must be set before custom field values
|
|
||||||
tracker_id = (params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id]
|
|
||||||
tracker = tracker_id.present? ? @project.trackers.find(tracker_id) : @project.trackers.first
|
|
||||||
@issue.tracker ||= tracker
|
|
||||||
if @issue.tracker.nil?
|
if @issue.tracker.nil?
|
||||||
render_error l(:error_no_tracker_in_project)
|
render_error l(:error_no_tracker_in_project)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
|
|
||||||
@issue.safe_attributes = params[:issue]
|
|
||||||
|
|
||||||
@priorities = IssuePriority.active
|
@priorities = IssuePriority.active
|
||||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current, @issue.new_record?)
|
@allowed_statuses = @issue.new_statuses_allowed_to(User.current, @issue.new_record?)
|
||||||
|
|||||||
@ -295,24 +295,31 @@ class Issue < ActiveRecord::Base
|
|||||||
write_attribute(:fixed_version_id, vid)
|
write_attribute(:fixed_version_id, vid)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tracker_id=(tid)
|
def tracker_id=(tracker_id)
|
||||||
self.tracker = nil
|
if tracker_id.to_s != self.tracker_id.to_s
|
||||||
result = write_attribute(:tracker_id, tid)
|
self.tracker = (tracker_id.present? ? Tracker.find_by_id(tracker_id) : nil)
|
||||||
@custom_field_values = nil
|
end
|
||||||
@workflow_rule_by_attribute = nil
|
self.tracker_id
|
||||||
result
|
end
|
||||||
|
|
||||||
|
def tracker=(tracker)
|
||||||
|
if tracker != self.tracker
|
||||||
|
@custom_field_values = nil
|
||||||
|
@workflow_rule_by_attribute = nil
|
||||||
|
end
|
||||||
|
association(:tracker).writer(tracker)
|
||||||
end
|
end
|
||||||
|
|
||||||
def project_id=(project_id)
|
def project_id=(project_id)
|
||||||
if project_id.to_s != self.project_id.to_s
|
if project_id.to_s != self.project_id.to_s
|
||||||
self.project = (project_id.present? ? Project.find_by_id(project_id) : nil)
|
self.project = (project_id.present? ? Project.find_by_id(project_id) : nil)
|
||||||
end
|
end
|
||||||
|
self.project_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def project=(project, keep_tracker=false)
|
def project=(project, keep_tracker=false)
|
||||||
project_was = self.project
|
project_was = self.project
|
||||||
write_attribute(:project_id, project ? project.id : nil)
|
association(:project).writer(project)
|
||||||
association_instance_set('project', project)
|
|
||||||
if project_was && project && project_was != project
|
if project_was && project && project_was != project
|
||||||
@assignable_versions = nil
|
@assignable_versions = nil
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user