Code cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8527 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-01-06 20:46:45 +00:00
parent f3a2c8d7f7
commit 6d974eb018
1 changed files with 2 additions and 13 deletions

View File

@ -138,15 +138,7 @@ class Issue < ActiveRecord::Base
# Moves/copies an issue to a new project and tracker # Moves/copies an issue to a new project and tracker
# Returns the moved/copied issue on success, false on failure # Returns the moved/copied issue on success, false on failure
def move_to_project(*args) def move_to_project(new_project, new_tracker=nil, options={})
ret = Issue.transaction do
move_to_project_without_transaction(*args) || raise(ActiveRecord::Rollback)
end || false
end
def move_to_project_without_transaction(new_project, new_tracker = nil, options = {})
options ||= {}
if options[:copy] if options[:copy]
issue = self.class.new.copy_from(self) issue = self.class.new.copy_from(self)
else else
@ -164,10 +156,7 @@ class Issue < ActiveRecord::Base
issue.attributes = options[:attributes] issue.attributes = options[:attributes]
end end
unless issue.save issue.save ? issue : false
return false
end
issue
end end
def status_id=(sid) def status_id=(sid)