mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-26 10:21:14 +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
|
||||
@issue.project = @project
|
||||
@issue.author ||= User.current
|
||||
@issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
|
||||
else
|
||||
@issue = @project.issues.visible.find(params[:id])
|
||||
end
|
||||
|
||||
@issue.project = @project
|
||||
@issue.author ||= User.current
|
||||
# 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
|
||||
@issue.safe_attributes = params[:issue]
|
||||
@issue.tracker ||= @project.trackers.first
|
||||
if @issue.tracker.nil?
|
||||
render_error l(:error_no_tracker_in_project)
|
||||
return false
|
||||
end
|
||||
@issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
|
||||
@issue.safe_attributes = params[:issue]
|
||||
|
||||
@priorities = IssuePriority.active
|
||||
@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)
|
||||
end
|
||||
|
||||
def tracker_id=(tid)
|
||||
self.tracker = nil
|
||||
result = write_attribute(:tracker_id, tid)
|
||||
@custom_field_values = nil
|
||||
@workflow_rule_by_attribute = nil
|
||||
result
|
||||
def tracker_id=(tracker_id)
|
||||
if tracker_id.to_s != self.tracker_id.to_s
|
||||
self.tracker = (tracker_id.present? ? Tracker.find_by_id(tracker_id) : nil)
|
||||
end
|
||||
self.tracker_id
|
||||
end
|
||||
|
||||
def tracker=(tracker)
|
||||
if tracker != self.tracker
|
||||
@custom_field_values = nil
|
||||
@workflow_rule_by_attribute = nil
|
||||
end
|
||||
association(:tracker).writer(tracker)
|
||||
end
|
||||
|
||||
def project_id=(project_id)
|
||||
if project_id.to_s != self.project_id.to_s
|
||||
self.project = (project_id.present? ? Project.find_by_id(project_id) : nil)
|
||||
end
|
||||
self.project_id
|
||||
end
|
||||
|
||||
def project=(project, keep_tracker=false)
|
||||
project_was = self.project
|
||||
write_attribute(:project_id, project ? project.id : nil)
|
||||
association_instance_set('project', project)
|
||||
association(:project).writer(project)
|
||||
if project_was && project && project_was != project
|
||||
@assignable_versions = nil
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user